]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
9 months agoanalyze: teach "exit-status" verb json output too 30060/head
Lennart Poettering [Mon, 20 Nov 2023 13:52:31 +0000 (14:52 +0100)] 
analyze: teach "exit-status" verb json output too

9 months agoanalyze: teach "capability" verb JSON output too
Lennart Poettering [Mon, 20 Nov 2023 13:50:56 +0000 (14:50 +0100)] 
analyze: teach "capability" verb JSON output too

9 months agoanalyze: add "architectures" verb that lists all known architectures
Lennart Poettering [Thu, 16 Nov 2023 15:08:15 +0000 (16:08 +0100)] 
analyze: add "architectures" verb that lists all known architectures

9 months agosystemctl-whoami: use pidfd to refer to processes
Mike Yuan [Sat, 25 Nov 2023 14:10:16 +0000 (22:10 +0800)] 
systemctl-whoami: use pidfd to refer to processes

While at it, rephrase the output a bit. Before this commit, if
the pid doesn't exist, we output something hard to interpret -
"Failed to get unit for ourselves".

9 months agoMerge pull request #30101 from poettering/underline-rework
Lennart Poettering [Wed, 6 Dec 2023 21:13:12 +0000 (22:13 +0100)] 
Merge pull request #30101 from poettering/underline-rework

systemctl: "list-units" table tweaks

9 months agorecurse-dir: add new readdir_all_at() helper
Lennart Poettering [Wed, 22 Nov 2023 09:55:20 +0000 (10:55 +0100)] 
recurse-dir: add new readdir_all_at() helper

This new helper combines open() with readdir_all() to simplify a few
callers.

9 months agoMerge pull request #30295 from yuwata/hostnamectl-machine-id
Luca Boccassi [Wed, 6 Dec 2023 21:12:36 +0000 (21:12 +0000)] 
Merge pull request #30295 from yuwata/hostnamectl-machine-id

hostnamectl: read machine ID and boot ID through DBus

9 months agoMerge pull request #30183 from poettering/nlcr
Lennart Poettering [Wed, 6 Dec 2023 21:12:17 +0000 (22:12 +0100)] 
Merge pull request #30183 from poettering/nlcr

NL → CRNL conversion fixes when logging at the same time as ptyfwd runs

9 months agoshow-status: suffix output ith CRNL rather than just NL
Lennart Poettering [Fri, 24 Nov 2023 15:41:47 +0000 (16:41 +0100)] 
show-status: suffix output ith CRNL rather than just NL

This is similar to #30183 but focusses on the status output rather than
the log output.

Since the status output always goes to a TTY we don't have to
conditionalize things on isatty().

Fixes: #30184
9 months agouser-util: add new helper fully_set_uid_gid()
Lennart Poettering [Wed, 29 Nov 2023 16:45:06 +0000 (17:45 +0100)] 
user-util: add new helper fully_set_uid_gid()

Usually when we do setresuid() we also do setesgid() and setgroups().
Let's add a common helper that does all three, and use it everywhere.

9 months agomime: register confext/sysext images in shared-mime-info
Lennart Poettering [Mon, 20 Nov 2023 10:51:47 +0000 (11:51 +0100)] 
mime: register confext/sysext images in shared-mime-info

This make them recognized by file managers and stuff. Maybe one day we
should properly register mime types in the "vnd." namespace with IANA,
but I am too lazy to deal with the bureaucracy for that, hence let's
stick with the x. namespace for now.

This defines confext/sysext DDIs as subtype of:

https://www.iana.org/assignments/media-types/application/vnd.efi.img

Which is what everyone appears to use for raw disk images, in particular
if they contain a GPT partition table.

9 months agouserdbctl: enable ssh-authorized-keys logic by default
Lennart Poettering [Thu, 16 Nov 2023 17:47:52 +0000 (18:47 +0100)] 
userdbctl: enable ssh-authorized-keys logic by default

sshd now supports config file drop-ins, hence let's install one to hook
up "userdb ssh-authorized-keys", so that things just work.

We put the drop-in relatively early, so that other drop-ins generally
will override this.

Ideally sshd would support such drop-ins in /usr/ rather than /etc/, but
let's take what we can get. It's not that sshd's upstream was
particularly open to weird ideas from Linux people.

9 months agopid1: add ProtectSystem= as system-wide configuration, and default it to true in...
Lennart Poettering [Wed, 29 Nov 2023 17:52:28 +0000 (18:52 +0100)] 
pid1: add ProtectSystem= as system-wide configuration, and default it to true in the initrd

This adds a new ProtectSystem= setting that mirrors the option of the
same of services, but in a more restrictive way. If enabled will remount
/usr/ to read-only, very early at boot. Takes a special value "auto"
(which is the default) which is equivalent to true in the initrd, and
false otherwise.

Unlike the per-service option we don't support full/strict modes, but
the door is open to eventually support that too if it makes sense. It's
not entirely trivial though as we have very little mounted this early,
and hence the mechanism might not apply 1:1. Hence in this PR is a
conservative first step.

My primary goal with this is to lock down initrds a bit, since they
conceptually are mostly immutable, but they are unpacked into a mutable
tmpfs. let's tighten the screws a bit on that, and at least make /usr/
immutable.

This is particularly nice on USIs (i.e. Unified System Images, that pack
a whole OS into a UKI without transitioning out of it), such as
diskomator.

9 months agoMerge pull request #30241 from poettering/journalctl-short-file-switch
Daan De Meyer [Wed, 6 Dec 2023 21:07:41 +0000 (22:07 +0100)] 
Merge pull request #30241 from poettering/journalctl-short-file-switch

journalctl: add short option "-i" for "--file="

9 months agocoredump: keep core files for two weeks
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2023 14:56:54 +0000 (15:56 +0100)] 
coredump: keep core files for two weeks

We have two mechanisms that remove old coredumps: systemd-coredump has
parameters based on disk use / remaining disk free, and systemd-tmpfiles does
cleanup based on time. The first mechanism should prevent us from using too much
disk space in case something is crashing continuously or there are very large
core files.

The limit of 3 days makes it likely that the core file will be gone by the time
the admin looks at the issue. E.g. if something crashes on Friday, the coredump
would likely be gone before people are back on Monday to look at it.

9 months agocore: add specifier expansion to AllowedCPUs= and friends
Alan Liang [Sun, 3 Dec 2023 05:49:06 +0000 (13:49 +0800)] 
core: add specifier expansion to AllowedCPUs= and friends

9 months agonetwork/networkd-address: don't set up firewall rules here
Topi Miettinen [Mon, 4 Dec 2023 19:49:12 +0000 (21:49 +0200)] 
network/networkd-address: don't set up firewall rules here

Don't set up firewall rules when we're just initializing the firewall context
for NFT sets.

Fixes: #30257
9 months agoshared/killall: correctly warn about rootfs daemon's root
Mike Yuan [Sat, 2 Dec 2023 07:23:51 +0000 (15:23 +0800)] 
shared/killall: correctly warn about rootfs daemon's root

Follow-up for 9e615117dab5ede72eec22bf6369e0138f9dace5

We'll typically send signals to all remaining processes in the following
cases:

1. pid1 (in initrd) when transitioning from initrd to sysroot: SIGTERM
2. pid1 (in sysroot) before transitioning back to initrd (exitrd): SIGTERM + SIGKILL
3. systemd-shutdown (in exitrd): SIGTERM + SIGKILL

'warn_rootfs' is set to true only when we're not in initrd and we're
sending SIGKILL, which means the second case. So, we want to emit the
warning when the root of the storage daemon IS the same as that of pid1,
rather than the other way around.

The condition is spuriously reversed in the offending commit.

9 months agologinctl: show a nicer error message when no session/seat is available
Frantisek Sumsal [Wed, 6 Dec 2023 10:03:06 +0000 (11:03 +0100)] 
loginctl: show a nicer error message when no session/seat is available

When calling loginctl {seat,session}-status without arguments, show a nicer
error message in case there's no suitable session/seat attached to the calling
tty.

Before:
~# loginctl seat-status
Could not get properties: Unknown object '/org/freedesktop/login1/seat/auto'.
~# systemd-run -q -t loginctl seat-status
Could not get properties: Unknown object '/org/freedesktop/login1/seat/auto'.
~# systemd-run -q -t loginctl session-status
Could not get properties: Unknown object '/org/freedesktop/login1/session/auto'.

After:
~# build/loginctl seat-status
Failed to get path for seat 'auto': Session '1' has no seat.
~# systemd-run -q -t build/loginctl seat-status
Failed to get path for seat 'auto': Caller does not belong to any known session and doesn't own any suitable session.
~# systemd-run -q -t build/loginctl session-status
Failed to get path for session 'auto': Caller does not belong to any known session and doesn't own any suitable session.

Resolves: #25199

9 months agoMerge pull request #30340 from yuwata/repart-error-handling-ftruncate
Daan De Meyer [Wed, 6 Dec 2023 21:02:01 +0000 (22:02 +0100)] 
Merge pull request #30340 from yuwata/repart-error-handling-ftruncate

repart: fix coding style of error handling

9 months agoMerge pull request #30343 from keszybz/ukify-genkey
Daan De Meyer [Wed, 6 Dec 2023 21:01:41 +0000 (22:01 +0100)] 
Merge pull request #30343 from keszybz/ukify-genkey

Raise error if 'ukify genkey' is called with no output arguments

9 months agoMerge pull request #30332 from bluca/softreboot_pivot_in_place
Luca Boccassi [Wed, 6 Dec 2023 21:01:13 +0000 (21:01 +0000)] 
Merge pull request #30332 from bluca/softreboot_pivot_in_place

switch-root: also check that mount IDs are the same, not just inodes

9 months agoMerge pull request #30214 from bluca/wants_mounts_for
Luca Boccassi [Wed, 6 Dec 2023 21:00:37 +0000 (21:00 +0000)] 
Merge pull request #30214 from bluca/wants_mounts_for

Add WantsMountsFor= and use it in the cryptsetup generator

9 months agoNEWS: finalize for v255 v255
Luca Boccassi [Wed, 6 Dec 2023 20:32:40 +0000 (20:32 +0000)] 
NEWS: finalize for v255

9 months agoMerge pull request #30334 from DaanDeMeyer/repart-fixes
Luca Boccassi [Wed, 6 Dec 2023 20:29:04 +0000 (20:29 +0000)] 
Merge pull request #30334 from DaanDeMeyer/repart-fixes

repart: Add Minimize=best to --make-ddi= partition definitions

9 months agoREADME: mention Matrix channel
Lennart Poettering [Wed, 6 Dec 2023 18:20:35 +0000 (19:20 +0100)] 
README: mention Matrix channel

9 months agoMerge pull request #30341 from bluca/news
Luca Boccassi [Wed, 6 Dec 2023 16:57:29 +0000 (16:57 +0000)] 
Merge pull request #30341 from bluca/news

Update hwdb and NEWS

9 months agohostname: expose machine ID and boot ID through DBus 30295/head
Yu Watanabe [Sat, 2 Dec 2023 10:26:29 +0000 (19:26 +0900)] 
hostname: expose machine ID and boot ID through DBus

Fixes #30293.

9 months agohostnamectl: do not show local machine ID and boot ID when requested to show informat...
Yu Watanabe [Sat, 2 Dec 2023 10:14:35 +0000 (19:14 +0900)] 
hostnamectl: do not show local machine ID and boot ID when requested to show information about remote host

Prompted by #30293.

9 months agotest: Add test case for --make-ddi=sysext 30334/head
Daan De Meyer [Wed, 6 Dec 2023 11:18:32 +0000 (12:18 +0100)] 
test: Add test case for --make-ddi=sysext

Also make sure that the sysext is big enough to not fit in the
minimum partition size so we know Minimize= is being used.

9 months agorepart: Add Minimize=best to --make-ddi= partition definitions
Daan De Meyer [Tue, 5 Dec 2023 13:56:15 +0000 (14:56 +0100)] 
repart: Add Minimize=best to --make-ddi= partition definitions

Otherwise, repart won't calculate the minimal size of the partition
automatically and things will fail once the partitions exceed the
minimal partition size (10M).

9 months agoukify: raise error if genkey is called with no output arguments 30343/head
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 10:41:56 +0000 (11:41 +0100)] 
ukify: raise error if genkey is called with no output arguments

The idea is that genkey is called with either
--secureboot-private-key= + --secureboot-certificate=, and then it
writes those, or with --pcr-private-key + optionally --pcr-public-key
and then it writes those, or both. But when called with no arguments
whatsover, it did nothing.

There is no implicit value for any of those parameters as input (unlike in
mkosi), so we also don't want to have implicit values when used as output.
But we shouldn't return success if no work was done, this is quite confusing.

9 months agoukify: remove stray line
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 10:31:16 +0000 (11:31 +0100)] 
ukify: remove stray line

As requested in review.

9 months agoukify: add test for --secureboot-certificate-validity=
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 10:29:54 +0000 (11:29 +0100)] 
ukify: add test for --secureboot-certificate-validity=

Follow-up for bf35f9c83541785726dce41e54496a07f4841621.

9 months agohwdb: update 30341/head
Luca Boccassi [Wed, 6 Dec 2023 10:06:50 +0000 (10:06 +0000)] 
hwdb: update

ninja -C build update-hwdb

9 months agoNEWS: note that newly introduced tools are experimental
Luca Boccassi [Wed, 6 Dec 2023 10:00:25 +0000 (10:00 +0000)] 
NEWS: note that newly introduced tools are experimental

So that we can change interfaces for at least one release if needed

9 months agoNEWS: update contributors list
Luca Boccassi [Wed, 6 Dec 2023 09:57:38 +0000 (09:57 +0000)] 
NEWS: update contributors list

9 months agoukify: fix handling of --secureboot-certificate-validity= (#30315)
Roland Singer [Wed, 6 Dec 2023 09:49:47 +0000 (10:49 +0100)] 
ukify: fix handling of  --secureboot-certificate-validity= (#30315)

Before:
$ python src/ukify/ukify.py genkey --secureboot-private-key=sb2.key --secureboot-certificate=sb2.cert --secureboot-certificate-validity=111
Traceback (most recent call last):
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 1660, in <module>
    main()
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 1652, in main
    generate_keys(opts)
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 943, in generate_keys
    key_pem, cert_pem = generate_key_cert_pair(
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 891, in generate_key_cert_pair
    now + ONE_DAY * valid_days
          ~~~~~~~~^~~~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'datetime.timedelta'

Now:
$ python src/ukify/ukify.py genkey --secureboot-private-key=sb2.key --secureboot-certificate=sb2.cert --secureboot-certificate-validity=111
Writing SecureBoot private key to sb2.key
Writing SecureBoot certificate to sb2.cert

The new code is also clearer.

9 months agorepart: use correct errno
Mike Yuan [Tue, 5 Dec 2023 13:53:51 +0000 (21:53 +0800)] 
repart: use correct errno

9 months agorepart: fix coding style of error handling 30340/head
Yu Watanabe [Wed, 6 Dec 2023 02:34:11 +0000 (11:34 +0900)] 
repart: fix coding style of error handling

Follow-up for c4a87b76c3e5f74f62d4431b85e7c5f71add3916.

9 months agotest: load the io controller before checking if io.latency exists
Frantisek Sumsal [Tue, 5 Dec 2023 11:22:20 +0000 (12:22 +0100)] 
test: load the io controller before checking if io.latency exists

Otherwise the following test gets always skipped.

9 months agorepart: Fix sysext definitions for --make-ddi=
Daan De Meyer [Tue, 5 Dec 2023 10:21:15 +0000 (11:21 +0100)] 
repart: Fix sysext definitions for --make-ddi=

CopyFiles= does not support multiple directories separated by
whitespace. Instead the setting has to be specified multiple times.

9 months agoselinux: downgrade log about state to trace
Luca Boccassi [Tue, 5 Dec 2023 11:53:31 +0000 (11:53 +0000)] 
selinux: downgrade log about state to trace

It is printed on every invocation of sd-executor, which is noisy and not useful

Follow-up for: bb5232b6a3b8a

9 months agoswitch-root: also check that mount IDs are the same, not just inodes 30332/head
Luca Boccassi [Tue, 5 Dec 2023 15:43:12 +0000 (15:43 +0000)] 
switch-root: also check that mount IDs are the same, not just inodes

If /run/nextroot/ has been set up, use it, even if the inodes are
the same. It could be a verity device that is reused, but with
different sub-mounts or other differences. Or the same / tmpfs with
different /usr/ mounts. If it was explicitly set up we should use it.

Use the new helper to check that the mount IDs are also the same,
not just the inodes.

9 months agobasic: add fds_are_same_mount() helper
Luca Boccassi [Tue, 5 Dec 2023 15:32:30 +0000 (15:32 +0000)] 
basic: add fds_are_same_mount() helper

9 months agobasic: fix typo
Yu Watanabe [Tue, 5 Dec 2023 14:50:25 +0000 (23:50 +0900)] 
basic: fix typo

9 months agofix: The example2 in hwdb.xml is unreasonable
huyubiao [Tue, 5 Dec 2023 12:53:32 +0000 (20:53 +0800)] 
fix: The example2 in hwdb.xml is unreasonable

use evdev:atkbd:dmi:bvnAcer:bvr:bdXXXXX:bd08/05/2010:svnAcer:pnX123: instead of evdev:atkbd:dmi:bvnAcer:bdXXXXX:bd08/05/2010:svnAcer:pnX123

9 months agoMerge pull request #30313 from mrc0mmand/ubuntu-ci
Luca Boccassi [Mon, 4 Dec 2023 18:23:34 +0000 (18:23 +0000)] 
Merge pull request #30313 from mrc0mmand/ubuntu-ci

Reduce the number of deny-list files for Ubuntu CI

9 months agotools/meson-vcs-tag: the third argument is optional
Yu Watanabe [Mon, 4 Dec 2023 03:36:53 +0000 (12:36 +0900)] 
tools/meson-vcs-tag: the third argument is optional

Follow-up for 1a71ac07adafebe7e0074f92d049f72968ca2d47.

9 months agoMerge pull request #30314 from DaanDeMeyer/dmi
Luca Boccassi [Mon, 4 Dec 2023 10:29:06 +0000 (10:29 +0000)] 
Merge pull request #30314 from DaanDeMeyer/dmi

Document kernel configs required for reading credentials from SMBIOS

9 months agomkosi: Update comment why we can't use linux-kvm yet 30314/head
Daan De Meyer [Mon, 4 Dec 2023 10:16:52 +0000 (11:16 +0100)] 
mkosi: Update comment why we can't use linux-kvm yet

9 months agoDocument kernel configs required for reading credentials from SMBIOS
Daan De Meyer [Mon, 4 Dec 2023 10:13:59 +0000 (11:13 +0100)] 
Document kernel configs required for reading credentials from SMBIOS

9 months agotest: reenable TEST-30 on i*86 30313/head
Frantisek Sumsal [Mon, 4 Dec 2023 09:57:39 +0000 (10:57 +0100)] 
test: reenable TEST-30 on i*86

The original reason for deny-listing it was that it's flaky there. I'm
not sure if that's still the case, but the Ubuntu CI jobs for i*86 are
gone, so this file shouldn't be needed anymore anyway.

9 months agotest: skip TEST-36 on s390x and powerpc
Frantisek Sumsal [Mon, 4 Dec 2023 09:51:35 +0000 (10:51 +0100)] 
test: skip TEST-36 on s390x and powerpc

As QEMU there doesn't support NUMA nodes. Also, drop the now unneeded
deny-list file for Ubuntu CI.

9 months agotest: check if 'btrfs filesystem' supports 'mkswapfile'
Frantisek Sumsal [Mon, 4 Dec 2023 09:23:42 +0000 (10:23 +0100)] 
test: check if 'btrfs filesystem' supports 'mkswapfile'

Instead of deny-listing the test on Ubuntu CI, so it gets enabled
automagically once btrfs-progs is updated to a newer version there.

9 months agotest: reenable TEST-25-IMPORT in Ubuntu CI
Frantisek Sumsal [Mon, 4 Dec 2023 09:16:02 +0000 (10:16 +0100)] 
test: reenable TEST-25-IMPORT in Ubuntu CI

Let's see if #13973 is still an issue.

9 months agoexecutor: apply LogLevelMax earlier
Luca Boccassi [Sun, 3 Dec 2023 18:30:07 +0000 (18:30 +0000)] 
executor: apply LogLevelMax earlier

SELinux logs before we have a chance to apply it, move it up as it
breaks TEST-04-JOURNAL:

[  408.578624] testsuite-04.sh[11463]: ++ journalctl -b -q -u silent-success.service
[  408.578743] testsuite-04.sh[11098]: + [[ -z Dec 03 13:38:41 H systemd-executor[11459]: SELinux enabled state cached to: disabled ]]

Follow-up for: bb5232b6a3b8a

9 months agoMerge pull request #30305 from yuwata/seccomp-fix
Yu Watanabe [Mon, 4 Dec 2023 02:44:58 +0000 (11:44 +0900)] 
Merge pull request #30305 from yuwata/seccomp-fix

seccomp: override the default action only when the filter is allow-list

9 months agotests: fix section mapping in test_ukify.py
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2023 09:26:05 +0000 (10:26 +0100)] 
tests: fix section mapping in test_ukify.py

The regexp only worked if the sections were small enough for the size to
start with "0". I have an initrd that is 0x1078ec7e bytes, so the tests
would spuriously fail.

9 months agoMerge pull request #30297 from keszybz/fixups
Luca Boccassi [Sun, 3 Dec 2023 12:34:24 +0000 (12:34 +0000)] 
Merge pull request #30297 from keszybz/fixups

A few unrelated fixups for recent commits

9 months agoseccomp-util: also use ENOSYS for unknown syscalls in seccomp_load_syscall_filter_set() 30305/head
Yu Watanabe [Sun, 3 Dec 2023 09:01:20 +0000 (18:01 +0900)] 
seccomp-util: also use ENOSYS for unknown syscalls in seccomp_load_syscall_filter_set()

Follow-up for 2331c02d06cae97b87637a0fc6bb4961b509ccf2.

Note, currently, the function is always called with SCMP_ACT_ALLOW as
the default action, except for the test. So, this should not change
anything in the runtime code.

9 months agoseccomp-util: override default action only when the filter is allow-list
Yu Watanabe [Sun, 3 Dec 2023 08:37:02 +0000 (17:37 +0900)] 
seccomp-util: override default action only when the filter is allow-list

Follow-up for 2331c02d06cae97b87637a0fc6bb4961b509ccf2.

Fixes #30304.

9 months agostdio-bridge: return immediately if we can 30297/head
Zbigniew Jędrzejewski-Szmek [Wed, 29 Nov 2023 13:38:06 +0000 (14:38 +0100)] 
stdio-bridge: return immediately if we can

Follow-up for 0321248b79d14ceddd36140b327332f145ae68e7.

9 months agorun: fix bad escaping and memory ownership confusion
Zbigniew Jędrzejewski-Szmek [Wed, 29 Nov 2023 13:13:33 +0000 (14:13 +0100)] 
run: fix bad escaping and memory ownership confusion

arg_description was either set to arg_unit (i.e. a const char*), or to
char *description, the result of allocation in run(). But description
was decorated with _cleanup_, so it would be freed when going out of the
function. Nothing bad would happen, because the program would exit after
exiting from run(), but this is just all too messy.

Also, strv_join(" ") + shell_escape() is not a good way to escape command
lines. In particular, one the join has happened, we cannot distinguish
empty arguments, or arguments with whitespace, etc. We have a helper
function to do the escaping properly, so let's use that.

Fixup for 2c29813da3421b77eca5e5cdc3b9a863cad473b9.

9 months agorun: adjust indentation
Zbigniew Jędrzejewski-Szmek [Wed, 29 Nov 2023 13:01:13 +0000 (14:01 +0100)] 
run: adjust indentation

9 months agotest-macro: use capital test names for macro tests
Zbigniew Jędrzejewski-Szmek [Sun, 26 Nov 2023 14:54:11 +0000 (15:54 +0100)] 
test-macro: use capital test names for macro tests

It's just easier if the test is named as the thing being tested. Also, this way
inconsistent, because lower in the file uppercase test names are used.

9 months agoNEWS: finalize for v255-rc4 v255-rc4
Luca Boccassi [Sat, 2 Dec 2023 02:05:27 +0000 (02:05 +0000)] 
NEWS: finalize for v255-rc4

9 months agoMerge pull request #30291 from keszybz/seccomp-unknown-syscall
Luca Boccassi [Sat, 2 Dec 2023 02:04:24 +0000 (02:04 +0000)] 
Merge pull request #30291 from keszybz/seccomp-unknown-syscall

Backwardscompatibly handle syscalls unknown to us or libseccomp

9 months agocore: turn on higher optimization level in seccomp 30291/head
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2023 22:13:54 +0000 (23:13 +0100)] 
core: turn on higher optimization level in seccomp

This mirrors what d75615f398a0fbf986cf03924462863ca6ee2f9f did for nspawn.

It isn't really a fatal failure if we can't set that, so ignore it in libseccomp
cannot set the attribute.

 line  OP   JT   JF   K
=================================
 0000: 0x20 0x00 0x00 0x00000004   ld  $data[4]
 0001: 0x15 0x00 0xb7 0x40000003   jeq 1073741827 true:0002 false:0185
 0002: 0x20 0x00 0x00 0x00000000   ld  $data[0]
 0003: 0x15 0xb5 0x00 0x00000000   jeq 0    true:0185 false:0004
 0004: 0x15 0xb4 0x00 0x00000001   jeq 1    true:0185 false:0005
 0005: 0x15 0xb3 0x00 0x00000002   jeq 2    true:0185 false:0006
 0006: 0x15 0xb2 0x00 0x00000003   jeq 3    true:0185 false:0007
 0007: 0x15 0xb1 0x00 0x00000004   jeq 4    true:0185 false:0008
 0008: 0x15 0xb0 0x00 0x00000005   jeq 5    true:0185 false:0009
 0009: 0x15 0xaf 0x00 0x00000006   jeq 6    true:0185 false:0010
 ...
 0438: 0x15 0x03 0x00 0x000001be   jeq 446  true:0442 false:0439
 0439: 0x15 0x02 0x00 0x000001bf   jeq 447  true:0442 false:0440
 0440: 0x15 0x01 0x00 0x000001c0   jeq 448  true:0442 false:0441
 0441: 0x06 0x00 0x00 0x00050026   ret ERRNO(38)
 0442: 0x06 0x00 0x00 0x7fff0000   ret ALLOW

 line  OP   JT   JF   K
=================================
 0000: 0x20 0x00 0x00 0x00000004   ld  $data[4]
 0001: 0x15 0x00 0x27 0x40000003   jeq 1073741827 true:0002 false:0041
 0002: 0x20 0x00 0x00 0x00000000   ld  $data[0]
 0003: 0x25 0x01 0x00 0x000000b5   jgt 181  true:0005 false:0004
 0004: 0x05 0x00 0x00 0x00000143   jmp 0328
 0005: 0x25 0x00 0xa1 0x00000139   jgt 313  true:0006 false:0167
 0006: 0x25 0x00 0x51 0x00000179   jgt 377  true:0007 false:0088
 0007: 0x25 0x00 0x29 0x000001a0   jgt 416  true:0008 false:0049
 0008: 0x25 0x00 0x13 0x000001b0   jgt 432  true:0009 false:0028
 0009: 0x25 0x00 0x09 0x000001b8   jgt 440  true:0010 false:0019
 ...
 0551: 0x15 0x03 0x00 0x00000002   jeq 2    true:0555 false:0552
 0552: 0x15 0x02 0x01 0x00000001   jeq 1    true:0555 false:0554
 0553: 0x15 0x01 0x00 0x00000000   jeq 0    true:0555 false:0554
 0554: 0x06 0x00 0x00 0x00050026   ret ERRNO(38)
 0555: 0x06 0x00 0x00 0x7fff0000   ret ALLOW

The program is longer but hopefully faster because of the binary search.

9 months agoshared/seccomp-util: use the same error message for the same condition
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2023 18:04:27 +0000 (19:04 +0100)] 
shared/seccomp-util: use the same error message for the same condition

We were calling seccomp_syscall_resolve_name three times and using a
slightly different error message in each of the cases.

9 months agocore: when applying syscall filters, use ENOSYS for unknown calls
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2023 18:03:23 +0000 (19:03 +0100)] 
core: when applying syscall filters, use ENOSYS for unknown calls

glibc starting using fchmodat2 to implement fchmod with flags [1], but
current version of libseccomp does not support fchmodat2 [2]. This is
causing problems with programs sandboxed by systemd. libseccomp needs to know
a syscall to be able to set any kind of filter for it, so for syscalls unknown
by libseccomp we would always do the default action, i.e. either return the
errno set by SystemCallErrorNumber or send a fatal signal. For glibc to ignore
the unknown syscall and gracefully fall back to the older implementation,
we need to return ENOSYS. In particular, tar now fails with the default
SystemCallFilter="@system-service" sandbox [3].

This is of course a wider problem: any time the kernel gains new syscalls,
before libseccomp and systemd have caught up, we'd behave incorrectly. Let's
do the same as we already were doing in nspawn since
3573e032f26724949e86626eace058d006b8bf70, and do the "default action" only
for syscalls which are known by us and libseccomp, and return ENOSYS for
anything else. This means that users can start using a sandbox with the new
syscalls only after libseccomp and systemd have been updated, but before that
happens they behaviour that is backwards-compatible.

[1] https://github.com/bminor/glibc/commit/65341f7bbea824d2ff9d37db15d8be162df42bd3
[2] https://github.com/seccomp/libseccomp/issues/406
[2] https://github.com/systemd/systemd/issues/30250

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

In seccomp_restrict_sxid() there's a chunk conditionalized with
'#if defined(__SNR_fchmodat2)'. We need to kep that because seccomp_restrict_sxid()
seccomp_restrict_suid_sgid() uses SCMP_ACT_ALLOW as the default action.

9 months agocore/cgroup: for non-cached attrs, don't return ENODATA blindly
Mike Yuan [Fri, 1 Dec 2023 19:06:16 +0000 (03:06 +0800)] 
core/cgroup: for non-cached attrs, don't return ENODATA blindly

Follow-up for f17b07f4d72238da95312920dcc2ad076568cba3

Hope I won't break this thing again...

9 months agoMerge pull request #30294 from bluca/news
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2023 00:08:45 +0000 (01:08 +0100)] 
Merge pull request #30294 from bluca/news

hwdb and NEWS updates

9 months agosystemd-homed.service.in: add quotactl to SystemCallFilter
Neil Wilson [Fri, 1 Dec 2023 16:29:32 +0000 (16:29 +0000)] 
systemd-homed.service.in: add quotactl to SystemCallFilter

Standard directories make a call to the quotactl system call to enforce disk size limits.

Fixes #30287

9 months agohwdb: update 30294/head
Luca Boccassi [Fri, 1 Dec 2023 22:07:08 +0000 (22:07 +0000)] 
hwdb: update

9 months agoNEWS: update contributors list
Luca Boccassi [Fri, 1 Dec 2023 22:05:08 +0000 (22:05 +0000)] 
NEWS: update contributors list

9 months agoMerge pull request #30268 from yuwata/network-fix-too-many-waiting-replies
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2023 18:54:18 +0000 (19:54 +0100)] 
Merge pull request #30268 from yuwata/network-fix-too-many-waiting-replies

network: fix issue caused by too many waiting replies

9 months agocore: fix comment
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2023 14:53:06 +0000 (15:53 +0100)] 
core: fix comment

9 months agofix: prefix of dmesg pstore files
Дамјан Георгиевски [Fri, 1 Dec 2023 10:46:36 +0000 (11:46 +0100)] 
fix: prefix of dmesg pstore files

A change in the kernel[1] renamed the prefix of the pstore files from
`dmesg-efi-` to `dmesg-efi_pstore-`.

[1]
https://git.kernel.org/linus/893c5f1de620

9 months agohomework-quota.c: correct error message in home_update_quota_btrfs
Neil Wilson [Fri, 1 Dec 2023 16:32:18 +0000 (16:32 +0000)] 
homework-quota.c: correct error message in home_update_quota_btrfs

Fixes #30286

9 months agobuild(deps): bump meson from 1.2.3 to 1.3.0 in /.github/workflows
dependabot[bot] [Fri, 1 Dec 2023 10:01:04 +0000 (10:01 +0000)] 
build(deps): bump meson from 1.2.3 to 1.3.0 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.2.3 to 1.3.0.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.2.3...1.3.0)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Fri, 1 Dec 2023 09:04:01 +0000 (09:04 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/aa647ec4466543e8555c2c3b648124a9813cee44...91e2582e40236f831458392d905578d680baa138)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agobuild(deps): bump redhat-plumbers-in-action/devel-freezer
dependabot[bot] [Fri, 1 Dec 2023 09:03:54 +0000 (09:03 +0000)] 
build(deps): bump redhat-plumbers-in-action/devel-freezer

Bumps [redhat-plumbers-in-action/devel-freezer](https://github.com/redhat-plumbers-in-action/devel-freezer) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/redhat-plumbers-in-action/devel-freezer/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/devel-freezer/compare/13b6551f19ade74ca79be4cab06b815a4ffffa64...67aec4a153bd9fca5322e1c4dd4d7c419fb36362)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/devel-freezer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agobuild(deps): bump actions/github-script from 6.4.1 to 7.0.1
dependabot[bot] [Fri, 1 Dec 2023 09:03:48 +0000 (09:03 +0000)] 
build(deps): bump actions/github-script from 6.4.1 to 7.0.1

Bumps [actions/github-script](https://github.com/actions/github-script) from 6.4.1 to 7.0.1.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/d7906e4ad0b1822421a7e6a35d5ca353c962f410...60a0d83039c74a4aee543508d2ffcb1c3799cdea)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agobuild(deps): bump github/codeql-action from 2.21.9 to 2.22.8
dependabot[bot] [Fri, 1 Dec 2023 09:03:50 +0000 (09:03 +0000)] 
build(deps): bump github/codeql-action from 2.21.9 to 2.22.8

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.21.9 to 2.22.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/ddccb873888234080b77e9bc2d4764d5ccaaccf9...407ffafae6a767df3e0230c3df91b6443ae8df75)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agovconsole-setup: use a consistent log level when setfont fails with EX_OSERR
Franck Bui [Fri, 1 Dec 2023 07:44:53 +0000 (08:44 +0100)] 
vconsole-setup: use a consistent log level when setfont fails with EX_OSERR

Since we accept that setfont(8) can fail with EX_OSERR and we dont treat it as
an error, dont log this failure at LOG_ERR.

Before:
-------
/usr/bin/setfont failed with exit status 71.           [LOG_ERR]
Setting fonts failed with a "system error", ignoring.  [LOG_NOTICE]

After:
-----
/usr/bin/setfont failed with a "system error" (EX_OSERR), ignoring.   [LOG_NOTICE]
Setting source virtual console failed, ignoring remaining ones        [LOG_NOTICE]

Follow-up for 93c9a9d235e2304500c490b4868534385f925c76

9 months agoukify: avoid deprecated datetime call
Zbigniew Jędrzejewski-Szmek [Fri, 1 Dec 2023 09:36:04 +0000 (10:36 +0100)] 
ukify: avoid deprecated datetime call

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for
                    removal in a future version. Use timezone-aware objects to
                    represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

The difference between the two is that .now(datetime.UTC) returns an object with
a timezone attached, "the numbers" are the same.

>>> datetime.datetime.utcnow(), datetime.datetime.now(datetime.UTC)
(datetime.datetime(2023, 12, 1, 9, 37, 53, 891669),
 datetime.datetime(2023, 12, 1, 9, 37, 53, 891688, tzinfo=datetime.timezone.utc))

This value is fed to cryptography's x509.CertificateBuilder object, so as long
as it can accept a datetime object with tzinfo, the result should be identical.

9 months agocore: do not drop CAP_SETUID if it is in AmbientCapabilities=
Luca Boccassi [Fri, 1 Dec 2023 01:44:54 +0000 (01:44 +0000)] 
core: do not drop CAP_SETUID if it is in AmbientCapabilities=

Follow-up for 24832d10b604848cf46624bb439c7fac27f3ce3f

9 months agonetwork: do not send too many netlink messages in a single event 30268/head
Yu Watanabe [Thu, 30 Nov 2023 10:07:36 +0000 (19:07 +0900)] 
network: do not send too many netlink messages in a single event

Fixes #26743.

9 months agofirewall-util: introduce fw_ctx_get_reply_callback_count()
Yu Watanabe [Fri, 1 Dec 2023 05:36:30 +0000 (14:36 +0900)] 
firewall-util: introduce fw_ctx_get_reply_callback_count()

9 months agosd-netlink: introduce netlink_get_reply_callback_count()
Yu Watanabe [Thu, 30 Nov 2023 10:04:37 +0000 (19:04 +0900)] 
sd-netlink: introduce netlink_get_reply_callback_count()

9 months agoMerge pull request #30211 from yuwata/sd-journal-generic-array-bisect-fix
Daan De Meyer [Fri, 1 Dec 2023 10:43:04 +0000 (11:43 +0100)] 
Merge pull request #30211 from yuwata/sd-journal-generic-array-bisect-fix

sd-journal: fix generic_array_bisect()

9 months agosd-netlink: change error code of the case that too many replies waiting
Yu Watanabe [Fri, 1 Dec 2023 05:17:58 +0000 (14:17 +0900)] 
sd-netlink: change error code of the case that too many replies waiting

ERANGE should be used when setting or parsing a number.

9 months agohwdb: ieee1394-unit-function: arrangement for Sony DVMC-DA1
Takashi Sakamoto [Wed, 29 Nov 2023 13:39:50 +0000 (22:39 +0900)] 
hwdb: ieee1394-unit-function: arrangement for Sony DVMC-DA1

A commit 6a42bdb37e39 ("hwdb: ieee1394-unit-function: add Sony
DVMC-DA1") is based on kernel feature unreleased yet (furthermore, not
merged yet). The original intension of new entry is to configure permission
of special file for FireWire character device, so this commit changes the
entry so that it can covers the issued case in existent version of Linux
kernel as out best effort.

When the new version of Linux kernel is released with the new feature,
then following commits would fulfill the hwdb with vendor and model names.

9 months agotest: add tests for generic_array_bisect() 30211/head
Yu Watanabe [Wed, 29 Nov 2023 04:38:36 +0000 (13:38 +0900)] 
test: add tests for generic_array_bisect()

9 months agotest: make append_number() optionally return offset of the entry object
Yu Watanabe [Wed, 29 Nov 2023 04:37:53 +0000 (13:37 +0900)] 
test: make append_number() optionally return offset of the entry object

Preparation for later commits.

9 months agotest: split out finalization task
Yu Watanabe [Tue, 28 Nov 2023 21:08:11 +0000 (06:08 +0900)] 
test: split out finalization task

9 months agosd-journal: fix corrupted journal handling of generic_array_bisect()
Yu Watanabe [Mon, 27 Nov 2023 02:55:49 +0000 (11:55 +0900)] 
sd-journal: fix corrupted journal handling of generic_array_bisect()

Let's consider the following case:
- the direction is down,
- no cached entry,
- the array has 5 entry objects,
- the function test_object() reutns TEST_LEFT for the 1st object,
- the 2nd, 3rd, and 4th objects are broken, so generic_array_bisect_step()
  returns TEST_RIGHT for the object.

Then, previously, generic_array_bisect_step() updated the values like the following:
  0th: (m = 5, left = 0, right = 4, i = 4) -> (m = 4, left = 0, right = 3, RIGHT)
  1st: (m = 4, left = 0, right = 3, i = 1) -> (m = 4, left = 2, right = 3, LEFT)
  2nd: (m = 4, left = 2, right = 3, i = 2) -> (m = 2, left = 2, right = 1, RIGHT) <- ouch!!
So, assert(left < right) in generic_array_bisect() was triggered.
See issue #30210.

In such situation, there is no matching entry in the array. By returning
TEST_GOTO_PREVIOUS, generic_array_bisect() handles the result so.

Fixes a bug introduced by ab8f553d1e09088fb1f633e014299e7bf6c30c9e.

Fixes #30210.

9 months agosd-journal: ignore failure in testing cached corrupted entry
Yu Watanabe [Wed, 29 Nov 2023 21:46:21 +0000 (06:46 +0900)] 
sd-journal: ignore failure in testing cached corrupted entry

Let's consider the case that the 1st entry in an array is broken, but
n-th entry is valid. Then, if generic_array_get() is called to read
n-th object, the offset of the broken entry is cached by the function.
If generic_array_bisect() is followed, even if the matching entry is
valid, it always fail with -EBADMSG or friends, as the function test the
cached entry at the beginnning. Let's ignore the failure in testing the
cached entry.

9 months agoman: document how to properly use a target as the Unit= of a timer
Joerg Behrmann [Thu, 30 Nov 2023 10:01:16 +0000 (11:01 +0100)] 
man: document how to properly use a target as the Unit= of a timer