1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-13 00:58:27 +03:00

79054 Commits

Author SHA1 Message Date
Lennart Poettering
d58d449fc6 test: add test case for tmpfs quota logic + PAMName= ask-password logic 2025-01-23 22:36:39 +01:00
Lennart Poettering
2b2aebf4dd homectl: add support for configuring tmpfs limits 2025-01-23 22:36:39 +01:00
Lennart Poettering
b1c95fb2e9 user-runtime-dir: enforce /tmp/ and /dev/shm/ quota
Enforce the quota on these two tmpfs at the same place where we mount
the per-user $XDG_RUNTIME_DIR. Conceptually these are very similar
concepts, and it makes sure to enforce the limits at the same place with
the same lifecycle.
2025-01-23 22:36:39 +01:00
Lennart Poettering
9ef12bc1d7 user-runtime-dir: some smaller modernizations/refactorings 2025-01-23 22:36:28 +01:00
Lennart Poettering
72b932aac0 user-record: add fields for setting limits on /tmp/ and /dev/shm/ 2025-01-23 22:16:24 +01:00
Lennart Poettering
d15811d7e5 devnum-util: add macros to safely convert dev_t to pointers and back
Sometimes it's nice being able to store dev_t as pointer values in
hashmaps/tables, instead of having to allocate memory for them and using
devt_hash_ops. After all dev_t is weird on Linux/glibc: glibc defines it
as 64bit entity (which hence appears as something we cannot encode in a
pointer value for compat with 32bit archs) but it actually is 32bit in
the kernel apis. Hence we can safely cut off the upper 32bit, and still
retain compat with all archs.

But let's hide this in new macros, and validate this is all correct via
a test.
2025-01-23 22:16:24 +01:00
Lennart Poettering
16ea491528 docs: mention the two other userdb services we ship these days 2025-01-23 21:13:41 +01:00
Yu Watanabe
544a67c8f7
udev-rules: check OWNER/GROUP= setting more strictly (#36123)
- refuses lines with unknown or invalid user/group,
- refuses non-system user/group in the setting.
2025-01-24 05:09:39 +09:00
Mike Yuan
0dc1716854 creds: permit interactive polkit auth when encrypting/decrypting through IPC 2025-01-24 05:08:12 +09:00
Mike Yuan
f3ba767d6c core/job: fix typo 2025-01-24 05:08:12 +09:00
Yu Watanabe
7e6786b7fb NEWS: mention OWNER=/GROUP= in udev rules now refuses non-system user/group 2025-01-24 02:33:18 +09:00
Yu Watanabe
02ec3dd4ef test: add test cases for OWNER=/GROUP= with non-system user/group 2025-01-24 02:33:18 +09:00
Yu Watanabe
f5cdf9515a udev-rules: ignore non-system user/group in OWNER=/GROUP=
Recently, we introduce 'clock' system group, and set it for rtc/ptp
devices. See af96ccfc24bc4803078a46b4ef2cdeb5decdfbcd.

However, if non-system group with the same name is already exist,
previously the devices were owned by the non-system group. That may
possibly happen on updating systemd.

Let's avoid accidentally devices being owned by non-system user/group.
2025-01-24 02:33:18 +09:00
Yu Watanabe
a1ee55e3c9 udev-rules: ignore OWNER=/GROUP= with unknown user/group
Previously, when an unknown or invalid user/group is specified,
a token was installed with UID_INVALID/GID_INVALID. That's not only
meaningless in most cases, but also clears previous assignment,
if multiple OWNER=/GROUP= token exist for the same device, e.g.

KERNEL=="sda", GROUP="disk"
KERNEL=="sda", GROUP="nonexistentuser"

This makes when an unknown user/group is specified, the line will be
ignored. Hence, in the above example, the device will be owned by the
group "disk".
2025-01-24 02:33:18 +09:00
Yu Watanabe
e89eaeb027 udev-rules: get_user_creds()/get_group_creds() return -ESRCH when user/group does not exist
This drops -ENOENT error check for get_user_creds()/get_group_creds(),
as nowadays they always return -ESRCH when the specified user/groups
cannot be found.

This also adds short comments for NULL arguments.
2025-01-24 02:33:18 +09:00
Lennart Poettering
3e7910829e
units: modprobe@.service tweaks (#36132) 2025-01-23 18:18:10 +01:00
Yu Watanabe
b7622cbab6
sd-device: chase sysattr and refuse to read/write outside of sysfs (#36004) 2025-01-24 01:58:19 +09:00
Yu Watanabe
e7fdc7644f
udevadm: introduce cat command to show udev rules (#35893)
Closes #35818.
2025-01-24 01:49:42 +09:00
Lennart Poettering
71b6f718e2 units: don't load squasfs/erofs kmods explicitly
File system modules should be something the kernel can autoload
automatically, and according to my testing that works fine, hence let's
drop the explicit deps, in particular as systems usually stick to one fs
for these things, not both.

I inquired bluca about the reason to add it, and didn't remember
anymore, and was fine with me removing this. So let's remove this for
now, should issues arise we can revert this.
2025-01-23 16:29:28 +01:00
Lennart Poettering
6f69568cff units: mountfsd needs to pull DM and loop kmods
mountfsd is supposed to be available during early boot aleady, before
systemd-tmpfiles-setup-dev-early.service completes, hence make sure
loopback devices and DM already work before that.

As suggested by yuwata here:

https://github.com/systemd/systemd/pull/35685#issuecomment-2608157569
2025-01-23 16:29:22 +01:00
Lennart Poettering
9fc2126386 units: add a longer comment to modprobe@.service explaining when to use it 2025-01-23 16:29:20 +01:00
Yu Watanabe
1fe5b06363 sd-device: use device_in_subsystem() at more places 2025-01-23 22:54:11 +09:00
Yu Watanabe
640f8e9c4d sd-device: use specific setters for read entries from uevent file
Previously, if e.g. DRIVER=foo is specified in uevent file, the value is
only saved as property, but was not set to sd_device.driver.
That was inconsistent to the case when a device is created through
netlink uevent.

Let's always set when we get e.g. sd_device.driver when DRIVER=foo
from both uevent file and netlink uevent.
2025-01-23 22:54:11 +09:00
Yu Watanabe
17dc9ec4b6 sd-device: use sd_device_get_sysattr_value() to read uevent file
This also replaces the custom parser with strv_split_newlines_full().
No functional change, just refactoring.
2025-01-23 22:54:11 +09:00
Yu Watanabe
6ebbdcc0dd sd-device: use sd_device_get_sysattr_value() to read special symlinks
Then, cached result may be used. No functional change, just refactoring.
2025-01-23 22:54:11 +09:00
Yu Watanabe
8d89667aba sd-device: chase sysattr and refuse to read/write files outside of sysfs
This makes sd_device_get_sysattr_value()/sd_device_set_sysattr_value()
refuse to read/write files outside of sysfs for safety.

Also this makes
- use chase() to resolve and open the symlink in path to sysfs attribute,
- use delete_trailing_chars(),
- include error code in cache entry, so we can cache more error cases,
- refuse caching value written to uevent file of any devices, i.e.
  sd_device_set_sysattr_value(dev, "../uevent", "add") will also not
  cache the value "add".
2025-01-23 22:54:11 +09:00
Yu Watanabe
06503dd0df fileio: make read_virtual_file_at() accept O_PATH file descriptor
Then, merge read_virtual_file_at() and read_virtual_file_fd(), and make
the latter inline.
2025-01-23 22:54:07 +09:00
Yu Watanabe
f3c5c2b001 fileio: make write_string_file_at() accept O_PATH fd and an empty filename
Then, introduce an inline wrapper write_string_file_fd().
2025-01-23 22:53:05 +09:00
Yu Watanabe
9e096259ce fileio: fix verification on failure in write_string_file_full()
Fixes a bug introduced by 0ab5e2a4b4f5d435cb66b591ef5c700894663fd3.
2025-01-23 22:24:19 +09:00
Yu Watanabe
7f2175eabb udevadm: introduce cat command
This introduces 'udevadm cat' command, that shows udev rules files or
udev.conf, which may be useful for debugging.

Closes #35818.
2025-01-23 22:23:45 +09:00
Yu Watanabe
bbe1ba5e87 bash-completion/udevadm-verify: suggest found udev rules files
This also fixes the issue that no suggestion is provided after a standalone
option is specified.
2025-01-23 22:23:45 +09:00
Yu Watanabe
7cb4508c5a udevadm-verify: chase specified paths
Also, when a filename is specified, also search udev rules file in
udev/rules.d directories.

This also refuses non-existing files, and file neither nor a regular
nor a directory, e.g. /dev/null.
2025-01-23 22:23:45 +09:00
Yu Watanabe
8e0f023548 udev-rules: log the first line number when continued 2025-01-23 22:23:45 +09:00
Yu Watanabe
86a08e70a8 udev: sort builtins
Then, 'udevadm test-builtin --help' lists builtins alphabetically.
2025-01-23 22:23:45 +09:00
Yu Watanabe
c3d526d765 shell-completion/udevadm: add net_driver
Follow-up for 2b5b25f123ceb89b3ff45b2380db1c8a88b046d9.
2025-01-23 22:23:45 +09:00
Yu Watanabe
eb86b4e63b
tree-wide: use hash ops with destructor (#36107) 2025-01-23 22:20:42 +09:00
Daan De Meyer
6733b07d43 mkosi: Add back --preserve-env when running integrationt tests
The test wrapper script depends on various github actions environment
variables so let's make sure those are propagated.
2025-01-23 12:18:21 +01:00
Yu Watanabe
38f7edd9d3 hashmap: drop hashmap_free_free() and friends 2025-01-23 18:22:53 +09:00
Yu Watanabe
58f0cd14a0 test: use hash ops with destructor 2025-01-23 18:22:53 +09:00
Yu Watanabe
06835cb397 remount-fs: use hash ops with destructor 2025-01-23 18:22:53 +09:00
Yu Watanabe
60cc858e9d exec-util: use hash ops with destructor 2025-01-23 18:22:52 +09:00
Yu Watanabe
04b7949ecf network: use hash ops with destructor 2025-01-23 18:22:47 +09:00
Yu Watanabe
938a6b49bd sd-journal: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe
2d23cadd19 journal-file: use hash ops with destructor
This also makes JournalFile.chain_cache allocated when necessary.
2025-01-23 18:19:28 +09:00
Yu Watanabe
b87501ea3c sd-bus: use hash ops with destructor
This also makes vtable_methods and vtable_properties managed by Set,
as the key and value of each entry are equivalent.
2025-01-23 18:19:28 +09:00
Yu Watanabe
4516022833 delta: use hash ops with destructor
This also makes it use RET_GATHER().
2025-01-23 18:19:28 +09:00
Yu Watanabe
c1bfee0bdb bootctl: use hash ops with destructor
This also makes the hashmap allocated when necessary.
2025-01-23 18:19:28 +09:00
Yu Watanabe
852c05c94f catalog: modernize code
- set destructors to catalog_hash_ops,
- acquire OrderedHashmap when necessary,
- gracefully handle NULL catalog directories and output stream,
- rename function output arguments,
- add many many assertions,
- use RET_GATHER().
2025-01-23 18:19:28 +09:00
Yu Watanabe
12006a7233 wait-online: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe
a22620e39f udev: use hash ops with destructor 2025-01-23 18:19:28 +09:00