Commit Graph
81595 Commits
Author SHA1 Message Date
Yu Watanabe e4d07d1a2d userdb: introduce USERDB_SYNTHESIZE_NUMERIC flag
When the flag is set, even if the specified UID/GID does not exist,
create a synthetic user record for the UID/GID.
Currently, only system UID/GID are supported.
2025-05-09 12:10:28 +09:00
Yu Watanabe 6d30c11a0a network/tuntap: allow to specify root to User=/Group=
Follow-up for 940441b44c.

With the commit, User=/Group=root was refused and warned that the root
is not a system user. Typically it is not necessary to specify such, but
let's not log confusing warning and honor the setting.
2025-05-09 12:10:28 +09:00
Yu Watanabe 6377f40d26 user-record: introduce USERDB_MATCH_ROOT_AND_SYSTEM
It may be useful when we want to resolve root and system user/group
but want to refuse nobody user/group.
2025-05-09 12:10:28 +09:00
Yu Watanabe 4dcc308fba userdb: introduce user/group_record_buildo() helper macros 2025-05-09 12:10:28 +09:00
Yu Watanabe 64fc712fe7 user-util,user-record-nss: initialize buffer before calling getpwnam_r() and friends
The buffer will be used by a library outside of our code base,
and may not be initialized even on success. Let's initialize
them for safety.

Hopefully fixes the following fuzzer warning:
```
==2039==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f9ad8be3ae6 in _nss_files_getsgnam_r (/lib/x86_64-linux-gnu/libnss_files.so.2+0x8ae6) (BuildId: 013bf05b4846ebbdbebdb05585acc9726c2fabce)
    #1 0x7f9ad93e5902 in getsgnam_r (/lib/x86_64-linux-gnu/libc.so.6+0x126902) (BuildId: 0323ab4806bee6f846d9ad4bccfc29afdca49a58)
    #2 0x7f9ad9b98153 in nss_sgrp_for_group /work/build/../../src/systemd/src/shared/user-record-nss.c:357:21
    #3 0x7f9ad9b98926 in nss_group_record_by_gid /work/build/../../src/systemd/src/shared/user-record-nss.c:431:21
    #4 0x7f9ad9bcebd7 in groupdb_by_gid_fallbacks /work/build/../../src/systemd/src/shared/userdb.c:1372:29

  Uninitialized value was created by a heap allocation
    #0 0x556fd5294302 in malloc /src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1021:3
    #1 0x7f9ad9b9811d in nss_sgrp_for_group /work/build/../../src/systemd/src/shared/user-record-nss.c:353:23
    #2 0x7f9ad9b98926 in nss_group_record_by_gid /work/build/../../src/systemd/src/shared/user-record-nss.c:431:21
    #3 0x7f9ad9bcebd7 in groupdb_by_gid_fallbacks /work/build/../../src/systemd/src/shared/userdb.c:1372:29
```
2025-05-09 12:10:28 +09:00
Yu Watanabe 1e35d21ab0 udevadm-trigger: parse all arguments before doing anything (#37293) 2025-05-09 12:09:18 +09:00
Yu Watanabe fe927f3dbb udev: enable kill workers timer when processing events stopped (#37382)
This also extends test cases for
`udevadm control --start-exec-queue/--stop-exec-queue`.
2025-05-09 10:42:48 +09:00
David Tardon a63822a7e3 udevadm-trigger: use string table to parse scan type 2025-05-09 09:54:27 +09:00
David Tardon bc995d6764 udevadm-trigger: add prefix to enumeration values 2025-05-09 09:54:27 +09:00
David Tardon a07f40e264 udevadm-trigger: replace home-made key/value splitting function 2025-05-09 09:54:25 +09:00
David Tardon f849e85221 test: extend udevadm coverage test a bit 2025-05-09 09:53:50 +09:00
David Tardon 9925193a76 udevadm: allow key without a value 2025-05-09 09:53:50 +09:00
David Tardon f10206a88e udevadm: move key/value parsing func. to udevadm-util.c 2025-05-09 09:53:50 +09:00
David Tardon 5f0ebd9754 udevadm-trigger: split arg. parsing into a separate function 2025-05-09 09:53:40 +09:00
David Tardon 9b65fb8f34 udevadm-trigger: add vertical space to separate cases 2025-05-09 09:44:56 +09:00
Yu Watanabe 75e906a406 TEST-17-UDEV: extend test cases for udevadm control --start-exec-queue/--stop-exec-queue 2025-05-09 08:54:26 +09:00
Yu Watanabe 9999e8b409 TEST-17-UDEV: drop needless numbering
The subtest was renamed from TEST-17-UDEV.10.sh.
Let's also drop the numbering from function name and interface name.

Follow-up for 40959dcc02.
2025-05-09 08:54:26 +09:00
Yu Watanabe a3d79fc3a0 udev: enable kill workers timer when processing queued events stopped
It is not necessary to keep idle workers so long time in that case.
2025-05-09 08:54:26 +09:00
Mike Yuan df5dd05941 hashmap,prioq: check hash_ops or compare_func is identical to one already set (#37379) 2025-05-08 22:50:38 +02:00
Daan De Meyer dd832c4fed udev-worker: send path to device node of whole disk when it is locked, and one cleanup (#37385) 2025-05-08 08:20:21 +02:00
Itxaka 03eae2a402 boot: add an option to control action after SecureBoot enrollment (#36684)
This PR provides a new option for systemd-boot
`secure-boot-enroll-action` which allows to configure the behavior after
SecureBoot keys are enrolled.

Provides the option to either reboot or power off.

The current behavior is not changed, it will by default reboot as it did
before.

It also provides a small message about the action its going to take with
a small delay so the user can read it.
2025-05-08 13:28:41 +09:00
Yu Watanabe f9550d1182 prioq: make prioq_ensure_put() type safe 2025-05-08 05:58:33 +09:00
Yu Watanabe 4699f0e68a prioq: check if identical compare func is specified if already allocated 2025-05-08 05:58:33 +09:00
Yu Watanabe bc169c4fa2 hashmap: check if identical hash_ops is specified if already allocated 2025-05-08 05:58:33 +09:00
Yu Watanabe 472379925c resolve: use set_put_strdup_full() to specify hash_ops 2025-05-08 05:58:33 +09:00
Yu Watanabe 16c7555e1a core/unit: use the same hash_ops originally used on allocation
See unit_file_build_name_map().
2025-05-08 05:58:33 +09:00
Yu Watanabe 54bbfa007d set: rename _set_ensure_allocated() -> set_ensure_allocated()
Follow-ups for c09ce222b6.
2025-05-08 05:58:33 +09:00
Yu Watanabe f24f70343d network: log_link_message_debug_errno() automatically append %m if necessary
Follow-up for d28746ef55.
Fixes CID#1609753.
2025-05-08 05:57:48 +09:00
Yu Watanabe 22750aa91e udev-worker: notify device node of whole disk to manager when the disk is locked
It is currently unused, but will be used later.
2025-05-08 04:46:01 +09:00
Yu Watanabe 356d44a063 udev-worker: allocate UdevEvent object just before use
No functional change, just refactoring.
2025-05-08 04:46:01 +09:00
Yu Watanabe ecad362d7e man: fix typo
Follow-up for a50fa2a40f.
2025-05-08 03:37:38 +09:00
Yu Watanabe 8449d38d6f boot: Add EDID (#36843)
This adds a couple of custom CHIDs which include panel manufacturer and
product code.
2025-05-08 02:48:00 +09:00
Lennart Poettering 0d5ee894c4 exec-util: make missing agents a gracefull handled issues
Just downgrade the log message in case of ENOENT of agent binaries to
LOG_DEBUG. Do this in order to support distros which split off some
agent bianries into separate optional binaries.

Fixes: #37369
2025-05-08 02:38:47 +09:00
Todd C. Miller ffb6adb763 flush_ports: flush POSIX message queues properly
On Linux, read() on a message queue descriptor returns the message
queue statistics, not the actual message queue data.  We need to use
mq_receive() to drain the queues instead.

Fixes a problem where a POSIX message queue socket unit with messages
in the queue at shutdown time could result in a hang on reboot/shutdown.
2025-05-08 02:37:45 +09:00
Mike Yuan 66a3b69440 test: add test cases for ExecStart= via-shell prefix 2025-05-07 18:32:20 +02:00
Mike Yuan e61d2011d1 run0: introduce --via-shell for invoking target user's shell, and -i shortcut
-i/--login has exact sudo semantics. But we only document
the short option and advertise expressly specifying
--via-shell --chdir='~' otherwise.
2025-05-07 18:32:20 +02:00
Mike Yuan fa02d58d85 run0: support --chdir='~' for switching to target user's home dir
parse_path_argument() unconditionally makes the passed path absolute,
without handling '~' of any sort. I think this generally makes sense
in most tools, since ~ expansion is typically done by the shell
and we wouldn't be seeing them in the first place and hence special
casing is not worth it. But in run0 let's explicit enable '~'.
2025-05-07 18:32:19 +02:00
Mike Yuan 5b8bcbcf00 core: accept "|" ExecStart= prefix to spawn target user's shell
When switching to another user it's oftentimes desirable to also spawn
the target user's shell. sudo supports this via -i flag, run0 currently
doesn't. We don't want to proactively query NSS ourselves, since
that would fall short when operating remotely. Let's instead teach
the service manager to spawn the command using the user's default shell.

I opted for "|" instead of "." in the end because the latter seems
a bit obscure. But happy to change it to something else if a better option
comes up.
2025-05-07 18:32:19 +02:00
Mike Yuan 398b3e4472 path-util: introduce filename_or_absolute_path_is_valid() helper 2025-05-07 18:32:19 +02:00
Mike Yuan 91d5fad9fb bus-unit-util: do not trigger assertion on "ExecStart=@"
extract_first_word() normalizes empty string to NULL,
triggering the assertion on input string in strv_split_full().
2025-05-07 18:32:18 +02:00
Mike Yuan 72758ef117 env-util: add missing assertions 2025-05-07 18:32:18 +02:00
Mike Yuan 72fc33fe20 man/systemd.service: drop dangling reference to "!!" prefix
Follow-up for 00a415fc8f
2025-05-07 18:32:15 +02:00
Yu Watanabe 676fb42aae units: enable IgnoreOnIsolate=yes on systemd-udevd-kernel.socket
Otherwise, initrd-cleanup.service requests isolation thus the socket
is stopped before switching root, and several early events after
switching root may be lost.
2025-05-08 01:29:53 +09:00
anonymix007 9fed4ec252 analyze-chid: Support EDID CHIDs 2025-05-07 18:52:49 +03:00
anonymix007 907328749f sd-device: Introduce sd_device_get_sysattr_value_with_size() 2025-05-07 18:52:49 +03:00
anonymix007 eec1f041b1 chid: Setup EDID CHIDs 2025-05-07 18:52:49 +03:00
anonymix007 3481f8f86d chid-fundamental: Introduce new CHID types
These are extra types needed to distinguish devices by the installed
display panel
2025-05-07 18:52:49 +03:00
anonymix007 e864741511 boot: Add EDID parsing
Will be used for identifying the currently used display panel
and choosing the appropriate DTB
2025-05-07 18:52:49 +03:00
anonymix007 c453aac65f fundamental: Introduce EDID header parsing 2025-05-07 18:10:51 +03:00
anonymix007 edda8d51f1 boot: Add be16toh, le16toh and le32toh 2025-05-07 18:10:51 +03:00