mirror of
https://github.com/systemd/systemd
synced 2026-04-18 04:55:04 +02:00
Compare commits
2 Commits
a24e3938e8
...
362c62296a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
362c62296a | ||
|
|
697bb76589 |
@ -44,8 +44,8 @@ enum loader_type {
|
|||||||
LOADER_UNDEFINED,
|
LOADER_UNDEFINED,
|
||||||
LOADER_AUTO,
|
LOADER_AUTO,
|
||||||
LOADER_EFI,
|
LOADER_EFI,
|
||||||
LOADER_LINUX,
|
LOADER_LINUX, /* Boot loader spec type #1 entries */
|
||||||
LOADER_STUB,
|
LOADER_UNIFIED_LINUX, /* Boot loader spec type #2 entries */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -856,13 +856,13 @@ static BOOLEAN menu_run(
|
|||||||
case KEYPRESS(0, 0, 'E'):
|
case KEYPRESS(0, 0, 'E'):
|
||||||
/* only the options of configured entries can be edited */
|
/* only the options of configured entries can be edited */
|
||||||
if (!config->editor || !IN_SET(config->entries[idx_highlight]->type,
|
if (!config->editor || !IN_SET(config->entries[idx_highlight]->type,
|
||||||
LOADER_EFI, LOADER_LINUX, LOADER_STUB))
|
LOADER_EFI, LOADER_LINUX, LOADER_UNIFIED_LINUX))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The stub will not accept command line options when secure boot is enabled
|
/* Unified kernels that are signed as a whole will not accept command line options
|
||||||
* unless there is none embedded in the image. Do not try to pretend we
|
* when secure boot is enabled unless there is none embedded in the image. Do not try
|
||||||
* can edit it to only have it be ignored. */
|
* to pretend we can edit it to only have it be ignored. */
|
||||||
if (config->entries[idx_highlight]->type == LOADER_STUB &&
|
if (config->entries[idx_highlight]->type == LOADER_UNIFIED_LINUX &&
|
||||||
secure_boot_enabled() &&
|
secure_boot_enabled() &&
|
||||||
config->entries[idx_highlight]->options)
|
config->entries[idx_highlight]->options)
|
||||||
break;
|
break;
|
||||||
@ -2196,7 +2196,7 @@ static void config_entry_add_linux(
|
|||||||
entry = config_entry_add_loader(
|
entry = config_entry_add_loader(
|
||||||
config,
|
config,
|
||||||
device,
|
device,
|
||||||
LOADER_STUB,
|
LOADER_UNIFIED_LINUX,
|
||||||
f->FileName,
|
f->FileName,
|
||||||
/* key= */ 'l',
|
/* key= */ 'l',
|
||||||
good_name,
|
good_name,
|
||||||
|
|||||||
59
src/libsystemd-network/fuzz-dhcp6-client-send.c
Normal file
59
src/libsystemd-network/fuzz-dhcp6-client-send.c
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
|
||||||
|
#include "fuzz.h"
|
||||||
|
|
||||||
|
#include "sd-dhcp6-client.c"
|
||||||
|
|
||||||
|
int dhcp6_network_send_udp_socket(int s, struct in6_addr *server_address,
|
||||||
|
const void *packet, size_t len) {
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) {
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
|
||||||
|
assert_se(fd >= 0);
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||||
|
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||||
|
_cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL;
|
||||||
|
struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } };
|
||||||
|
triple_timestamp t = {};
|
||||||
|
usec_t time_now;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if (size < sizeof(DHCP6Message))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
assert_se(sd_event_new(&e) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_new(&client) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_attach_event(client, e, 0) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_ifindex(client, 42) == 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_fqdn(client, "example.com") == 1);
|
||||||
|
assert_se(sd_dhcp6_client_set_request_mud_url(client, "https://www.example.com/mudfile.json") >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_request_user_class(client, STRV_MAKE("u1", "u2", "u3")) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_request_vendor_class(client, STRV_MAKE("v1", "v2", "v3")) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_local_address(client, &address) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_information_request(client, false) == 0);
|
||||||
|
dhcp6_client_set_test_mode(client, true);
|
||||||
|
assert_se(sd_dhcp6_client_start(client) >= 0);
|
||||||
|
assert_se(sd_dhcp6_client_set_transaction_id(client, htobe32(0x00ffffff) & ((const DHCP6Message *) data)->transaction_id) == 0);
|
||||||
|
|
||||||
|
triple_timestamp_get(&t);
|
||||||
|
if (client_receive_advertise(client, (DHCP6Message *) data, size, &t, NULL) != DHCP6_STATE_REQUEST)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
r = sd_event_now(client->event, clock_boottime_or_monotonic(), &time_now);
|
||||||
|
if (r < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
client->state = DHCP6_STATE_REQUEST;
|
||||||
|
(void) client_send_message(client, time_now);
|
||||||
|
cleanup:
|
||||||
|
assert_se(sd_dhcp6_client_stop(client) >= 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@ -113,6 +113,10 @@ fuzzers += [
|
|||||||
[libshared,
|
[libshared,
|
||||||
libsystemd_network]],
|
libsystemd_network]],
|
||||||
|
|
||||||
|
[files('fuzz-dhcp6-client-send.c'),
|
||||||
|
[libshared,
|
||||||
|
libsystemd_network]],
|
||||||
|
|
||||||
[files('fuzz-dhcp-server.c'),
|
[files('fuzz-dhcp-server.c'),
|
||||||
[libsystemd_network,
|
[libsystemd_network,
|
||||||
libshared]],
|
libshared]],
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user