mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 06:25:37 +03:00
dhcp-identifier: always use a fixed machine-id while fuzzing
It's a follow-up to https://github.com/systemd/systemd/pull/10200 where that fuzzer was introduced. At the time it was run regularly on machines where machine-id wasn't present so it was kind of reproducible. Now it's run on CIFuzz and CFLite using GHActions with the public OSS-Fuzz corpora (based on that particular machine-id) so to fully utilize those corpora it's necessary to use it always. Other than that it makes it possible for fuzzers targeting outgoing packets based on incoming packets like https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1795921 to get past client_parse_message on my machine :-)
This commit is contained in:
parent
e85fdacc8a
commit
9216fddc5a
@ -110,19 +110,17 @@ int dhcp_identifier_set_duid_ll(struct duid *duid, const uint8_t *addr, size_t a
|
||||
int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len) {
|
||||
sd_id128_t machine_id;
|
||||
uint64_t hash;
|
||||
int r;
|
||||
|
||||
assert(duid);
|
||||
assert(len);
|
||||
|
||||
r = sd_id128_get_machine(&machine_id);
|
||||
if (r < 0) {
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
machine_id = SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10);
|
||||
#else
|
||||
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
int r = sd_id128_get_machine(&machine_id);
|
||||
if (r < 0)
|
||||
return r;
|
||||
#else
|
||||
machine_id = SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
unaligned_write_be16(&duid->type, DUID_TYPE_EN);
|
||||
unaligned_write_be32(&duid->en.pen, SYSTEMD_PEN);
|
||||
|
Loading…
Reference in New Issue
Block a user