Commit Graph
81261 Commits
Author SHA1 Message Date
Yu Watanabe 0cde671c29 udev: check earlier if there is a free room for processing an event 2025-05-10 00:26:32 +09:00
Yu Watanabe 4478546649 udev: cache last queued event entry
When we have N queued events, LIST_APPEND() takes O(N).
Let's cache the last event to optimize queueing.
2025-05-10 00:26:32 +09:00
Yu Watanabe e962ebbe72 udev: introduce event_freep() and use it as cleanup attribute
No functional change, just refactoring and preparation for later change.
2025-05-10 00:26:32 +09:00
Daan De Meyer 180ea8b3ab More header cleanups (#37381) 2025-05-09 17:22:33 +02:00
Yu Watanabe e06e34a3b6 udev: replace get_user/group_creds() with userdb/groupdb_by_name() (#37304)
This also makes networkd not refuse User=/Group=root.
2025-05-09 20:54:16 +09:00
Kurt Borja 15450ba214 hwdb: keyboard: Add Alienware special keys
Add Alienware *Performance mode* toggle key and *Macro* keys.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
2025-05-09 20:42:00 +09:00
Marcos Alano fb8149234a Add emulated release to G-Mode key 2025-05-09 20:41:45 +09:00
Daan De Meyer 5f142e01d0 strv: Move STRV_FOREACH() to strv-fundamental.h 2025-05-09 11:33:33 +02:00
Daan De Meyer 56c710ce37 alloc-util: Remove unneeded stdlib.h include 2025-05-09 11:33:33 +02:00
Daan De Meyer 2782dae50f compress: Drop lz4 includes from compress.h
The lz4 functions are only used in test-compress.c, so let's just
put the declarations and includes in there instead of having everyone
including compress.h pull in the lz4 headers.
2025-05-09 11:33:33 +02:00
Daan De Meyer 7227d5bfff terminal-util: Move various functions to ansi-color.c 2025-05-09 11:33:33 +02:00
Daan De Meyer c992250c24 basic: Move parts of audit-util.{c,h} to libaudit-util.{c,h} in shared/ 2025-05-09 11:33:33 +02:00
Daan De Meyer 3b7d332047 macro: Reduce transitive includes 2025-05-09 11:33:31 +02:00
Daan De Meyer 3b58245624 basic: Override glibc's sys/param.h header with an empty file
Instead of unconditionally including sys/param.h in
macro-fundamental.h which itself includes a bunch of other unnecessary
headers, let's override it with an empty file to avoid it from overriding
our MAX() macro. We can't make including it an error as it's included (
for seemingly no good reason) by <resolv.h>.
2025-05-09 11:23:14 +02:00
Yu Watanabe 37c8a03ebf udevadm-info: parse all arguments before doing anything (#37292) 2025-05-09 14:09:45 +09:00
David Tardon 6cdc63d120 udevadm-info: use string table to parse query type 2025-05-09 12:14:21 +09:00
David Tardon 4ef3019ceb udevadm-info: drop args of stat_device()
They are all static vars now, so can be used directly.
2025-05-09 12:14:21 +09:00
David Tardon 8ea3c1fb9e udevadm-info: shorten the code a bit 2025-05-09 12:14:21 +09:00
David Tardon 31767b92a0 udevadm-info: reject devices passed via opts too
Follow-up-for a6b4b2fa01
2025-05-09 12:14:21 +09:00
David Tardon d89b3004da udevadm-info: split arg. parsing into a separate function 2025-05-09 12:14:16 +09:00
David Tardon 86ff972ac3 udevadm-info: drop superfluous pager_open() call
It's already called in advance in info_main().
2025-05-09 12:10:51 +09:00
David Tardon 5b4d73208e udevadm-info: make arg_pager_flags static 2025-05-09 12:10:51 +09:00
David Tardon cb3f6c9e0d udevadm-info: move static dtor closer to args 2025-05-09 12:10:51 +09:00
Yu Watanabe 0c93e66386 udev: use userdb_by_name()/groupdb_by_name()
Prompted by https://github.com/systemd/systemd/pull/37294#discussion_r2068141968.
2025-05-09 12:10:28 +09:00
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