summaryrefslogtreecommitdiffstats
path: root/docs/SECURITY.md (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-04-07core: silence gcc warning about unitialized variableZbigniew Jędrzejewski-Szmek1-1/+3
When compiled with -O2, the compiler is not happy about dynamic_user_pop() and would warn about the output variables not being set. It does have a point: we were doing a cast from ssize_t to int, and theoretically there could be wraparound. So let's add an explicit check that the cast to int is fine. [540/2509] Compiling C object src/core/libsystemd-core-256.so.p/dynamic-user.c.o ../src/core/dynamic-user.c: In function ‘dynamic_user_close.isra’: ../src/core/dynamic-user.c:580:9: warning: ‘uid’ may be used uninitialized [-Wmaybe-uninitialized] 580 | unlink_uid_lock(lock_fd, uid, d->name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/core/dynamic-user.c:560:15: note: ‘uid’ was declared here 560 | uid_t uid; | ^~~ ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’: ../src/core/dynamic-user.c:476:29: warning: ‘new_uid’ may be used uninitialized [-Wmaybe-uninitialized] 476 | num = new_uid; | ~~~~^~~~~~~~~ ../src/core/dynamic-user.c:398:23: note: ‘new_uid’ was declared here 398 | uid_t new_uid; | ^~~~~~~
2024-04-06test: improve debug-ability of test-executeFrantisek Sumsal1-1/+5
Since e56a8790a0 debugging test-execute fails has been a royal PITA, since we ditch all potentially useful output from the test units (that, for the most part, run `sh -x ...`). Let's improve the situation a bit by setting EXEC_OUTPUT_NULL only when running the single test case that needs it, and inheriting stdout otherwise. For example, with a purposefully introduced error we get this output with this patch: exec-personality-x86-64.service: About to execute: sh -x -c "c=\$\$(uname -m); test \"\$\$c\" = \"foo_bar\"" Serializing sd-executor-state to memfd. ... Personality: x86-64 LockPersonality: no SystemCallErrorNumber: kill ++ uname -m + c=x86_64 + test x86_64 = foo_bar Received SIGCHLD from PID 1520588 (sh). Child 1520588 (sh) died (code=exited, status=1/FAILURE) exec-personality-x86-64.service: Child 1520588 belongs to exec-personality-x86-64.service. exec-personality-x86-64.service: Main process exited, code=exited, status=1/FAILURE exec-personality-x86-64.service: Failed with result 'exit-code'. ... Exit Status: 1 src/test/test-execute.c:456:test_exec_personality: exec-personality-x86-64.service: can_unshare=yes: exit status 1, expected 0 (test-execute-root) terminated by signal ABRT. Assertion 'r >= 0' failed at src/test/test-execute.c:1433, function prepare_ns(). Aborting. Aborted But without it, we'd miss the most important part: exec-personality-x86-64.service: About to execute: sh -x -c "c=\$\$(uname -m); test \"\$\$c\" = \"foo_bar\"" Serializing sd-executor-state to memfd. ... Personality: x86-64 LockPersonality: no SystemCallErrorNumber: kill Received SIGCHLD from PID 1521365 (sh). Child 1521365 (sh) died (code=exited, status=1/FAILURE) exec-personality-x86-64.service: Child 1521365 belongs to exec-personality-x86-64.service. exec-personality-x86-64.service: Main process exited, code=exited, status=1/FAILURE exec-personality-x86-64.service: Failed with result 'exit-code'. ... Exit Status: 1 src/test/test-execute.c:456:test_exec_personality: exec-personality-x86-64.service: can_unshare=yes: exit status 1, expected 0 (test-execute-root) terminated by signal ABRT. Assertion 'r >= 0' failed at src/test/test-execute.c:1433, function prepare_ns(). Aborting. Aborted
2024-04-06man: fix typo s/veno/reno/Vito Caputo1-1/+1
2024-04-05core/service: add a FIXME to use pidfd to monitor foreign processesMike Yuan1-2/+2
2024-04-05core/service: complain louder if new MAINPID= is refusedMike Yuan1-1/+1
2024-04-05core/service: make service_set_main_pidref consume pidrefMike Yuan1-20/+19
Currently, the memory management of service_set_main_pidref is a bit odd. Normally we either invalidate the original resource on caller's side after the call succeeds, or just pass the ownership wholly. But service_set_main_pidref take a pointer, and calls pidref_done() internally. Let's just make it consume the passed pidref. This is more straightforward.
2024-04-05sleep: rename SleepMemMode= to MemorySleepMode=Mike Yuan3-3/+3
Addresses https://github.com/systemd/systemd/pull/31986#discussion_r1554053623
2024-04-05os-util: use ENDSWITH_SET where appropriateMike Yuan1-9/+4
Addresses https://github.com/systemd/systemd/pull/31435#discussion_r1553969156 Co-authored-by: Lennart Poettering <lennart@poettering.net>
2024-04-05base-filesystem: check for __s390x__ firstFrantisek Sumsal1-2/+2
On s390x both __s390__ and __s390x__ are defined, and with the original order we'd go through the __s390__ branch and emit a warning: [169/2118] Compiling C object src/shared/libsystemd-shared-256.a.p/base-filesystem.c.o ../src/shared/base-filesystem.c:136:11: note: ‘#pragma message: Please add an entry above specifying whether your architecture uses /lib64/, /lib32/, or no such links.’ 136 | # pragma message "Please add an entry above specifying whether your architecture uses /lib64/, /lib32/, or no such links." | ^~~~~~~
2024-04-05test: account for build dir being under one of the tmpfs-ed directoriesFrantisek Sumsal1-1/+30
If we're running test-execute from the build directory which is under one of the tmpfs-ed directories (i.e. /root or /tmp), test-execute might behave strangely, since in that case manager_new() pins the system systemd-executor binary instead of the build dir one, which may lead to a very confusing test fails (if there's enough difference between the system and built sd-executor binary). Let's account for that and bind-mount the build dir under the tmpfs-ed directory if necessary.
2024-04-05test: make test-fd-util more lenient when using fd_move_above_stdio()Frantisek Sumsal1-9/+13
On s390x this test fails when the SUT uses the z90crypt kernel module, as it's an another FD the test doesn't account for: /* test_rearrange_stdio */ Successfully forked off 'rearrange' as PID 57293. test_rearrange_stdio: r=0 /proc/57293/fd: total 0 lrwx------. 1 root root 64 Apr 5 06:18 0 -> /dev/pts/0 lrwx------. 1 root root 64 Apr 5 06:18 1 -> /dev/pts/0 lrwx------. 1 root root 64 Apr 5 06:18 2 -> /dev/pts/0 lrwx------. 1 root root 64 Apr 5 06:18 3 -> /dev/z90crypt rearrange terminated by signal ABRT. Debugging this was pain, since the child process didn't log anything once we closed stdout/stderr (for obvious reasons). Let's fix both issues by switching logging to kmsg once we close stdin/stdout/stderr, and also by making the test work fine when there are some extra FDs in the child's environment.
2024-04-05sd-journal: fix check in `journal_file_verify_header()`Antonio Alvarez Feijoo1-3/+3
Fixes 6ea51363c8e39fb0924dda972a212936456a2b4f
2024-04-05log: fix commentFrantisek Sumsal1-1/+1
2024-04-05core: Serialize both pid and pidfd to keep downgrades workingDaan De Meyer5-17/+22
Currently, when downgrading from a version with pidfd support to a version without pidfd support, all information about running processes is lost as the newer systemd will serialized pidfds which are not recognized by the older systemd when deserializing. To improve the situation, let's serialize both the pid and the pidfd. This is safe because existing versions will either replace the first deserialized pidref with the second one or discard the second one in favor of the first one depending on the unit and field. Older versions that don't support pidfd's will silently discard any fields that contain a pidfd as those will try to parse the field as a pid and since a pidfd field will start with '@', those versions will debug error log and ignore the value. To make sure we reuse the existing pidfd as much as possible, the pidfd is serialized first. Both for scopes and service main pids, if the same pid is seen multiple times, the first pidref is kept. So by serializing the pidfd first we make sure the original pidfd is used instead of the new one which is opened when deserializing the first pid field. For other control units, older versions with pidfd support will discard the first pidfd and replace it with a new pidfd from the second pid field. This is a slight regression on downgrades, but we make sure it doesn't happen for future versions (and older versions when this commit is backported) by modifying the logic to only use the first successfully deserialized pidref so that the raw pid without pidfd is discarded instead of it replacing the existing pidfd.
2024-04-05meson: set -fno-ssa-phiopt when building bpf with gccLuca Boccassi1-0/+1
There are bugs in the kernel verifier that cause legitimate code to be rejected, disabling this optimization makes bpf programs built with a new enough gcc work again. Fixes https://github.com/systemd/systemd/issues/31888
2024-04-05hwdb: fix missing colon (#32108)Kirk1-1/+1
Missing colon prevents this from working correctly on the Chuwi UBook X and UBook X Pro.
2024-04-04udevadm-test: also show security labels if specifiedYu Watanabe1-0/+7
Follow-up for 03b6879f4d45c49264708aef872fd05af30ddcf0.
2024-04-04backlight: fix detection of multiple graphic cardsYu Watanabe1-0/+4
Follow-up for e0504dd011189d97a1ea813aabfe1e696742bcf5. Hopefully, devices in PCI subsystem have some properties, thus have their udev database file. But, that may not be true. Here, we only read sysattrs of enumerated devices, hence it is not necessary to check if the device is initialized or not.
2024-04-04udev: do not update sysattr and sysctl value on testingYu Watanabe1-12/+21
Follow-up for 089bef66316e5bdc91b9984148e5a6455449c1da.
2024-04-04man/kernel-command-line: document resume_offset= tooMike Yuan1-0/+10
2024-04-04hibernate-util: say "HibernateLocation EFI variable" consistentlyMike Yuan1-1/+1
2024-04-04udevadm-test: insert missing line breakYu Watanabe1-1/+1
Addresses post-merge comment: https://github.com/systemd/systemd/commit/03b6879f4d45c49264708aef872fd05af30ddcf0#r140587790
2024-04-04TEST-50: add tests for riscv{32,64}Zbigniew Jędrzejewski-Szmek1-5/+15
Requested for the testing of F40 riscv bringup. Numbers copied from https://uapi-group.org/specifications/specs/discoverable_partitions_specification/. It'd be nice to do the same in TEST-58, but the code there is rather involved and I don't have a system to test on. We can probably try that later on when F40 is available.
2024-04-04Fixed resolution for pen and touchpadmkubiak1-3/+5
2024-04-04netowrk/ndisc: drop NDisc configurations when received NA without Router flagYu Watanabe2-4/+157
Closes #28421.
2024-04-04test-ndisc: add basic tests for Neighbor Advertisement handlingYu Watanabe1-3/+117
2024-04-04sd-ndisc: add basic support of Neighbor Advertisement messageYu Watanabe8-2/+240
This adds basic support of receiving and parsing Neighbor Advertisement message defined in RFC 4861.
2024-04-04cryptsetup-tokens: fix argument order mismatch in functionAntonio Alvarez Feijoo1-1/+1
The order of the arguments of the function `acquire_luks2_key()` in `luks2-tpm2.h` is wrong, `pcrlock_path` and `pin` are swapped. Fixes 404aea7815595c1324947ed7f2a7502b17d3cc01
2024-04-04tree-wide: refuse enumerated device with ID_PROCESSING=1Yu Watanabe4-4/+19
When enumerated devices are being processed by udevd, we will receive corresponding uevents later. So, we should not process devices in that case.
2024-04-04tree-wide: use device_is_processed() moreYu Watanabe3-4/+4
2024-04-04udev-util: rename device_is_processing() -> device_is_processed()Yu Watanabe3-14/+17
And make it also check the existence of the udev database.
2024-04-04update TODOLennart Poettering1-1/+0
2024-04-04libkmod: turn into dlopen() dependencyLennart Poettering15-91/+202
As it turns out libkmod has quite a bunch of deps, including various compressing libs and similar. By turning this into a dlopen() dependency, we can make our depchain during install time quite a bit smaller. In particular as inside of containers kmod doesn't help anyway as CAP_SYS_MODULE is not available anyway. While we are at it, also share the code that sets up logging/kmod context. After: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libz.so.1 => /lib64/libz.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 liblzma.so.5 => /lib64/liblzma.so.5 libzstd.so.1 => /lib64/libzstd.so.1 libc.so.6 => /lib64/libc.so.6 Before: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libkmod.so.2 => /lib64/libkmod.so.2 libzstd.so.1 => /lib64/libzstd.so.1 liblzma.so.5 => /lib64/liblzma.so.5 libz.so.1 => /lib64/libz.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libgcc_s.so.1 => /lib64/libgcc_s.so.1 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 libc.so.6 => /lib64/libc.so.6
2024-04-04watchdog: clarify that we set the *watchdog* timeoutLennart Poettering1-8/+8
This makes sure we mention the word "watchdog" in every log message related to the watchdog. Also, this uses the expression "hardware timeout" when referring to the primary timeout of the watchdog, as opposed to the "pretimeout". (Not ideal wording I know, but it's preexisting to some point, I just continued it. I think it's OK though, in particular to underline the difference to the software watchdog logic we implement via WATCHDOG= in sd_notify().) Fixes: #31662
2024-04-04debug-generator: Add unit and drop-in credentialsDaan De Meyer5-5/+141
These allow adding extra units and drop-ins via credentials.
2024-04-04network-generator: Add loggingDaan De Meyer3-76/+90
We stick to debug logging because in some cases network-generator will fall back to trying another parsing function if one fails, so if we return an error it's not necessarily a failure.
2024-04-04man: align strings in sd_notify() examplesZbigniew Jędrzejewski-Szmek1-3/+3
I think this way it's easier to see that they are part of the same argument.
2024-04-04man/notify-selfcontained-example: check argument firstZbigniew Jędrzejewski-Szmek1-4/+6
This is just good style. In this particular case, if the argument is incorrect and the function is not tested with $NOTIFY_SOCKET set, the user could not get the proper error until running for real. Also, remove mention of systemd. The protocol is fully generic on purpose.
2024-04-04man: regenerate rulesZbigniew Jędrzejewski-Szmek1-1/+1
Fixup for dfad86b83807fa8696ca94982a5ba591b6d86a80.
2024-04-04man: update fedora example to F40Zbigniew Jędrzejewski-Szmek1-2/+1
F40 will be out soon, so we can update the man page already. The example should already work. The cloud link was dropped in fd571c9df0ba86636401582c4ea0a8cb608e1216, so drop the unused variable too.
2024-04-03core/exec-invoke: replace basename() with path_extract_filename() (#32076)Julius Alexandre1-2/+9
2024-04-03vmspawn: fix error codeYu Watanabe1-1/+1
2024-04-03mkosi: More package updatesDaan De Meyer4-4/+7
- Install individual asan libraries instead of gcc - Drop duplicate qrencode package from arch config - Install dbus-user-session which provides default-dbus-session-bus - Explicitly install dbus-broker on Arch Linux
2024-04-03sysupdate: use log_syntax() when logging about a configuration fileLennart Poettering1-1/+1
All code around this does this too, hence do it here as well. Also fix plural verb form. Follow-up for: #32018
2024-04-03man/example: also build example code with C90Yu Watanabe3-3/+8
Unfortunately, sd-bus-vtable.h, sd-journal.h, and sd-id128.h have variadic macro and inline initialization of sub-object, these are not supported in C90. So, we need to silence some errors.
2024-04-03mkosi: Install selinux tools in main image instead of initramfsDaan De Meyer1-2/+4
Also install setools-console and policycoreutils instead of setools which pulls in the kitchen sink. Also install selinux-policy-targeted to make sure the right policy is installed.
2024-04-03mkosi: Install git-core where possibleDaan De Meyer5-1/+4
This avoids pulling in the perl kitchen sink.
2024-04-03Revert "kernel-install: Add kernel version to title (#31581)"Lennart Poettering1-2/+2
This reverts commit 85b774de49caff8be819f021740dd680ba76ab77.
2024-04-03resolved: return ExpectedMore error if we require "more" varlink flag on ↵Lennart Poettering1-1/+1
method call Fixes: #32066
2024-04-03fuzz: check that ND options are parsed sucessfullyEvgeny Vereshchagin1-1/+1
At that point the options have been parsed, sent and received again so `ndisc_parse_options` should never fail there (unless ndisc_send corrupts them somehow). It's a follow-up to https://github.com/systemd/systemd/pull/31807