]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agotest-sd-device: skip gpio subsystem 23337/head
Yu Watanabe [Wed, 11 May 2022 17:00:38 +0000 (02:00 +0900)] 
test-sd-device: skip gpio subsystem

There exist /sys/class/gpio and /sys/bus/gpio, and both have gpiochip%N
device. However, these point to different devpaths.

3 years agosd-device: always translate sysname to sysfs filename
Yu Watanabe [Tue, 10 May 2022 14:05:04 +0000 (23:05 +0900)] 
sd-device: always translate sysname to sysfs filename

Previously, in sd_device_new_from_subsystem_sysname(), '/' in sysname
was replaced '!' for several limited subsystems. This was based on a wrong
assumption that no sysname in e.g. driver subsystem does not contain '!'.
And the assumption is actually wrong, and trigger issue #23327.

In device_set_sysname_and_sysnum() we unconditionally replace '!' in the
filename. Hence, the translation in sd_device_new_from_subsystem_sysname()
must be also done unconditionally.

Fixes #23327.

3 years agoman,mkosi: fedora 36 has been released
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 15:35:24 +0000 (17:35 +0200)] 
man,mkosi: fedora 36 has been released

3 years agoMerge pull request #23361 from keszybz/resolved-helpers
Yu Watanabe [Thu, 12 May 2022 17:33:29 +0000 (02:33 +0900)] 
Merge pull request #23361 from keszybz/resolved-helpers

Add some ref-unref helpers for resolved

3 years agoMerge pull request #23358 from keszybz/fuzzer-input-sizes
Yu Watanabe [Thu, 12 May 2022 16:04:20 +0000 (01:04 +0900)] 
Merge pull request #23358 from keszybz/fuzzer-input-sizes

fuzzers: add input size limits, always configure limits in two ways

3 years agoresolved: add DNS_PACKET_REPLACE 23361/head
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 15:12:59 +0000 (17:12 +0200)] 
resolved: add DNS_PACKET_REPLACE

3 years agoresolved: add DNS_RESOURCE_KEY_REPLACE
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 15:12:46 +0000 (17:12 +0200)] 
resolved: add DNS_RESOURCE_KEY_REPLACE

3 years agoresolved: add DNS_RR_REPLACE
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 15:03:07 +0000 (17:03 +0200)] 
resolved: add DNS_RR_REPLACE

3 years agoresolved: add DNS_ANSWER_REPLACE
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 14:45:49 +0000 (16:45 +0200)] 
resolved: add DNS_ANSWER_REPLACE

C.f. ce913e0ec4c97651c7c1509b72fb81ee61d80c6a.

3 years agoresolved: use saturate_add()
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 14:37:10 +0000 (16:37 +0200)] 
resolved: use saturate_add()

3 years agoAdd saturate_add() that generalizes size_add()
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 14:29:48 +0000 (16:29 +0200)] 
Add saturate_add() that generalizes size_add()

3 years agoMerge pull request #23289 from yuwata/resolve-answer-add-rrsig
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 14:15:12 +0000 (16:15 +0200)] 
Merge pull request #23289 from yuwata/resolve-answer-add-rrsig

resolve: place RRSIG after the corresponding entries

3 years agofuzzers: ignore size limits when compiled standalone 23358/head
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 10:51:11 +0000 (12:51 +0200)] 
fuzzers: ignore size limits when compiled standalone

This way we can still call fuzzers on old samples, but oss-fuzz will not waste
its and our time finding overly large inputs.

3 years agofix typo
Stefan Seering [Thu, 12 May 2022 12:05:12 +0000 (14:05 +0200)] 
fix typo

3 years agofuzzers: add input size limits, always configure limits in two ways
Yu Watanabe [Thu, 30 Dec 2021 19:30:43 +0000 (04:30 +0900)] 
fuzzers: add input size limits, always configure limits in two ways

Without the size limits, oss-fuzz creates huge samples that time out. Usually
this is because some of our code has bad algorithmic complexity. For data like
configuration samples we don't need to care about this: non-rogue configs are
rarely more than a few items, and a bit of a slowdown with a few hundred items
is acceptable. This wouldn't be OK for processing of untrusted data though.

We need to set the limit in two ways: through .options and in the code. The
first because it nicely allows libFuzzer to avoid wasting time, and the second
because fuzzers like hongfuzz and afl don't support .options.

While at it, let's fix an off-by-one (65535 is the largest offset for a
power-of-two size, but we're checking the size here).

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
3 years agofuzz-dhcp-server: remove limit on input size
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 11:30:24 +0000 (13:30 +0200)] 
fuzz-dhcp-server: remove limit on input size

It was added originally back in 2bd37c5be2f09950f26351506a00929c8719ea15,
but there doesn't seem to by any particular reason for it.

3 years agosd-device-enumerator: fix inverted return value of match_initialized()
Yu Watanabe [Wed, 11 May 2022 19:11:37 +0000 (04:11 +0900)] 
sd-device-enumerator: fix inverted return value of match_initialized()

Fixes a bug introduced by d8b50e5df7e01983279e70c6d970fb60d053df97.

Fixes https://github.com/systemd/systemd/pull/22662#issuecomment-1124163773.
Fixes RHBZ#2083374 (https://bugzilla.redhat.com/show_bug.cgi?id=2083374).

3 years agotests: ignore dbus-broker-launcher
Evgeny Vereshchagin [Wed, 11 May 2022 22:32:32 +0000 (22:32 +0000)] 
tests: ignore dbus-broker-launcher

There are memory leaks there https://github.com/bus1/dbus-broker/issues/289
and it crashes from time to time
https://github.com/matusmarhefka/dfuzzer/issues/20#issuecomment-1114097840
so let's just skip it by analogy with dbus-daemon to avoid
reports that have nothing to do with systemd itself.

It's kind of a part of https://github.com/systemd/systemd/pull/22547

3 years agoMerge pull request #23351 from keszybz/logind-message
Yu Watanabe [Wed, 11 May 2022 20:25:21 +0000 (05:25 +0900)] 
Merge pull request #23351 from keszybz/logind-message

logind: fix crash in logind on bad message string

3 years agoman: improve VtableExample
Luca Boccassi [Wed, 11 May 2022 14:19:58 +0000 (15:19 +0100)] 
man: improve VtableExample

The methods published by the example have a reply in the signature, but
the code was not sending any, so the client gets stuck waiting for a
response that doesn't arrive. Echo back the input string.

Update the object path to follow what would be the canonical format.

Request a service name on the bus, so that the code can be dropped in a
service and it can be dbus-activatable. It also makes it easier to see
on busctl list.

3 years agomeson: turn on log-message-verification by default in developer builds 23351/head
Zbigniew Jędrzejewski-Szmek [Wed, 11 May 2022 14:42:13 +0000 (16:42 +0200)] 
meson: turn on log-message-verification by default in developer builds

I'm not _quite_ convinced that this a good idea… I'm at least keeping
it separate to make it easy to revert ;)

3 years agotest: ignore LXC filesystem when checking for writable locations
Luca Boccassi [Wed, 11 May 2022 11:24:10 +0000 (12:24 +0100)] 
test: ignore LXC filesystem when checking for writable locations

test-execute checks that only /var/lib/private/waldo is writable, but there are
some filesystems that are always writable and excluded. Add /sys/devices/system/cpu
which is created by lxcfs.

Fixes https://github.com/systemd/systemd/issues/23263

3 years agoMerge pull request #23349 from eliasp/doc-typo
Luca Boccassi [Wed, 11 May 2022 14:59:40 +0000 (15:59 +0100)] 
Merge pull request #23349 from eliasp/doc-typo

Fix typo in docs/BUILDING_IMAGES.md, format `PID 1` consistently in docs/

3 years agoDo LOG_MESSAGE_VERIFICATION in coverity runs
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 12:12:57 +0000 (14:12 +0200)] 
Do LOG_MESSAGE_VERIFICATION in coverity runs

This should be enough to get reports if we screw up anywhere, coverity does
analysis of printf format strings.

3 years agoOptionally call printf on LOG_MESSAGE() arguments
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 12:11:55 +0000 (14:11 +0200)] 
Optionally call printf on LOG_MESSAGE() arguments

With an intentional mistake:

../src/login/logind-dbus.c: In function ‘bus_manager_log_shutdown’:
../src/login/logind-dbus.c:1542:39: error: format ‘%s’ expects a matching ‘char *’ argument [-Werror=format=]
 1542 |                           LOG_MESSAGE("%s %s", message),
      |                                       ^~~~~~~

3 years agocore: use LOG_UNIT_MESSAGE() where appropriate
Zbigniew Jędrzejewski-Szmek [Wed, 11 May 2022 05:40:29 +0000 (07:40 +0200)] 
core: use LOG_UNIT_MESSAGE() where appropriate

3 years agotree-wide: use LOG_MESSAGE() where possible
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 11:39:08 +0000 (13:39 +0200)] 
tree-wide: use LOG_MESSAGE() where possible

Also break some long lines for more uniform formatting. No functional change.

I went over all log_struct, log_struct_errno, log_unit_struct,
log_unit_struct_errno calls, and they seem fine.

3 years agologind: rename "log_message" to "log_verb"
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 15:51:42 +0000 (17:51 +0200)] 
logind: rename "log_message" to "log_verb"

This field is used to log SHUTDOWN=. Calling it "something-message" is
confusing.

3 years agologind: fix crash in logind on user-specified message string
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 15:21:09 +0000 (17:21 +0200)] 
logind: fix crash in logind on user-specified message string

This is trivially exploitable (in the sense of causing a crash from SEGV) e.g.
by 'shutdown now "Message %s %s %n"'. The message is settable through polkit,
but is limited to auth_admin:

<action id="org.freedesktop.login1.set-wall-message">
         <description gettext-domain="systemd">Set a wall message</description>
         <message gettext-domain="systemd">Authentication is required to set a wall message</message>
         <defaults>
                <allow_any>auth_admin_keep</allow_any>
                <allow_inactive>auth_admin_keep</allow_inactive>
                <allow_active>auth_admin_keep</allow_active>
        </defaults>
</action>

Bug introduced in 9ef15026c0e7e6600372056c43442c99ec53746e
('logind/systemctl: introduce SetWallMessage and --message', 2015-09-15).

3 years agoUpdate TODO
Luca Boccassi [Wed, 11 May 2022 13:51:37 +0000 (14:51 +0100)] 
Update TODO

3 years agoUse consistent formatting for `PID 1` across `docs/` 23349/head
Elias Probst [Wed, 11 May 2022 13:31:07 +0000 (15:31 +0200)] 
Use consistent formatting for `PID 1` across `docs/`

3 years agoTypo (`swich-root` → `switch-root`)
Elias Probst [Wed, 11 May 2022 13:30:21 +0000 (15:30 +0200)] 
Typo (`swich-root` → `switch-root`)

3 years agoMerge pull request #23331 from kmoriwak/tmpfiles-quickref
Zbigniew Jędrzejewski-Szmek [Wed, 11 May 2022 07:08:39 +0000 (09:08 +0200)] 
Merge pull request #23331 from kmoriwak/tmpfiles-quickref

man: add missing cleanup-age to tmpfiles.d quickref

3 years agoman: mention to Age parameter in C Type 23331/head
Kazuo Moriwaka [Wed, 11 May 2022 06:08:34 +0000 (15:08 +0900)] 
man: mention to Age parameter in C Type

3 years agomeson: sort files
Yu Watanabe [Tue, 10 May 2022 14:46:55 +0000 (23:46 +0900)] 
meson: sort files

3 years agoMerge pull request #23335 from keszybz/fuzz-json-more-coverage
Yu Watanabe [Tue, 10 May 2022 17:12:57 +0000 (02:12 +0900)] 
Merge pull request #23335 from keszybz/fuzz-json-more-coverage

More coverage in fuzz-json

3 years agofuzz-bootspec: limit input size
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 09:55:37 +0000 (11:55 +0200)] 
fuzz-bootspec: limit input size

https://oss-fuzz.com/testcase-detail/5680508182331392 has the
first timeout with 811kb of input. As in the other cases, the code
is known to be slow with lots of repeated entries and we're fine with
that.

3 years agoMerge pull request #23336 from keszybz/fuzz-calendarspec-more-coverage
Yu Watanabe [Tue, 10 May 2022 17:12:11 +0000 (02:12 +0900)] 
Merge pull request #23336 from keszybz/fuzz-calendarspec-more-coverage

More coverage in fuzz-calendarspec

3 years agoshared/json: fix memleak in sort 23335/head
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 08:51:43 +0000 (10:51 +0200)] 
shared/json: fix memleak in sort

3 years agoshared/json: fix another memleak in normalization
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 07:05:43 +0000 (09:05 +0200)] 
shared/json: fix another memleak in normalization

3 years agofuzz-json: also try self-merge operations
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 13:14:33 +0000 (15:14 +0200)] 
fuzz-json: also try self-merge operations

This might even work ;)

3 years agobasic/alloc-util: remove unnecessary parens
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 13:11:20 +0000 (15:11 +0200)] 
basic/alloc-util: remove unnecessary parens

Those symbols are not macros anymore, so we can drop parens.

3 years agoshared/json: add helper to ref first, unref second
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 13:10:36 +0000 (15:10 +0200)] 
shared/json: add helper to ref first, unref second

This normally wouldn't happen, but if some of those places were called
with lhs and rhs being the same object, we could unref the last ref first,
and then try to take the ref again. It's easier to be safe, and with the
helper we save some lines too.

3 years agoshared/calendarspec: fix formatting of entries which collapse to a star 23336/head
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 09:35:52 +0000 (11:35 +0200)] 
shared/calendarspec: fix formatting of entries which collapse to a star

We canonicalize repeats that cover the whole range: "0:0:0/1" → "0:0:*".  But
we'd also do "0:0:0/1,0" → "0:0:*,0", which we then refuse to parse.  Thus,
first go throug the whole chain, and print a '*' and nothing else if any of the
components covers the whole range.

3 years agoMerge pull request #23329 from superm1/mlimonci/lg850-gl
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 11:52:36 +0000 (13:52 +0200)] 
Merge pull request #23329 from superm1/mlimonci/lg850-gl

Set auto-suspend delay on LG850-GL

3 years agocore/timer: fix potential use-after-free
Yu Watanabe [Tue, 10 May 2022 05:10:17 +0000 (14:10 +0900)] 
core/timer: fix potential use-after-free

3 years agocore/timer: fix memleak
Yu Watanabe [Tue, 10 May 2022 05:09:24 +0000 (14:09 +0900)] 
core/timer: fix memleak

Fixes #23326.

3 years agoshared/calendarspec: fix printing of second ranges which start with 0
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 08:25:01 +0000 (10:25 +0200)] 
shared/calendarspec: fix printing of second ranges which start with 0

0..3 is not the same as 0..infinity, we need to check both ends of the range.
This logic was added in 3215e35c405278491f55fb486d349f132e93f516, and back then
the field was called .value. .stop was added later and apparently wasn't taken
into account here.

3 years agotest-calendarspec: tighten tests and add more logging
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 08:22:48 +0000 (10:22 +0200)] 
test-calendarspec: tighten tests and add more logging

3 years agoshared/calendarspec: wrap long comments and reduce scope of one var
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 07:52:14 +0000 (09:52 +0200)] 
shared/calendarspec: wrap long comments and reduce scope of one var

3 years agofuzz-calendarspec: increase coverage by calculating occurences
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 07:49:27 +0000 (09:49 +0200)] 
fuzz-calendarspec: increase coverage by calculating occurences

Coverage data shows that we didn't test calendar_spec_next_usec() and
associated functions at all.

The input samples so far were only used until the first NUL. We take advantage
of that by using the part until the second NUL as the starting timestamp,
retaining backwards compatibility for how the first part is used.

3 years agofuzz-calendarspec: add input sample with a list of weekdays and all syntax characters
Zbigniew Jędrzejewski-Szmek [Tue, 10 May 2022 08:40:20 +0000 (10:40 +0200)] 
fuzz-calendarspec: add input sample with a list of weekdays and all syntax characters

This should make the fuzzer searches start off a bit better.

3 years agoshared/calendarspec: make function static void
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 06:57:36 +0000 (08:57 +0200)] 
shared/calendarspec: make function static void

calendar_spec_from_string() already calls calendar_spec_normalize(), so
there is no point in calling it from the fuzzer. Once that's removed, there's
just one internal caller and it can be made static.

3 years agoshared/json: fix memory leak on failed normalization
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 12:28:36 +0000 (14:28 +0200)] 
shared/json: fix memory leak on failed normalization

We need to increase the counter immediately after taking the ref,
otherwise we may not unref it properly if we fail before incrementing.

3 years agoshared/json: wrap long comments
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 11:37:35 +0000 (13:37 +0200)] 
shared/json: wrap long comments

3 years agofuzz-json: also do sorting and normalizing and other easy calls
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 09:07:06 +0000 (11:07 +0200)] 
fuzz-json: also do sorting and normalizing and other easy calls

3 years agoshared/json: reduce scope of variables
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 09:01:32 +0000 (11:01 +0200)] 
shared/json: reduce scope of variables

3 years agofuzz-json: optionally allow logging and output
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 08:41:36 +0000 (10:41 +0200)] 
fuzz-json: optionally allow logging and output

Similarly to other fuzzers… this makes development easier.

3 years agojson: align table
Zbigniew Jędrzejewski-Szmek [Mon, 9 May 2022 08:24:36 +0000 (10:24 +0200)] 
json: align table

3 years agoadd missing cleanup-age to quickref
Kazuo Moriwaka [Tue, 10 May 2022 08:41:21 +0000 (17:41 +0900)] 
add missing cleanup-age to quickref

3 years agoresolve: reallocate DNS scope when DNSSEC and/or DNS-over-TLS settings are changed
Yu Watanabe [Sun, 8 May 2022 05:50:39 +0000 (14:50 +0900)] 
resolve: reallocate DNS scope when DNSSEC and/or DNS-over-TLS settings are changed

Fixes #23227.

3 years agoMerge pull request #23300 from DaanDeMeyer/device-debug
Yu Watanabe [Tue, 10 May 2022 05:29:35 +0000 (14:29 +0900)] 
Merge pull request #23300 from DaanDeMeyer/device-debug

core/device: Add more logging

3 years agocore: annotate Reexecute() as NoReply
Frantisek Sumsal [Mon, 9 May 2022 21:43:40 +0000 (23:43 +0200)] 
core: annotate Reexecute() as NoReply

So we're able to tell from the introspection data that the method
doesn't reply.

3 years agoAdd HUION Inspiroy H420X to hwdb
Yutsuten [Mon, 9 May 2022 15:01:20 +0000 (00:01 +0900)] 
Add HUION Inspiroy H420X to hwdb

3 years agoSet autosuspend delay for Fibocom LG850-GL 23329/head
Mario Limonciello [Tue, 10 May 2022 01:16:26 +0000 (20:16 -0500)] 
Set autosuspend delay for Fibocom LG850-GL

It has been shown that the autosuspend delay for this device enacted
by modem manager will race with suspend and cause system suspend
failures.

This occurred in ChromiumOS on a chromebook, but there is no reason
it won't happen in regular notebooks with the same WWAN.  To avoid
the failure delay autosuspend to a frequency longer than the polling
rate used by modem manager.

Link: https://chromium-review.googlesource.com/c/chromiumos/overlays/board-overlays/+/3635003
Link: https://github.com/freedesktop/ModemManager/blob/43e76bf1bbca8207e37d3fbddfed4bb8578f0170/src/mm-iface-modem.c#L1633
3 years agoAdd support to set autosuspend delay via hwdb
Mario Limonciello [Tue, 10 May 2022 01:16:22 +0000 (20:16 -0500)] 
Add support to set autosuspend delay via hwdb

3 years agoMerge pull request #23321 from poettering/sockaddr-no-cast
Yu Watanabe [Mon, 9 May 2022 14:44:01 +0000 (23:44 +0900)] 
Merge pull request #23321 from poettering/sockaddr-no-cast

tests: avoid sockaddr casts

3 years agocore/slice: make slice_freezer_action() return 0 if freezing state is unchanged
Yu Watanabe [Fri, 6 May 2022 05:01:22 +0000 (14:01 +0900)] 
core/slice: make slice_freezer_action() return 0 if freezing state is unchanged

Fixes #23278.

3 years agomkosi: add shadow package to SUSE Tumbleweed
Luca Boccassi [Mon, 9 May 2022 13:37:20 +0000 (14:37 +0100)] 
mkosi: add shadow package to SUSE Tumbleweed

[1958/1958] Generating export-dbus-interfaces with a custom command
/root/mkosi.build: line 70: groupadd: command not found

3 years agotest: JSON_BUILD_REAL nowadays expects 'double', not 'long double'
Lennart Poettering [Mon, 9 May 2022 10:07:54 +0000 (12:07 +0200)] 
test: JSON_BUILD_REAL nowadays expects 'double', not 'long double'

Follow-up for 337712e777bff389f53e26d5b378d2ceba7d98a8, aka "the great
un-long-double-ification of 2021".

3 years agotests: avoid (struct sockaddr*) casts 23321/head
Lennart Poettering [Mon, 9 May 2022 11:56:39 +0000 (13:56 +0200)] 
tests: avoid (struct sockaddr*) casts

We prefer using using union sockaddr_union instead of casting sockaddr
to the correct types.

Coding style, nothing else.

Follow-up for 0dd5ec58faa329410f1f363769209e95b058b7c3.

3 years agosocket-util: don't reference field by macro parameter name
Lennart Poettering [Mon, 9 May 2022 11:55:28 +0000 (13:55 +0200)] 
socket-util: don't reference field by macro parameter name

Let's avoid ambigituies here. (Interesting that the current users
compiled at all, in fact)

3 years agoupdate TODO
Lennart Poettering [Mon, 9 May 2022 10:17:08 +0000 (12:17 +0200)] 
update TODO

3 years agonetwork: set/unset enumerating flag before/after loop
Yu Watanabe [Mon, 9 May 2022 07:30:36 +0000 (16:30 +0900)] 
network: set/unset enumerating flag before/after loop

3 years agoshared: Fix memory leak in bus_append_execute_property()
Daan De Meyer [Mon, 9 May 2022 07:50:32 +0000 (09:50 +0200)] 
shared: Fix memory leak in bus_append_execute_property()

Fixes #23317

3 years agoMerge pull request #23310 from keszybz/suppress-fuzzer-timeouts-and-errors
Yu Watanabe [Mon, 9 May 2022 06:50:29 +0000 (15:50 +0900)] 
Merge pull request #23310 from keszybz/suppress-fuzzer-timeouts-and-errors

Suppress fuzzer timeouts and errors

3 years agoMerge pull request #23311 from keszybz/bootspec-fuzzer
Yu Watanabe [Mon, 9 May 2022 06:46:49 +0000 (15:46 +0900)] 
Merge pull request #23311 from keszybz/bootspec-fuzzer

Fuzzer for bootspec.c and associated fixes

3 years agoshared/calendarspec: reduce scope of variables 23310/head
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 14:21:10 +0000 (16:21 +0200)] 
shared/calendarspec: reduce scope of variables

3 years agoshared/dissect-image: apply standard indentation
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 14:20:04 +0000 (16:20 +0200)] 
shared/dissect-image: apply standard indentation

3 years agobasic/virt: use STRV_FOREACH instead of iteration with ELEMENTSOF
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 10:49:19 +0000 (12:49 +0200)] 
basic/virt: use STRV_FOREACH instead of iteration with ELEMENTSOF

I think it's a bit simpler, we don't have two indexes.

3 years agolibsystemd-network: constify casts
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 10:39:15 +0000 (12:39 +0200)] 
libsystemd-network: constify casts

It is better to not drop the const-ness from the argument.

3 years agotree-wide: drop de-constifying casts for strv iteration
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 10:30:51 +0000 (12:30 +0200)] 
tree-wide: drop de-constifying casts for strv iteration

When the the iterator variable is declared automatically, it "inherits" the
const/non-const status from the argument. We don't need to cast a const
table to non-const. If we had a programming error and tried to modify the
string, the compiler could now catch this.

3 years agofuzz-journal-remote: allow -ENODATA too
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 09:18:14 +0000 (11:18 +0200)] 
fuzz-journal-remote: allow -ENODATA too

It seems that we try to create a new file, which fails with -ENOSPC, and we
later fail when reading a file with ENODATA.  journal_file_open() will return
-ENODATA if the file is too short or if journal_file_verify_header() fails.
We'll unlink a file we newly created if we fail to initialize it immediately
after creation. I'm not sure if the file we fail to open is the one we newly
created and e.g. failed to create the arena and such, or if it's the file we
were trying to rotate away from. Either way, I think we should be OK with
with a non-fully-initialized journal file.

Failed to create rotated journal: No space left on device
Failed to write entry of 2 bytes: No space left on device
sd_journal_open_files(["/tmp/fuzz-journal-remote.vELRpI.journal"]) failed: No data available
Assertion 'IN_SET(r, -ENOMEM, -EMFILE, -ENFILE)' failed at src/journal-remote/fuzz-journal-remote.c:70, function int LLVMFuzzerTestOneInput(const uint8_t *, size_t)(). Aborting.

oss-fuzz-39238: https://oss-fuzz.com/issue/4609851129462784

3 years agofuzz-systemctl-parse-argv: refuse commandlines above 1k entries
Zbigniew Jędrzejewski-Szmek [Sun, 8 May 2022 07:41:32 +0000 (09:41 +0200)] 
fuzz-systemctl-parse-argv: refuse commandlines above 1k entries

oss-fuzz reports timeouts which are created by appending to a very long strv.
The code is indeed not very efficient, but it's designed for normal
command-line use, where we don't expect more than a dozen of entries. The fact
that it is slow with ~100k entries is not particularly interesting.

In the future we could rework the code to have better algorithmic complexity.
But let's at least stop oss-fuzz from wasting more time on such examples.

(My first approach was to set max_len in .options, but apparently this doesn't
work for hongfuzz and and AFL.)

oss-fuzz-34527: https://oss-fuzz.com/issue/5722283944574976

3 years agocore/unit: fix use-after-free
Yu Watanabe [Sun, 8 May 2022 15:56:05 +0000 (00:56 +0900)] 
core/unit: fix use-after-free

Fixes #23312.

3 years agoshared/bootspec: add missing terminator to table 23311/head
Zbigniew Jędrzejewski-Szmek [Sat, 7 May 2022 20:36:06 +0000 (22:36 +0200)] 
shared/bootspec: add missing terminator to table

3 years agofuzz-bootspec: also add loader autoentries
Zbigniew Jędrzejewski-Szmek [Sat, 7 May 2022 09:08:04 +0000 (11:08 +0200)] 
fuzz-bootspec: also add loader autoentries

3 years agofuzz-bootspec: one more test case that was fixed in strv code
Zbigniew Jędrzejewski-Szmek [Fri, 6 May 2022 16:31:09 +0000 (18:31 +0200)] 
fuzz-bootspec: one more test case that was fixed in strv code

3 years agoshared/bootspec: avoid crashing on config without a value
Zbigniew Jędrzejewski-Szmek [Fri, 6 May 2022 15:36:47 +0000 (17:36 +0200)] 
shared/bootspec: avoid crashing on config without a value

3 years agoAdd fuzzer for the bootspec parser
Zbigniew Jędrzejewski-Szmek [Thu, 5 May 2022 17:04:01 +0000 (19:04 +0200)] 
Add fuzzer for the bootspec parser

3 years agoshared/bootspec: also export boot_config_load_type1()
Zbigniew Jędrzejewski-Szmek [Fri, 6 May 2022 12:44:05 +0000 (14:44 +0200)] 
shared/bootspec: also export boot_config_load_type1()

The reallocation of memory and counter incrementation is moved from
the only caller to the function. This way the callers can remain oblivious
of the BootConfig internals.

3 years agoshared/bootspec: expose more parts of the config parsing
Zbigniew Jędrzejewski-Szmek [Thu, 5 May 2022 20:44:35 +0000 (22:44 +0200)] 
shared/bootspec: expose more parts of the config parsing

3 years agoMove printing of boot entries from bootctl.c to shared/
Zbigniew Jędrzejewski-Szmek [Thu, 5 May 2022 14:22:45 +0000 (16:22 +0200)] 
Move printing of boot entries from bootctl.c to shared/

I want to use this for fuzzing, but also later to return jsonified
list of entries from logind.

3 years agoshared/bootspec: add one more assert
Zbigniew Jędrzejewski-Szmek [Fri, 6 May 2022 12:38:16 +0000 (14:38 +0200)] 
shared/bootspec: add one more assert

All callers assume that boot_entry_title() always returns something.
It will, as long as it's not called on an uninitialized entry.

3 years agomeson: sort list of fuzzers
Zbigniew Jędrzejewski-Szmek [Thu, 5 May 2022 16:51:12 +0000 (18:51 +0200)] 
meson: sort list of fuzzers

3 years agodocs/ARCHITECTURE: describe fuzzer locations and use
Zbigniew Jędrzejewski-Szmek [Thu, 5 May 2022 16:35:10 +0000 (18:35 +0200)] 
docs/ARCHITECTURE: describe fuzzer locations and use

3 years agodissect: drop unnecessary {}
Zbigniew Jędrzejewski-Szmek [Sat, 7 May 2022 20:36:23 +0000 (22:36 +0200)] 
dissect: drop unnecessary {}

3 years agobash-completion: resolvectl: add missing options and verb
Yu Watanabe [Sun, 8 May 2022 04:34:11 +0000 (13:34 +0900)] 
bash-completion: resolvectl: add missing options and verb

3 years agocore/device: Add logging to device_is_ready() 23300/head
Daan De Meyer [Sat, 7 May 2022 15:52:44 +0000 (17:52 +0200)] 
core/device: Add logging to device_is_ready()

3 years agocore/device: Improve device_dispatch_io() logging messages
Daan De Meyer [Sat, 7 May 2022 14:20:20 +0000 (16:20 +0200)] 
core/device: Improve device_dispatch_io() logging messages