]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoresolved: use strv_extend_with_size() to avoid slow parsing of /etc/hosts 23453/head
Zbigniew Jędrzejewski-Szmek [Thu, 19 May 2022 08:38:27 +0000 (10:38 +0200)] 
resolved: use strv_extend_with_size() to avoid slow parsing of /etc/hosts

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43942 is a simple case
where a repeated entry generates a timeout. I didn't import that case, but
generated a simpler one by hand.

$ time build/fuzz-etc-hosts test/fuzz/fuzz-etc-hosts/timeout-many-entries
test/fuzz/fuzz-etc-hosts/timeout-many-entries... ok
build/fuzz-etc-hosts test/fuzz/fuzz-etc-hosts/timeout-many-entries  3.17s (old)
  ↓
build/fuzz-etc-hosts test/fuzz/fuzz-etc-hosts/timeout-many-entries  0.11s (new)

I considered simply disallowing too many aliases. E.g. microsoft appearently
sometimes ignores entries after the ninth [1], and other systems set stringent
limits [2,3], but the recommended way to get around that is to simply use more
lines (as is done in the sample), so this wouldn't change anything.

Even if we cannot put all those names in a reply packet, the resolution from
the alias to the address should work. I think cases where people define lots
and lots of aliases through some programmatic interface is realistic, for
example for a blocklist, and such a file shouldn't bring resolved down to its
knees.

[1] https://superuser.com/questions/932112/is-there-a-maximum-number-of-hostname-aliases-per-line-in-a-windows-hosts-file
[2] https://library.netapp.com/ecmdocs/ECMP1516135/html/GUID-C6F3B6D1-232D-44BB-A76C-3304C19607A3.html
[3] https://www.ibm.com/docs/en/zos/2.1.0?topic=optional-creating-etchosts

3 years agobasic/strv: add optimizable version of strv_push/consume/extend
Zbigniew Jędrzejewski-Szmek [Thu, 19 May 2022 07:50:48 +0000 (09:50 +0200)] 
basic/strv: add optimizable version of strv_push/consume/extend

This will be helpful in cases where we are repeatedly adding entries
to a long strv and want to skip the iteration over old entries leading
to quadratic behaviour.

Note that we don't want to calculate the length if not necessary, so
the calculation is delayed until after we've checked that value is not
NULL.

3 years agoMerge pull request #23412 from yuwata/network-bond-param
Luca Boccassi [Tue, 17 May 2022 19:11:55 +0000 (20:11 +0100)] 
Merge pull request #23412 from yuwata/network-bond-param

networkctl: bond param

3 years agoUpdate TODO
Luca Boccassi [Tue, 17 May 2022 16:47:38 +0000 (17:47 +0100)] 
Update TODO

3 years agoMerge pull request #23114 from yuwata/resolve-dnssec
Zbigniew Jędrzejewski-Szmek [Tue, 17 May 2022 14:53:09 +0000 (16:53 +0200)] 
Merge pull request #23114 from yuwata/resolve-dnssec

resolve: always request additional record to verify negative answer

3 years agoAdd a "test" that prints the SBAT table
Zbigniew Jędrzejewski-Szmek [Thu, 12 May 2022 17:06:29 +0000 (19:06 +0200)] 
Add a "test" that prints the SBAT table

The SBAT section was included in a special section in the EFI code, but
the contents weren't directly visible in any way. Let's add a "test" that
prints them for visual inspection.

If there's some external linter for this format, we could hook it up in the
future.

3 years agotest-boot-timestamp: use ERRNO_IS_PRIVILEGE() to also mask -EPERM
Yu Watanabe [Tue, 17 May 2022 09:13:13 +0000 (18:13 +0900)] 
test-boot-timestamp: use ERRNO_IS_PRIVILEGE() to also mask -EPERM

Fixes #23395.

3 years agotest-network: add test for showing Bond parameters 23412/head
Yu Watanabe [Tue, 17 May 2022 13:35:03 +0000 (22:35 +0900)] 
test-network: add test for showing Bond parameters

3 years agonetworkctl: fix units for bond parameters
Yu Watanabe [Tue, 17 May 2022 13:20:32 +0000 (22:20 +0900)] 
networkctl: fix units for bond parameters

Fixes RHBZ#2086166 (https://bugzilla.redhat.com/show_bug.cgi?id=2086166).

3 years agoMerge pull request #23409 from keszybz/network-online-docs
Luca Boccassi [Tue, 17 May 2022 12:42:51 +0000 (13:42 +0100)] 
Merge pull request #23409 from keszybz/network-online-docs

Network online docs

3 years agoMerge pull request #23407 from keszybz/bpf-cleanup-warning
Yu Watanabe [Tue, 17 May 2022 11:31:10 +0000 (20:31 +0900)] 
Merge pull request #23407 from keszybz/bpf-cleanup-warning

Clean up bpf cleanup warning

3 years agodocs: say how to delay network-online.target 23409/head
Zbigniew Jędrzejewski-Szmek [Tue, 17 May 2022 10:25:52 +0000 (12:25 +0200)] 
docs: say how to delay network-online.target

Could be related to https://access.redhat.com/solutions/4879291.
Unfortunately I can't access this page, but the title seems
relevant.

3 years agodocs: copy the page about network-online.target from the wiki
Zbigniew Jędrzejewski-Szmek [Tue, 17 May 2022 10:01:23 +0000 (12:01 +0200)] 
docs: copy the page about network-online.target from the wiki

From https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/.

I changed the order in the page, but didn't change the text too much. Now the
discussion of the different targets is at the top, and they are ordered like
during boot (network-pre.target first, then network.target, and
network-online.target last). The parts about LSB and $network are pushed down a
bit. I think it is still useful to have them, but not as the main entry point
into the discussion. I tried to clean up the grammar and wording a bit.

One meanigful change is that we now don't say that network-online.target means
interfaces are up and IP addresses have been assigned. In other places we were
saying that the actual implementation is provided by
NetworkManager-wait-online.service, so the actual meaning is not under our
control. The text is changed to say "usually".

The last paragraph is new, I think it's good to say that
"dnf-makecache.service" is fine to use "network-online.target".

3 years agomanager: skip BPF cleanup if we never initialized 23407/head
Zbigniew Jędrzejewski-Szmek [Tue, 17 May 2022 08:13:49 +0000 (10:13 +0200)] 
manager: skip BPF cleanup if we never initialized

This fixes a spurious warning from the manager running in user mode:

systemd[1668]: Reached target sockets.target.
systemd[1669]: Failed to create BPF map: Operation not permitted
systemd[1669]: Finished systemd-tmpfiles-setup.service.
systemd[1669]: Listening on dbus.socket.
systemd[1669]: Reached target sockets.target.
systemd[1669]: Reached target basic.target.
systemd[1]: Started user@6.service.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2084955.

3 years agotest-execute: skip one more test when PID1 is not systemd
Yu Watanabe [Mon, 16 May 2022 22:06:39 +0000 (07:06 +0900)] 
test-execute: skip one more test when PID1 is not systemd

Fixes #23332.

3 years agocore/bpf: lsm_bpf_supported() returns a boolean
Zbigniew Jędrzejewski-Szmek [Tue, 17 May 2022 08:11:05 +0000 (10:11 +0200)] 
core/bpf: lsm_bpf_supported() returns a boolean

The code was corret, but confusing, because it was treating the int
as a boolean.

3 years agoMerge pull request #23403 from keszybz/docs-update
Yu Watanabe [Mon, 16 May 2022 21:02:08 +0000 (06:02 +0900)] 
Merge pull request #23403 from keszybz/docs-update

Say that we support recent version of major distros and other doc updates

3 years agorpm: remove check if systemd is running in a few cases
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2022 18:06:59 +0000 (20:06 +0200)] 
rpm: remove check if systemd is running in a few cases

rpms can be installed in two different modes: into a chroot, where the system
is not running, and onto a live system. In the first mode, where should create
all changes that are "permanent", and in the second mode, all changes which are
"permanent" but also those which only affect the running system. Thus, changes
like new modprobe rules, tmpfiles rules, binfmt rules, udev rules, etc., are
guarded by 'test -d "/run/systemd/system"' which is the official way to check
if systemd is running, so that they are *not* executed when installed into a
chroot. But the same logic does not apply to sysusers, hwdb, and the journal
catalog: all those files can and should result in changes being performed
immediately to the system. This makes the creation of immutable images possible
(because there are no permanent changes to executed after a reboot), and allows
other packages to depend on the the effect of those changes.

Thus, the guard to check if we're not in a chroot is dropped from triggers for
sysusers, hwdb, and the journal catalog. This means that those triggers will
execute, and no subsequent work is needed. systemd-sysusers.service,
systemd-journal-catalog-update.service, and systemd-hwdb-update.service.in all
have ConditionNeedsUpdate= so they they generally won't be invoked after a
reboot. (systemd.rpm does not touch /usr to trigger the condition, because the
%transfiletriggers make that unnecessary.)

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=2085481

3 years agohwdb: Add Google Hangouts Meet speakermic
Pablo Ceballos [Fri, 13 May 2022 23:33:07 +0000 (23:33 +0000)] 
hwdb: Add Google Hangouts Meet speakermic

This device implements the phone mute HID usage as a toggle switch,
where 1 indicates muted, and 0 indicates unmuted. However, for a key
event 1 indicates that the key has been pressed and 0 indicates it has
been released. This mismatch causes issues, so prevent key events from
being generated for this HID usage.

3 years agoREADME: say that recent releases are supported 23403/head
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2022 17:49:20 +0000 (19:49 +0200)] 
README: say that recent releases are supported

Prompted by the discussion in
https://github.com/systemd/systemd/pull/23391.

3 years agoREADME: recommend --no-rebuild for sudo meson install
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2022 17:23:37 +0000 (19:23 +0200)] 
README: recommend --no-rebuild for sudo meson install

sudo and rebuilding don't mix well.
C.f. fe2b7631ad20b0e518b9f566608ff5f9b84d4d8b.

3 years agoREADME: add missing colons and wrap to ~80 columns
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2022 17:22:11 +0000 (19:22 +0200)] 
README: add missing colons and wrap to ~80 columns

Some paragraphs were narrow for no good reason. Let's make things
a bit more uniform.

3 years agonetworkd: reword debug messages
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2022 11:14:37 +0000 (13:14 +0200)] 
networkd: reword debug messages

"left from <something>" is not correct. "left <something>" would be the
usual form, but "left master interface" is not clear at all. So reword
those messages totally.

Follow-up for 3881fd406b13746336c6c654fd2f68261161fd8a.

3 years agomeson: add 'pam' install_tag to pam modules
Mike Gilbert [Sun, 15 May 2022 21:43:48 +0000 (17:43 -0400)] 
meson: add 'pam' install_tag to pam modules

3 years agohwdb: fix accelerometer mount matrix for Aquarius NS483
Nikolai Kostrigin [Fri, 13 May 2022 14:13:00 +0000 (17:13 +0300)] 
hwdb: fix accelerometer mount matrix for Aquarius NS483

Signed-off-by: Nikolai Kostrigin <nickel@altlinux.org>
3 years agoMerge pull request #23383 from yuwata/meson-suppress-warning
Luca Boccassi [Mon, 16 May 2022 16:57:13 +0000 (17:57 +0100)] 
Merge pull request #23383 from yuwata/meson-suppress-warning

meson: suppress warning

3 years agoman: fix typo
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2022 09:49:52 +0000 (11:49 +0200)] 
man: fix typo

3 years agoMerge pull request #23377 from nabijaczleweli/shopt
Yu Watanabe [Mon, 16 May 2022 09:17:14 +0000 (18:17 +0900)] 
Merge pull request #23377 from nabijaczleweli/shopt

Fix shopt in 90-loaderentry, don't not lint kernel-install, respect `$TMPDIR`

3 years agofuzz: drop too large input
Yu Watanabe [Sun, 15 May 2022 19:44:27 +0000 (04:44 +0900)] 
fuzz: drop too large input

The original issue oss-fuzz#10734 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10734)
is that just the file size is too large, and not a issue in functions
tested by the fuzzer. It is not necessary to include the testcase.

Follow-up for c4f883b78e5ffd326a82eaf18e01a9e4e243db58.

Fixes #23390.

3 years agocore: fix comment
Yu Watanabe [Sun, 15 May 2022 20:18:30 +0000 (05:18 +0900)] 
core: fix comment

3 years agomeson: always get libbpf include directory from pkgconfig 23383/head 23399/head
Yu Watanabe [Sun, 15 May 2022 18:38:45 +0000 (03:38 +0900)] 
meson: always get libbpf include directory from pkgconfig

3 years agomeson: use fs.name() and fs.parent()
Yu Watanabe [Sun, 15 May 2022 19:05:51 +0000 (04:05 +0900)] 
meson: use fs.name() and fs.parent()

Follow-up for 1bd0cc452ce1cbfb330db6b0855e178b4814e7de.

3 years agomeson: always use ExternalProgram.path()
Yu Watanabe [Sun, 15 May 2022 17:43:59 +0000 (02:43 +0900)] 
meson: always use ExternalProgram.path()

Even if we use meson >= 0.55, using path() does not produce any error or
warning if the required version is below 0.55.

Let's convert path() with full_path() when we requires meson >= 0.55.

3 years agomeson: disable bpf if skip-deps is enabled
Yu Watanabe [Sun, 15 May 2022 14:13:38 +0000 (23:13 +0900)] 
meson: disable bpf if skip-deps is enabled

3 years agomeson: use boolean for configuration_data.set10()
Yu Watanabe [Sun, 15 May 2022 09:10:25 +0000 (18:10 +0900)] 
meson: use boolean for configuration_data.set10()

Setting with number is deprecated:
```
meson.build:1008: DEPRECATION: configuration_data.set10 with number. the `set10` method should only be used with booleans
```

3 years agomeson: use better shellscript argument passing
Eli Schwartz [Sun, 15 May 2022 15:11:24 +0000 (11:11 -0400)] 
meson: use better shellscript argument passing

Passing potentially arbitrary data into a shellscript is potentially
very broken if you do not correctly quote it for use. This quoting must
be done as part of the interpretation of the data itself, e.g. python's
shlex.quote; simply formatting it into a string with double quotes is
NOT sufficient.

An alternative is to communicate the data reliably via argv to the shell
process, and allow the shell to internally handle it via `"$1"`, which
is quote-safe and will expand the data from argv as a single tokenized
word.

3 years agocatalog,po: update Polish translation
Piotr Drąg [Sun, 15 May 2022 11:21:13 +0000 (13:21 +0200)] 
catalog,po: update Polish translation

3 years agopo: update Japanese translation
Yu Watanabe [Sun, 15 May 2022 14:26:59 +0000 (23:26 +0900)] 
po: update Japanese translation

3 years agogit: ignore manifest
Yu Watanabe [Sun, 15 May 2022 14:08:53 +0000 (23:08 +0900)] 
git: ignore manifest

3 years agoMerge pull request #23378 from floppym/install-tags
Luca Boccassi [Sun, 15 May 2022 13:52:19 +0000 (14:52 +0100)] 
Merge pull request #23378 from floppym/install-tags

Add install tags for nss modules and pkgconfig files

3 years agoMerge pull request #23382 from yuwata/resolve-fix-dnssd-assertion
Luca Boccassi [Sun, 15 May 2022 13:49:24 +0000 (14:49 +0100)] 
Merge pull request #23382 from yuwata/resolve-fix-dnssd-assertion

resolve: fix dnssd assertion

3 years agoresolve: merge variable declaration with same type 23382/head
Yu Watanabe [Sun, 15 May 2022 01:26:24 +0000 (10:26 +0900)] 
resolve: merge variable declaration with same type

3 years agoresolve/dnssd: make dnssd_render_instance_name() take Manager
Yu Watanabe [Sun, 15 May 2022 01:23:25 +0000 (10:23 +0900)] 
resolve/dnssd: make dnssd_render_instance_name() take Manager

As DnssdService object passed to dnssd_render_instance_name() may
not owned by Manager.

Fixes #23381.

3 years ago hwdb: Add accel orientation for the I15-TG
Martin [Sat, 14 May 2022 22:51:59 +0000 (00:51 +0200)] 
 hwdb: Add accel orientation for the I15-TG

Add accel orientation for the Cube iWork 10 I15-TG

3 years agonetwork: do not update interface group by default
Yu Watanabe [Thu, 12 May 2022 19:43:37 +0000 (04:43 +0900)] 
network: do not update interface group by default

This fixes a minor bug introduced by 10af8bb24b39a815079f6bf31b449c6e5aaa2adf.
Before the commit, the interface group was set only when Group= is explicitly
specified, otherwise the interface group was kept. However, after the commit,
we need to specify Group= with an empty string to keep the current interface
group.

3 years agohwdb: add touchpad parameters for Lenovo T15g Gen1 (#23373)
Nikolai Grigoriev [Sat, 14 May 2022 21:39:02 +0000 (17:39 -0400)] 
hwdb: add touchpad parameters for Lenovo T15g Gen1 (#23373)

3 years agomeson: add 'devel' install_tag to libsystemd.pc and libudev.pc 23378/head
Mike Gilbert [Sat, 14 May 2022 15:23:02 +0000 (11:23 -0400)] 
meson: add 'devel' install_tag to libsystemd.pc and libudev.pc

3 years agomeson: add 'nss' install_tag to nss modules
Mike Gilbert [Sat, 14 May 2022 15:21:20 +0000 (11:21 -0400)] 
meson: add 'nss' install_tag to nss modules

3 years agoDon't not lint kernel-install 23377/head
наб [Sat, 14 May 2022 13:12:14 +0000 (15:12 +0200)] 
Don't not lint kernel-install

3 years agokernel-install: respect $TMPDIR
наб [Sat, 14 May 2022 13:10:30 +0000 (15:10 +0200)] 
kernel-install: respect $TMPDIR

3 years agokernel-install: 90-loaderentry: remove shopt
наб [Sat, 14 May 2022 13:07:04 +0000 (15:07 +0200)] 
kernel-install: 90-loaderentry: remove shopt

Fixes: #23374
Fixes: 367165a4069ac0c04882a05a8a80f6afb1e42760
3 years agoresolve: fix memleak
Yu Watanabe [Sat, 14 May 2022 06:09:11 +0000 (15:09 +0900)] 
resolve: fix memleak

Fixes a bug introduced by 71aee23dba7faeef68e7232f444626267a6c90d7.

Fixes CID#1488763.

3 years agotree-wide: replace AF_LOCAL with AF_UNIX
Yu Watanabe [Sat, 14 May 2022 06:27:17 +0000 (15:27 +0900)] 
tree-wide: replace AF_LOCAL with AF_UNIX

3 years agoMerge pull request #23370 from bluca/hwdb v251-rc3
Yu Watanabe [Fri, 13 May 2022 20:00:18 +0000 (05:00 +0900)] 
Merge pull request #23370 from bluca/hwdb

Update hwdb and contrib list for rc3

3 years agoMerge pull request #23369 from yuwata/error-handling-fixlets
Yu Watanabe [Fri, 13 May 2022 19:59:56 +0000 (04:59 +0900)] 
Merge pull request #23369 from yuwata/error-handling-fixlets

Several fixlets

3 years agotree-wide: fix typo
Yu Watanabe [Fri, 13 May 2022 19:58:47 +0000 (04:58 +0900)] 
tree-wide: fix typo

3 years agohwdb: run 'update-hwdb' for v251-rc3 23370/head
Luca Boccassi [Fri, 13 May 2022 16:17:33 +0000 (17:17 +0100)] 
hwdb: run 'update-hwdb' for v251-rc3

3 years agoNEWS: update contributors list
Luca Boccassi [Fri, 13 May 2022 16:13:39 +0000 (17:13 +0100)] 
NEWS: update contributors list

3 years agoupdate TODO
Lennart Poettering [Fri, 13 May 2022 14:20:18 +0000 (16:20 +0200)] 
update TODO

3 years agouserdb: fix error handling 23369/head
Yu Watanabe [Fri, 13 May 2022 12:49:53 +0000 (21:49 +0900)] 
userdb: fix error handling

3 years agofileio: fix error propagation
Lennart Poettering [Tue, 10 May 2022 14:23:05 +0000 (16:23 +0200)] 
fileio: fix error propagation

3 years agofileio: propagate original error if we notice AF_UNIX connect() is not going to work
Lennart Poettering [Tue, 10 May 2022 14:22:16 +0000 (16:22 +0200)] 
fileio: propagate original error if we notice AF_UNIX connect() is not going to work

let's not make up new errors in these checks that validate if connect()
work at all. After all, we don't really know if the ENXIO we saw earlier
actually is really caused by the inode being an AF_UNIX socket, we just
have the suspicion...

3 years agosocket-util: change sockaddr_un_set_path() to return recognizable error on 108ch...
Lennart Poettering [Tue, 10 May 2022 14:15:26 +0000 (16:15 +0200)] 
socket-util: change sockaddr_un_set_path() to return recognizable error on 108ch limit

This way we can implement nice fallbacks later on.

While we are at it, provide a test for this (one that is a bit over the
top, but then again, we can never have enough tests).

3 years agoMerge pull request #23337 from yuwata/sd-device-new-from-subsystem-sysname
Luca Boccassi [Thu, 12 May 2022 23:10:24 +0000 (00:10 +0100)] 
Merge pull request #23337 from yuwata/sd-device-new-from-subsystem-sysname

sd-device: always translate sysname to sysfs filename

3 years agoMerge pull request #23365 from yuwata/ci-fedora-36
Yu Watanabe [Thu, 12 May 2022 20:35:41 +0000 (05:35 +0900)] 
Merge pull request #23365 from yuwata/ci-fedora-36

CI: use Fedora 36

3 years agoMerge pull request #23218 from yuwata/core-device
Yu Watanabe [Thu, 12 May 2022 20:35:12 +0000 (05:35 +0900)] 
Merge pull request #23218 from yuwata/core-device

pid1: several fixlets for device handling

3 years agomkosi: drop libiptc from build for Fedora 23365/head
Yu Watanabe [Thu, 12 May 2022 19:19:29 +0000 (04:19 +0900)] 
mkosi: drop libiptc from build for Fedora

It is mostly deprecated on Fedora.

3 years agomkosi: test-acl-util requires getfacl
Yu Watanabe [Thu, 12 May 2022 18:09:42 +0000 (03:09 +0900)] 
mkosi: test-acl-util requires getfacl

3 years agocore/device: ignore DEVICE_FOUND_UDEV bit on switching root 23218/head
Yu Watanabe [Fri, 29 Apr 2022 11:29:11 +0000 (20:29 +0900)] 
core/device: ignore DEVICE_FOUND_UDEV bit on switching root

The issue #12953 is caused by the following:
On switching root,
- deserialized_found == DEVICE_FOUND_UDEV | DEVICE_FOUND_MOUNT,
- deserialized_state == DEVICE_PLUGGED,
- enumerated_found == DEVICE_FOUND_MOUNT,
On switching root, most devices are not found by the enumeration process.
Hence, the device state is set to plugged by device_coldplug(), and then
changed to the dead state in device_catchup(). So the corresponding
mount point is unmounted. Later when the device is processed by udevd, it
will be changed to plugged state again.

The issue #23208 is caused by the fact that generated udev database in
initramfs and the main system are often different.

So, the two issues have the same root; we should not honor
DEVICE_FOUND_UDEV bit in the deserialized_found on switching root.

This partially reverts c6e892bc0eebe1d42c282bd2d8bae149fbeba85f.

Fixes #12953 and #23208.
Replaces #23215.

Co-authored-by: Martin Wilck <mwilck@suse.com>
3 years agocore/device: drop unnecessary condition
Yu Watanabe [Sun, 1 May 2022 12:42:43 +0000 (21:42 +0900)] 
core/device: drop unnecessary condition

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 agoCI: use Fedora 36
Yu Watanabe [Thu, 12 May 2022 17:46:13 +0000 (02:46 +0900)] 
CI: use Fedora 36

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).