Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe f3cbd4da12 udev-dump: voidify one function call
Fixes CID#1590377.
2025-01-23 01:50:13 +09:00
Yu Watanabe e887b3006c networkd-test: unconditionally stop previous invocation of networkd before starting new one
When networkd is already running, creating some .network files and
friends and starting networkd does not take any effect. Let's always
restart networkd when we want to start a new invocation.
2025-01-22 10:29:59 +00:00
Yu Watanabe e7e707f058 networkd-test.py: generate debugging logs of networkd 2025-01-21 09:48:17 +01:00
Yu Watanabe 25a2e4738b udevadm-control: allow to enable/disable trace logging in systemd-udevd
Should be useful for debugging udev rules.
2025-01-21 04:12:18 +09:00
Yu Watanabe 993b481ad1 udev-varlink: allow to enable/disable trace logging through varlink
This introduces io.systemd.Udev.SetTrace varlink method. With the
method, trace logging by udev worker can be dynamically controlled.
2025-01-21 04:12:18 +09:00
Yu Watanabe 695c592a03 udev-config: allow to enable trace logging through kernel command line
This adds udev.trace[=BOOL] kernel command line option to control trace
logging.
2025-01-21 04:12:18 +09:00
Yu Watanabe b5a10b2127 udev-control: move setting of log level to manager_adjust_config()
No functional change, just refactoring.
2025-01-21 04:12:18 +09:00
Yu Watanabe 5c4fa7b9b2 integritysetup: use dispatch_verb() 2025-01-21 03:42:38 +09:00
Yu Watanabe 50c0f5de8f veritysetup: use dispatch_verb() 2025-01-21 03:42:38 +09:00
Yu Watanabe a0b1ee2fca cryptsetup: use dispatch_verb() 2025-01-21 03:42:38 +09:00
Yu Watanabe 13a3b59144 cryptsetup: drop doubled space 2025-01-21 03:42:38 +09:00
Yu Watanabe 7e21105002 cryptsetup: use mangle_none() at one more place 2025-01-21 03:42:34 +09:00
Yu Watanabe a8fe005209 tree-wide: drop merely used _cleanup_ macros, and introduce several new ones (#36071) 2025-01-21 03:41:27 +09:00
Yu Watanabe d919a155c0 udev-varlink: add io.systemd.service.GetEnvironment
There is no reason to not support the method in udevd.

Follow-up for c8127075ae.
2025-01-20 00:21:45 +09:00
Yu Watanabe 901bfcd8c1 tree-wide: rely on sd_varlink_dispatch() for validating zero-argument method calls, too
Follow-ups for a7cc7038ac.
2025-01-20 00:21:31 +09:00
Yu Watanabe 848cdf56dc udev,network: drop unnecessary check for result of sd_listen_fds_with_names() 2025-01-19 23:54:41 +09:00
Yu Watanabe a75abf1ab9 udev-manager: rework initialization of device monitor
Let's determine the socket for device monitor based on its name.
2025-01-19 23:54:41 +09:00
Yu Watanabe 4a2c33847f udev-ctrl: use -EBADF for invalid file descriptor 2025-01-19 23:54:41 +09:00
Yu Watanabe ac440e47c5 udev: split out legacy control socket handling to udev-manager-ctrl.c
Mostly no functional change, except for that now the socket for device
monitor is determined by its name.
2025-01-19 23:53:45 +09:00
Yu Watanabe 2cf9635511 capability-util: rename output argument of capability_gain_cap_setpcap() 2025-01-19 14:00:16 +00:00
Yu Watanabe ed8a737e08 core: use usec_add() at one more place
Follow-up for 8af1b296cb.
Fixes CID#1590317.
2025-01-19 10:31:50 +01:00
Yu Watanabe 22d3a3dd20 Tweaks to generic "io.systemd.service" Varlink interface, and hook it up in all long-running Varlink daemons (#35914) 2025-01-19 11:54:10 +09:00
Yu Watanabe bcc057aa1d pid1,nspawn: enable usrquota on /tmp/ + /dev/shm/ (#36036)
Split out of #36010.

This simply enables the "usrquota" mount option on the two dirs if they
are backed by tmpfs.

#36010 contains a test that actually verifies that the mount option does
its thing.
2025-01-19 11:51:54 +09:00
Yu Watanabe 3fb71599d0 tree-wide: coding style fixlets done by coccinelle (#36074) 2025-01-19 11:51:12 +09:00
Yu Watanabe 99de29945f tree-wide: coding style fixlets done by coccinelle 2025-01-19 08:28:42 +09:00
Yu Watanabe 62123950c6 coccinelle: add .gitignore for cache files 2025-01-19 08:27:47 +09:00
Yu Watanabe dadd182317 TODO: fix typo
Follow-up for fb8d46cffe.
2025-01-19 04:25:22 +09:00
Yu Watanabe f0159e2b5b process-util: fix typo
Also rebreak comment.

Follow-up for 03b89cf213.
2025-01-19 04:24:08 +09:00
Yu Watanabe 4d090126ed login: fix typo
Follow-up for a6ad410ffa.
2025-01-19 04:22:16 +09:00
Yu Watanabe 7eabb5ca61 boot: introduce _cleanup_strv_free_ 2025-01-19 04:18:04 +09:00
Yu Watanabe 6ea99fd2cf boot: introduce _cleanup_file_close_ 2025-01-19 04:15:27 +09:00
Yu Watanabe 892b734c1c selinux-util: drop _cleanup_context_free_
It is used at only one place, not necessary.
2025-01-19 04:09:55 +09:00
Yu Watanabe 43e95ddbf4 capability-util: drop _cleanup_cap_free_charp_
Also moves cap_free_charpp() to test-cap-list.c, as it is used only
there.
2025-01-19 04:04:47 +09:00
Yu Watanabe fe5a1afb67 tree-wide: use _cleanup_hashmap_free_ and friends 2025-01-19 03:48:15 +09:00
Yu Watanabe b4ffb77669 udev-rules: introduce OPTIONS="dump" token
Should be useful for debugging.
2025-01-19 03:09:06 +09:00
Yu Watanabe 91d9f8f834 udev-dump: split out dump_event() from udevadm-test.c 2025-01-19 03:07:18 +09:00
Yu Watanabe f55a6fc1e3 udev: add --verbose option for 'udevadm test' and add more verbose logs (#36021)
split out of #35968.
2025-01-18 06:12:31 +09:00
Yu Watanabe c547b9e278 udev-rules: add trace logs for GOTO and parent conditions 2025-01-18 04:22:27 +09:00
Yu Watanabe 354d063fbc udev-rules: update log messages
This also adds trace logs about token result, and skipping assignment
caused by final value already assigned.
2025-01-18 04:22:23 +09:00
Yu Watanabe 68b1e1b61a udev-rules: ignore whole command result if it is too long and does not contain newline 2025-01-18 04:19:52 +09:00
Yu Watanabe a79cd8c2be udev-rules: introduce udev_replace_chars_and_log()
And logs about replacement only when trace logging is enabled.
2025-01-18 04:19:52 +09:00
Yu Watanabe 0febeccfdc udev-rules: add more trace logs for string match 2025-01-18 04:19:52 +09:00
Yu Watanabe a3ab06ab21 udev-rules: logs result of format substitution
This also drops redundant token string in log message on truncation.

No functional change, but should improve debuggability.
2025-01-18 04:19:52 +09:00
Yu Watanabe 6809bae643 udev-rules: show original token string in log_event_error() and friends
This also makes
- make many loggers refactored,
- log_event_error() and friends UdevEvent object,
- introduces log_event_trace().

No functional change, just refactoring and preparation for later
commits.
2025-01-18 04:19:52 +09:00
Yu Watanabe 8846df63fa udevadm-test: introduce -v/--verbose option to show verbose log messages
Currently this does not show any extra log messages. In later commits,
more verbose log messages will be added.
2025-01-18 04:19:52 +09:00
Yu Watanabe dd5a0f7d75 README: update requirements 2025-01-16 20:55:44 +00:00
Yu Watanabe 9c881fa867 fundamental-macro: conditionalize several gcc warning pragmas
This fixes the following error:

In file included from ../src/basic/macro.h:13,
                 from ../src/basic/env-util.h:9,
                 from ../src/nss-systemd/nss-systemd.c:7:
../src/fundamental/macro-fundamental.h:61:9: error: option ‘-Wzero-as-null-pointer-constant’ is valid for C++/ObjC++ but not for C [-Werror=pragmas]
   61 |         _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
      |         ^~~~~~~
../src/nss-systemd/nss-systemd.c:106:1: note: in expansion of macro ‘DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT’
  106 | DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2025-01-17 04:35:09 +09:00
Yu Watanabe e722fe74ca random-util: fix compilation error
Fixes the following error:
```
../src/basic/random-util.c: In function "fallback_random_bytes":
../src/basic/random-util.c:45:26: error: initializer-string for array of "char" is too long [-Werror=unterminated-string-initialization]
   45 |                 .label = "systemd fallback random bytes v1",
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
2025-01-15 20:24:30 +01:00
Yu Watanabe b8980528c0 analyze: fix assignment of object_field
Prompted by #36000.
2025-01-16 03:34:11 +09:00
Yu Watanabe 7adf6ce3ca mkosi: disable multipathd by default
Hopefully fixes #36008.
2025-01-16 00:57:07 +09:00
Yu Watanabe 346ed75198 ptyfwd: fix wrong userdata passed to PTY forwarding
Fixes #35942.
2025-01-15 16:25:32 +01:00
Yu Watanabe 132a164d97 Follow-ups for recent namespace PRs (#35923) 2025-01-15 14:10:21 +09:00
Yu Watanabe 0363a45898 udev-rules: do not change maximum log level when running in test mode
When udev rules are being tested, log level specified by SYSTEMD_LOG_LEVEL=
environment variable should be honored, and should not be overridden by
the rules.
2025-01-15 11:50:22 +09:00
Yu Watanabe a75aeca78c udev-rules: replace 'type *func()' -> 'type* func()' 2025-01-15 11:48:11 +09:00
Yu Watanabe 22ca9406c4 udevadm-test: add missing oom check 2025-01-15 11:48:11 +09:00
Yu Watanabe ac27ee5fcb fmf: Move meson logs and failed test journals to test artifacts dir (#35939) 2025-01-10 14:57:57 +09:00
Yu Watanabe b3d75a3b8a hostname: use sd_device to acquire fallback chassis
This makes
- also cache sd_device for ACPI device.
- split fallback_chassis() into small pieces,
- use sd_device to reading sysfs attributes.

No functional change, just refactoring.
2025-01-09 09:57:34 +01:00
Yu Watanabe cdd53cb74b sd-device: make sd_device_new_from_path() accept relative path to device node
Even though udevadm accepts relative syspath, previously, udevadm
could not use relative path to device node:
===
$ cd /dev
$ udevadm info sda
Bad argument "sda", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument
$ udevadm info /usr/../dev/sda
Unknown device "/usr/../dev/sda": No such device
===
With this change, both the above cases work fine.

Note, still sd_device_new_from_devname() requires absolute path starts
with /dev/, for safety.
2025-01-09 09:57:19 +01:00
Yu Watanabe 844295b2bb udev/net: add PartialGenericSegmentationOffload= setting
Closes #32979.
2025-01-09 03:49:29 +09:00
Yu Watanabe ac24d356fe udev/net: add ReceiveFCS= and ReceiveAll= settings
Closes #31415.
2025-01-09 03:49:29 +09:00
Yu Watanabe 05db3fe7f9 ask-password: req must be non-NULL
After #35074, the parameter 'req' must be non-NULL.

Fixes CID#1586101, CID#1586102, and CID#1586103.
2025-01-07 13:12:08 +01:00
Yu WatanabeandDavid Tardon 2bc733d9b0 units: introduce systemd-udevd-varlink.socket
Co-authored-by: David Tardon <dtardon@redhat.com>
2025-01-07 20:31:15 +09:00
Yu Watanabe 3fed28b8cb udevadm: use varlink connection to send ping 2025-01-07 20:31:15 +09:00
Yu Watanabe 4e4c2fcfb6 udevadm-control: use varlink to send commands 2025-01-07 20:31:15 +09:00
Yu WatanabeandDavid Tardon 2f0aa9a804 udev-varlink: introduce io.systemd.Udev varlink interface
Co-authored-by: David Tardon <dtardon@redhat.com>
2025-01-07 20:31:15 +09:00
Yu Watanabe d5c4c4d45c TEST-17-UDEV: wait for udevd being restarted after exit control command
Also wait for created devices being processed before running tests.
2025-01-07 20:31:15 +09:00
Yu Watanabe 2bef5d187d machine: update log message and comments
Follow-up for 9af9d66184 and
453f2359ff.
2025-01-07 09:11:09 +01:00
Yu Watanabe 62e9cd6b09 basic/linux: update kernel headers from v6.13-rc6
This also removes README and moves the explanation about the header
modification to the script.
2025-01-06 23:35:14 +00:00
Yu Watanabe 220f7aac8c test-network: drop workaround for old CentOS release 2025-01-07 02:06:04 +09:00
Yu Watanabe 1761c35275 test-network: nowadays it runs not only on CentOS 2025-01-07 02:06:04 +09:00
Yu Watanabe 066e603ac6 meson: drop workaround for CentOS 8
CentOS 8 and RHEL 8 reached EOL.
2025-01-07 02:06:04 +09:00
Yu Watanabe 7a0c3923fe docs: replace link to RHEL7 document with RHEL9 documents 2025-01-07 02:05:16 +09:00
Yu Watanabe a88b0eb4e7 tools: drop workaround for CentOS 7 2025-01-07 02:05:12 +09:00
Yu Watanabe 37b87a1690 README: CentOS Stream 8 reached EOL 2025-01-07 01:21:13 +09:00
Yu Watanabe 0f6d800b9f sd-varlink: add flag for sd_varlink_server for creating connections w… (#35841)
…ith fd passing enabled

Let's add a simple flag that enables fd passing for all connections of a
server. It's much easier to use this than to install a connect handler
which manually enables this for each connection.
2025-01-06 22:13:50 +09:00
Yu Watanabe d5cdcba928 mkosi: replace deprecated settings and command with new ones
Follow-up for c008b70370.

These settings and command were deprecated by the following commit.
https://github.com/systemd/mkosi/commit/ebcd2efa03af5c04de91434634f2e4a956f7e53c
2025-01-06 12:00:43 +01:00
Yu Watanabe c192d87d83 machine: comment source and destination must be absolute
Addresses the post-merge review comment:
https://github.com/systemd/systemd/pull/35066#discussion_r1901841247
2025-01-06 17:14:26 +09:00
Yu Watanabe 8551ac2092 machine: use json_dispatch_const_path() where applicable
Follow-up for #35066 and 3866e9ce9d.
2025-01-06 17:09:43 +09:00
Yu Watanabe 5eec51a6c1 packit: Move fmf metadata into upstream (#35700)
This moves https://src.fedoraproject.org/tests/systemd into upstream so
it's one less moving piece that we need to remember.
2025-01-06 10:37:56 +09:00
Yu Watanabe 3328d1e181 sd-device: fix validation for devices under /sys/firmware/ in sd_device_new_from_subsystem_sysname()
Devices under /sys/firmware/ do not have subsystems. Hence, the
validation in sd_device_new_from_subsystem_sysname() ->
device_new_from_path_join() always failed.

Fixes a bug introduced by cd7c71154c (v257).
Fixes #35861.
2025-01-05 03:52:05 +09:00
Yu Watanabe 7e5238625e sd-device: add missing debugging log
It was unexpectedly dropped by 660087dc9c.
2025-01-05 03:09:57 +09:00
Yu Watanabe be68dcdc20 firewall-util: allow to override the table and map names through env var
Then, use test specific names to make the test not conflict with
networkd.

Hopefully fixes #35526.
2025-01-05 01:48:29 +09:00
Yu Watanabe 12f77fe058 hostname: read hardware serial from device tree (#35797)
Closes #35792.
2025-01-05 01:46:58 +09:00
Yu Watanabe 1775337a36 namespace-util: refuse remote pidref in pidref_namespace_open() 2025-01-04 17:07:59 +01:00
Yu Watanabe 573e8fc217 ptyfwd: fix typo
Follow-up for 8224a48da9.
2025-01-04 23:46:57 +09:00
Yu Watanabe ffe2923303 sd-varlink: introduce sd_varlink_get_current_method() 2025-01-04 23:33:09 +09:00
Yu Watanabe 8252b74f2d varlink: add comments for io.systemd.service interface 2025-01-04 23:17:47 +09:00
Yu Watanabe 04b09924b2 udev: split on_ctrl_msg() into small pieces (#35736) 2025-01-04 23:17:17 +09:00
Yu Watanabe 2da8da32b0 varlink: several cleanups for io.systemd.service interface (#35733) 2025-01-04 23:17:03 +09:00
Yu Watanabe 3e91aed6c4 hostname: also read serial number from device tree
This makes hostnamed try to read hardware serial number from
/proc/device-tree/serial-number.

Closes #35792.
2025-01-04 22:29:01 +09:00
Yu Watanabe c1507748c6 hostname: cache sd-device object for DMI
Also, always check if the obtained string is safe for passing through
DBus.
Just refactoring and preparation for later change.
2025-01-04 22:28:31 +09:00
Yu Watanabe bbb0dbe6b1 udev-ctrl: refuse ENV control message with invalid environment assignment
Previously, udevd accepts an arbitrary pair of key and value.
Let's make the environment variable assignment more strict for safety.

Note, we already refuse environment variables with the same way in
net/link-config.c.
2025-01-04 21:54:40 +09:00
Yu Watanabe 4c547d216a udev: introduce udev_property_name_is_valid() and friends 2025-01-04 21:54:40 +09:00
Yu Watanabe b358833ee9 udev-config: split on_ctrl_msg() into small pieces
No functional change, just refactroing and preparation for later
commits.
2025-01-04 21:54:40 +09:00
Yu Watanabe 4ea611b8a4 varlink: invert uid check to reduce call of getuid() 2025-01-04 20:57:06 +09:00
Yu Watanabe 93081be64b sd-json: introduce json_dispatch_log_level()
Then, use it in io.systemd.service.SetLogLevel method.
2025-01-04 20:57:06 +09:00
Yu Watanabe c10fbe2cf8 libsystemd: drop duplicated symbol
Follow-up for 107986a33e.
2025-01-04 09:28:14 +01:00
Yu Watanabe 37a393b99e sd-json,sd-varlink: trivial coding style fixlets 2025-01-04 13:20:50 +09:00
Yu Watanabe c882735596 sd-json: replace ASSERT_PTR() with assert_return() in public functions 2025-01-04 13:10:38 +09:00
Yu Watanabe aac9d150ed tpm2: tweaks to PCR mask parsing (#35835) 2025-01-04 12:42:54 +09:00