1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-09 13:57:42 +03:00

72351 Commits

Author SHA1 Message Date
Mike Yuan
6b014a2ac4
man/systemd.socket: be explicit that MaxConnectionsPerSource=0 means disabled 2024-04-08 01:49:49 +08:00
Mike Yuan
8d83e0c20e
core/service: use GREEDY_REALLOC_APPEND 2024-04-08 01:35:24 +08:00
Daan De Meyer
84affd46d5 mkosi: Install dnf5 in Fedora image 2024-04-07 19:09:11 +02:00
Luca Boccassi
7190be5dd4
Merge pull request #32135 from keszybz/compiler-warning-cleanup
Compiler warning cleanup
2024-04-07 16:33:38 +01:00
Mike Yuan
b7e4e152cf core: use log_unit_debug in *_set_state 2024-04-07 10:20:39 +01:00
Luca Boccassi
9dd174dc23 run: query for SoftRebootsCount only for system scope runs
Only the system manager records soft reboots, and the user session is
restarted anyway so it doesn't suffer from the ID clash issue

Follow-up for ed358516937780b524a2cfa833427da3df1bc87f
2024-04-07 10:20:04 +01:00
Zbigniew Jędrzejewski-Szmek
41733186c4 sd-bus: rework assert to make the gcc happy
With gcc-14.0.1-0.13.fc40, when compiling with -O2, the compiler doesn't understand
that sd_bus_error_setf() always returns negative on error when <name> is provided:

[28/576] Compiling C object systemd-resolved.p/src_resolve_resolved-bus.c.o
../src/resolve/resolved-bus.c: In function ‘call_link_method’:
../src/resolve/resolved-bus.c:1763:16: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
 1763 |         return handler(message, l, error);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
../src/resolve/resolved-bus.c:1749:15: note: ‘l’ was declared here
 1749 |         Link *l;
      |               ^
../src/resolve/resolved-bus.c: In function ‘bus_method_get_link’:
../src/resolve/resolved-bus.c:1822:13: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
 1822 |         p = link_bus_path(l);
      |             ^~~~~~~~~~~~~~~~
../src/resolve/resolved-bus.c:1810:15: note: ‘l’ was declared here
 1810 |         Link *l;
      |               ^
...

Let's make the assertion a bit more explicit. With this, the warning goes away,
but I think it's more obvious to a human reader too.
2024-04-07 11:15:19 +02:00
Zbigniew Jędrzejewski-Szmek
6a4607a3c8 ask-password: minor shortening 2024-04-07 11:15:19 +02:00
Zbigniew Jędrzejewski-Szmek
741f6ae39b core: silence gcc warning about unitialized variable
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-07 11:15:19 +02:00
Frantisek Sumsal
b3a8264831 test: improve debug-ability of test-execute
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-06 13:24:36 +01:00
Luca Boccassi
3abc3671f5
Merge pull request #31131 from poettering/dlopen-kmod
turn libkmod into a dlopen() dependency, too
2024-04-06 13:19:27 +01:00
Vito Caputo
a7d8cacce0 man: fix typo s/veno/reno/ 2024-04-06 07:12:33 +02:00
Luca Boccassi
b9c5a0d2cc
Merge pull request #32115 from YHNdnzj/service-main-pid-take
core/service: a few improvements for main pid handling
2024-04-05 23:53:13 +01:00
Luca Boccassi
e92042269e
Merge pull request #32123 from mrc0mmand/assorted-tweaks
A couple of assorted tweaks
2024-04-05 22:22:06 +01:00
Luca Boccassi
1281115957
Merge pull request #32125 from YHNdnzj/post-merge-stuff
Trivial post merge stuff
2024-04-05 22:18:31 +01:00
Mike Yuan
120be68b8d
core/service: add a FIXME to use pidfd to monitor foreign processes 2024-04-06 02:22:19 +08:00
Mike Yuan
a3980843ef
core/service: complain louder if new MAINPID= is refused 2024-04-06 02:22:19 +08:00
Mike Yuan
c603f523d0
core/service: make service_set_main_pidref consume pidref
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-06 02:22:19 +08:00
Mike Yuan
36b21fac8f
sleep: rename SleepMemMode= to MemorySleepMode=
Addresses https://github.com/systemd/systemd/pull/31986#discussion_r1554053623
2024-04-06 02:16:54 +08:00
Mike Yuan
99f3b67f3f
os-util: use ENDSWITH_SET where appropriate
Addresses https://github.com/systemd/systemd/pull/31435#discussion_r1553969156

Co-authored-by: Lennart Poettering <lennart@poettering.net>
2024-04-06 02:16:53 +08:00
Frantisek Sumsal
1d07188b15 base-filesystem: check for __s390x__ first
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-05 19:44:44 +02:00
Frantisek Sumsal
3ebd598624 test: account for build dir being under one of the tmpfs-ed directories
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-05 19:44:41 +02:00
Frantisek Sumsal
a9805f8ca9 test: make test-fd-util more lenient when using fd_move_above_stdio()
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-05 19:40:23 +02:00
Zbigniew Jędrzejewski-Szmek
c1e7f938ca
Merge pull request #31435 from bluca/portable_fix_versioned
portable: assorted bug fixes
2024-04-05 17:04:17 +02:00
Antonio Alvarez Feijoo
1eeae735ad sd-journal: fix check in journal_file_verify_header()
Fixes 6ea51363c8e39fb0924dda972a212936456a2b4f
2024-04-05 13:03:19 +02:00
Frantisek Sumsal
e55db9e792 log: fix comment 2024-04-05 12:14:18 +02:00
Daan De Meyer
aaa872a713 core: Serialize both pid and pidfd to keep downgrades working
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-05 12:56:26 +09:00
Luca Boccassi
1ce28e5a24 meson: set -fno-ssa-phiopt when building bpf with gcc
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-05 12:55:53 +09:00
Kirk
57cd604fde
hwdb: fix missing colon (#32108)
Missing colon prevents this from working correctly on the Chuwi UBook X and UBook X Pro.
2024-04-05 10:18:59 +09:00
Luca Boccassi
360f486cc6
Merge pull request #32085 from yuwata/udev-check-processing
udev: check ID_PROCESSING udev property more
2024-04-04 23:46:26 +01:00
Yu Watanabe
36ca167220
Merge pull request #31373 from yuwata/network-neighbor-advertisement
network: add basic support of neighbor advertisement
2024-04-05 05:54:12 +09:00
Yu Watanabe
e17e438ede udevadm-test: also show security labels if specified
Follow-up for 03b6879f4d45c49264708aef872fd05af30ddcf0.
2024-04-04 21:30:26 +01:00
Yu Watanabe
9990552f9a backlight: fix detection of multiple graphic cards
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-04 21:29:57 +01:00
Yu Watanabe
f7cb6801a2 udev: do not update sysattr and sysctl value on testing
Follow-up for 089bef66316e5bdc91b9984148e5a6455449c1da.
2024-04-04 21:29:30 +01:00
Luca Boccassi
9a937ea2a6
Merge pull request #32102 from YHNdnzj/efi-var-consistent
Trivial follow-up for hibernate-resume
2024-04-04 21:21:10 +01:00
Mike Yuan
05d2a63139
man/kernel-command-line: document resume_offset= too 2024-04-05 03:03:09 +08:00
Mike Yuan
166ad35fa8
hibernate-util: say "HibernateLocation EFI variable" consistently 2024-04-05 02:59:59 +08:00
Yu Watanabe
6a363a838a udevadm-test: insert missing line break
Addresses post-merge comment:
03b6879f4d (r140587790)
2024-04-04 20:10:28 +02:00
Zbigniew Jędrzejewski-Szmek
cdba129b71 TEST-50: add tests for riscv{32,64}
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-04 20:07:57 +02:00
mkubiak
ad248d522b Fixed resolution for pen and touchpad 2024-04-05 02:26:54 +09:00
Yu Watanabe
87a33c0740 netowrk/ndisc: drop NDisc configurations when received NA without Router flag
Closes #28421.
2024-04-05 02:16:03 +09:00
Yu Watanabe
ecab9b6040 test-ndisc: add basic tests for Neighbor Advertisement handling 2024-04-05 02:16:03 +09:00
Yu Watanabe
696eb2b8de sd-ndisc: add basic support of Neighbor Advertisement message
This adds basic support of receiving and parsing Neighbor Advertisement
message defined in RFC 4861.
2024-04-05 02:16:03 +09:00
Antonio Alvarez Feijoo
ce18410a54 cryptsetup-tokens: fix argument order mismatch in function
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-05 01:12:42 +08:00
Yu Watanabe
405be62f05 tree-wide: refuse enumerated device with ID_PROCESSING=1
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-05 01:49:20 +09:00
Yu Watanabe
54e6172550 tree-wide: use device_is_processed() more 2024-04-05 01:49:20 +09:00
Yu Watanabe
3df2b4557a udev-util: rename device_is_processing() -> device_is_processed()
And make it also check the existence of the udev database.
2024-04-05 01:48:59 +09:00
Luca Boccassi
2aef0ac819
Merge pull request #32097 from keszybz/sd-notify-cleanups
Small cleanups to sd_notify docs
2024-04-04 17:44:12 +01:00
Daan De Meyer
7b62a246a6
Merge pull request #32033 from DaanDeMeyer/unit-creds
debug-generator: Add unit and drop-in credentials
2024-04-04 18:27:20 +02:00
Lennart Poettering
a0ff536ac5 update TODO 2024-04-04 18:16:45 +02:00