]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
9 months agogetty-generator: port to get_kernel_consoles() 36171/head
Mike Yuan [Sat, 25 Jan 2025 19:42:58 +0000 (20:42 +0100)] 
getty-generator: port to get_kernel_consoles()

9 months agogetty-generator: use generator_add_symlink() where appropriate
Mike Yuan [Sat, 25 Jan 2025 19:58:47 +0000 (20:58 +0100)] 
getty-generator: use generator_add_symlink() where appropriate

9 months agotty-ask-password-agent: do not needlessly spawn subprocesses if there's only one...
Mike Yuan [Sat, 25 Jan 2025 19:30:10 +0000 (20:30 +0100)] 
tty-ask-password-agent: do not needlessly spawn subprocesses if there's only one console

9 months agoterminal-util: make get_kernel_consoles() return > 0 if /dev/console is resolved
Mike Yuan [Sat, 25 Jan 2025 19:19:26 +0000 (20:19 +0100)] 
terminal-util: make get_kernel_consoles() return > 0 if /dev/console is resolved

9 months agologin/pam_systemd: drop redundant vtnr == 0 handling
Mike Yuan [Sat, 25 Jan 2025 21:32:16 +0000 (22:32 +0100)] 
login/pam_systemd: drop redundant vtnr == 0 handling

vtnr_from_tty() treats 0 as invalid.

9 months agoterminal-util: stop doing 0/upper bound check in tty_is_vc()
Mike Yuan [Sun, 26 Jan 2025 00:32:42 +0000 (01:32 +0100)] 
terminal-util: stop doing 0/upper bound check in tty_is_vc()

tty_is_vc() is more often than not used for simple "categorization"
than validity check. E.g. in logind, we first recognize the tty
"looks like vc", and then use vtnr_from_tty() where range check
is performed and vtnr is extracted. In such cases, we want to reject
invalid vtnr from clients rather than silently carry on, hence
let's remove bound check in tty_is_vc().

Fixes #36166
Replaces #36167 and #36175

9 months agonetwork: fix offset of preference in backward compat option
Yu Watanabe [Sun, 26 Jan 2025 00:41:25 +0000 (09:41 +0900)] 
network: fix offset of preference in backward compat option

Fixes a bug introduced by a10d6e0124bb6e202baef9170b019e2e6a7af1fd.

Fixes oss-fuzz#391916479 (https://issues.oss-fuzz.com/issues/391916479).
Fixes #36172.

9 months agoboot: Improve log message
Daan De Meyer [Sat, 25 Jan 2025 19:42:54 +0000 (20:42 +0100)] 
boot: Improve log message

9 months agoAdd loong64 as an option in a few more places (#36163)
Yu Watanabe [Sun, 26 Jan 2025 00:35:42 +0000 (09:35 +0900)] 
Add loong64 as an option in a few more places (#36163)

9 months agoresolved: do not disable mdns/llmnr globally if it's enabled on any link (#36158)
Luca Boccassi [Sat, 25 Jan 2025 10:49:44 +0000 (10:49 +0000)] 
resolved: do not disable mdns/llmnr globally if it's enabled on any link (#36158)

Fixes a regression caused by 2976730a4d34749bfb7a88da341464f1834ab1c6.
Fixes #36078.
Fixes #36126.

Replaces #36153.
Replaces #36156.

9 months agotools: add loongarch64 to debug-sd-boot script 36163/head
Luca Boccassi [Sat, 25 Jan 2025 01:20:47 +0000 (01:20 +0000)] 
tools: add loongarch64 to debug-sd-boot script

9 months agoukify: add riscv32 to --efi-arch
Luca Boccassi [Sat, 25 Jan 2025 01:25:28 +0000 (01:25 +0000)] 
ukify: add riscv32 to --efi-arch

It is supported in the arch mapping at the top and in elf2efi, so add it here too

9 months agoukify: add loongarch64 to --efi-arch
Luca Boccassi [Sat, 25 Jan 2025 01:19:53 +0000 (01:19 +0000)] 
ukify: add loongarch64 to --efi-arch

9 months agoresolved: stop mdns/llmnr if no interface request it after bus method 36158/head
Yu Watanabe [Fri, 24 Jan 2025 19:48:00 +0000 (04:48 +0900)] 
resolved: stop mdns/llmnr if no interface request it after bus method

9 months agoresolved: do not disable mdns/llmnr globally if it's enabled on any link
Yu Watanabe [Fri, 24 Jan 2025 19:48:00 +0000 (04:48 +0900)] 
resolved: do not disable mdns/llmnr globally if it's enabled on any link

Fixes a regression caused by 2976730a4d34749bfb7a88da341464f1834ab1c6.

Fixes #36078.
Fixes #36126.

Co-authored-by: Luca Boccassi <luca.boccassi@gmail.com>
9 months agoman: fix reference to non-existing ukify parameter
Luca Boccassi [Fri, 24 Jan 2025 23:37:33 +0000 (23:37 +0000)] 
man: fix reference to non-existing ukify parameter

The --extend parameter was removed by https://github.com/systemd/systemd/pull/34608
and a --join-profile was added instead, fix leftover reference in manpage

Follow-up for 3891d57c4f768cb648e1a85483216eadae0b101e

9 months agohomed: when setting up an idmapping map foreign UID range on itself
Lennart Poettering [Fri, 24 Jan 2025 15:54:05 +0000 (16:54 +0100)] 
homed: when setting up an idmapping map foreign UID range on itself

Now that nspawn can run unprivileged off directory trees owned by
the new "foreign" UID range let's make sure homed actually allows
files owned by that range in the home directories.

This is not enough to make nspawn just work in homed home dirs
unfortunately though. that's because homed applies an idmapping, and
nspawn would need to then to take that idmapped mount and apply another
one, and the kernel simply doesn't support stacked idmapped mounts.
There's work ongoing to address that in the kernel.

However, this is a first step, and should be enough to make things just
work should the kernel eventually support stacked idmapped mounts.

9 months agosd-json: silence false positive warning by coverity
Yu Watanabe [Fri, 24 Jan 2025 13:53:13 +0000 (22:53 +0900)] 
sd-json: silence false positive warning by coverity

An object json is a set of key and value pair, hence has its number of
element is multiple of two, and we know at least two elements there.

Follow-up for b6a2df630701de0bcf77850ced213d7fc3d0c4de.
Fixes CID#1590724

9 months agodelta: cleanup coding style and add missing error check (#36146)
Yu Watanabe [Fri, 24 Jan 2025 20:30:58 +0000 (05:30 +0900)] 
delta: cleanup coding style and add missing error check (#36146)

9 months agoudev-rules: use sd_device_set_sysattr_value() to write sysfs attribute (#36142)
Yu Watanabe [Fri, 24 Jan 2025 20:30:21 +0000 (05:30 +0900)] 
udev-rules: use sd_device_set_sysattr_value() to write sysfs attribute (#36142)

Then, we can avoid that files outside of sysfs are written by udev ATTR
key.

9 months agotree-wide: insert a space at the end of comments
Yu Watanabe [Fri, 24 Jan 2025 20:16:27 +0000 (05:16 +0900)] 
tree-wide: insert a space at the end of comments

9 months agoTwo HACKING.md improvements (#36152)
Daan De Meyer [Fri, 24 Jan 2025 17:12:10 +0000 (18:12 +0100)] 
Two HACKING.md improvements (#36152)

9 months agoHACKING: Drop run0 from mkosi boot invocation 36152/head
Daan De Meyer [Fri, 24 Jan 2025 16:29:58 +0000 (17:29 +0100)] 
HACKING: Drop run0 from mkosi boot invocation

mkosi will itself use run0 or sudo when not running as root to invoke
systemd-nspawn, so no need to do it in HACKING.md.

9 months agoHACKING: Move OBS section further down
Daan De Meyer [Fri, 24 Jan 2025 16:28:15 +0000 (17:28 +0100)] 
HACKING: Move OBS section further down

HACKING.md should first and foremost tell someone how to hack on
systemd, installing packages from OBS isn't the most likely section
a new contributor will be interested in, so let's move it further
down.

9 months agoudev-rules: use sd_device_set_sysattr_value() to write sysfs attribute 36142/head
Yu Watanabe [Sat, 11 Jan 2025 23:22:53 +0000 (08:22 +0900)] 
udev-rules: use sd_device_set_sysattr_value() to write sysfs attribute

Then, we can avoid that files outside of sysfs are written by udev ATTR key.

This also makes
- logs failure in udev_resolve_subsys_kernel(),
- failure in sd_device_get_syspath() critical, as that should not happen,
- cache the value to be write when running on test mode, to make it
  shown by OPTIONS="dump" or obtained by ATTR match token.

9 months agosd-device: move the check if sysattr entry should be cached into device_cache_sysattr...
Yu Watanabe [Fri, 24 Jan 2025 14:58:02 +0000 (23:58 +0900)] 
sd-device: move the check if sysattr entry should be cached into device_cache_sysattr_value()

No functional change. Preparation for the next commit.

9 months agosd-device: make device_get_cached_sysattr_value() static
Yu Watanabe [Fri, 24 Jan 2025 14:47:44 +0000 (23:47 +0900)] 
sd-device: make device_get_cached_sysattr_value() static

9 months agohomectl: minor man page improvements (#36148)
Lennart Poettering [Fri, 24 Jan 2025 14:32:27 +0000 (15:32 +0100)] 
homectl: minor man page improvements (#36148)

9 months agohomectl: move --umask=/--access-mode= help/man sections 36148/head
Lennart Poettering [Fri, 24 Jan 2025 12:34:16 +0000 (13:34 +0100)] 
homectl: move --umask=/--access-mode= help/man sections

These don't really have much to do about resource mgmt, but are more
about security, hence let's move them away from the resource mgmt
section.

9 months agoman: add some sections to homectl man page
Lennart Poettering [Fri, 24 Jan 2025 12:31:51 +0000 (13:31 +0100)] 
man: add some sections to homectl man page

This adds the same sections we already have in the homectl --help blurb
also to the man page.

While we are at it, let's also add a new section for Authentication
related switches.

9 months agodelta: add missing error check 36146/head
Yu Watanabe [Fri, 24 Jan 2025 13:46:55 +0000 (22:46 +0900)] 
delta: add missing error check

Fixes CID#1590726.

9 months agodelta: use r for storing error code
Yu Watanabe [Fri, 24 Jan 2025 13:46:35 +0000 (22:46 +0900)] 
delta: use r for storing error code

9 months agomkosi: update debian commit reference
Luca Boccassi [Fri, 24 Jan 2025 12:09:52 +0000 (12:09 +0000)] 
mkosi: update debian commit reference

4447d2974d Update changelog for 257.2-3 release
4b1c65b905 libudev1: add udeb back to shlibs
1974e3d06e systemd-boot: always check that the boot entry is set, even with Shim is already installed
9a5eea9823 systemd-boot: use boot entry argument instead of installing as grub.efi on ESP
df6efeed46 libsystemd-dev/libudev-dev: depend on libcap-dev
5673b771e1 signing template: add override for executable-not-elf-or-script
3f109637c4 Update changelog for 257.2-2 release
42f4afa605 Drop udeb packages
c04f7f2b16 signing template: always set urgency to 'high'
9bd8b5228b Set SBAT info for upstream build
257ba8563b udev: link to libsystemd-shared when building with noudeb profile
8ca2b26678 Link systemctl against libsystemd-shared
1a4a8af0c2 Install jq for pkg.systemd.upstream too since the template packages are now built
6fd0d2698d signing template: fix Lintian warnings and errors
c79d10bbaa Build template packages for pkg.systemd.upstream profile, for OBS builds
485a867438 d/t/upstream: take into account autopkgtest pinning
c1b6e565e3 Update README.source in the signing-template
17d1b92d9f d/t/control: remove 'flaky' from tests-in-lxd
2a36f6f5e1 Do not install sd-resolved and drop breaks-testbed from fast tests
a3cb52f8d0 Enable UEFI on loong64
ad7a943023 Enable libseccomp on loong64 and hppa
9d24f84ed5 Update changelog for 257.2-1 release
f47619c9f4 Drop all patches, merged upstream
d4aa6545a6 Install new files for upstream CI
5775daa46e d/rules: support building in OBS from git

9 months agosd-device: fix typo
Yu Watanabe [Fri, 24 Jan 2025 13:13:00 +0000 (22:13 +0900)] 
sd-device: fix typo

Follow-up for 8d89667abaa8b569c2ac9e37752c404cebdfaaaa.

9 months agomntfsd: fix typo
Yu Watanabe [Fri, 24 Jan 2025 13:12:01 +0000 (22:12 +0900)] 
mntfsd: fix typo

Follow-up for d6f8e1ae879ed1676406b61b6f4dba1bdd3749ae.

9 months agopam_systemd: fix typo
Yu Watanabe [Fri, 24 Jan 2025 13:10:33 +0000 (22:10 +0900)] 
pam_systemd: fix typo

Follow-up for 30de5691744781277f992a25afa268518f3fe711.

9 months agostrv: fix typo
Yu Watanabe [Fri, 24 Jan 2025 13:08:53 +0000 (22:08 +0900)] 
strv: fix typo

Follow-up for 5072f4268b89a71e47e59c434da0222f722c7f0e.

9 months agoEnforce per-user quota on /tmp/ and /dev/shm/ as user logs in (#36010)
Lennart Poettering [Fri, 24 Jan 2025 11:52:27 +0000 (12:52 +0100)] 
Enforce per-user quota on /tmp/ and /dev/shm/ as user logs in (#36010)

There's finally quota on tmpfs, hence let's use it to make it harder for
users to DoS the system by consuming all disk space in /tmp/ and
/dev/shm/.

This enforces a default limit of 80% quota of the backing fs for these
two dirs for users, but this can be overriden in the user record, if
desired.

This also adds two other interesting features:

1. mount units gain GracefulOptions= which takes optional mount options
that are added only if supported by the kernel. (this is used to enable
usrquota on /tmp/, if available.)
2. The PAM logic in service management now supports reading passwords
from service credentials and via the askpw logic. This used for make
testing easy (so that we can run0 into a homed user which strictly
requires a password).

9 months agomkosi: Drop usage of _systemd_QUIET in arch build script
Daan De Meyer [Fri, 24 Jan 2025 09:54:51 +0000 (10:54 +0100)] 
mkosi: Drop usage of _systemd_QUIET in arch build script

We dropped the variable in the packaging specs for Arch to keep the
integration points as minimal as possible so let's stop using it in
the build script as well.

9 months agotest: split VM-only subtests from TEST-74-AUX-UTILS to new VM-only test
Luca Boccassi [Thu, 21 Nov 2024 09:51:14 +0000 (09:51 +0000)] 
test: split VM-only subtests from TEST-74-AUX-UTILS to new VM-only test

TEST-74-AUX-UTILS covers many subtests, as it's a catch-all job, and a few
need a VM to run. The job is thus marked VM-only. But that means in settings
where we can't run VM tests (no KVM available), the entire thing is skipped,
losing tons of coverage that doesn't need skipping.

Move the VM-only subtests to TEST-87-AUX-UTILS-VM that is configured to only
run in VMs under both runners. This way we keep the existing tests as-is, and
we can add new VM-only tests without worrying. This is how the rest of the
tests are organized.

Follow-up for f4faac20730cbb339ae05ed6e20da687a2868e76

9 months agonspawn: support unpriv directory-tree containers (#35685)
Lennart Poettering [Thu, 23 Jan 2025 22:34:37 +0000 (23:34 +0100)] 
nspawn: support unpriv directory-tree containers (#35685)

So far nspawn supported unpriv containers only if backed by a DDI. This
adds dir-based unpriv containers too.

To make this work this introduces a new UID concept to systemd: the
"foreign UID range". This is a high UID range of size 64K. The idea is
that disk images that are "foreign" to the local system can use that,
and when a container or similar is invoked from it, a transiently
allocated dynamic UID range is mapped from that foreign UID range via id
mapped mounts.

This means the fully dynamic, transient UID ranges never hit the disk,
which should vastly simplify management, and does not require that uid
"subranges" are persistently delegated to any users.

The mountfsd daemon gained a new method call for acquiring an idmapped
mount fd for an mount tree owned by the foreign UID range. Access is
permitted to unpriv clients – as long as the referenced inode is located
within a dir owned by client's own uid range.

9 months agoThree minor refactorings for userdb code (#36141)
Lennart Poettering [Thu, 23 Jan 2025 22:04:48 +0000 (23:04 +0100)] 
Three minor refactorings for userdb code (#36141)

Nothing earth shattering, but some minor refactorings split out of and
preparation for #36133

9 months agosd-varlink/sd-json: add two new API calls (#36137)
Lennart Poettering [Thu, 23 Jan 2025 21:40:19 +0000 (22:40 +0100)] 
sd-varlink/sd-json: add two new API calls (#36137)

These are kinda no-brainers, should have always existed.

Split out of #36133 which needs them.

9 months agoupdate TODO 36010/head
Lennart Poettering [Wed, 15 Jan 2025 08:44:52 +0000 (09:44 +0100)] 
update TODO

9 months agotest: add test case for tmpfs quota logic + PAMName= ask-password logic
Lennart Poettering [Tue, 14 Jan 2025 23:25:22 +0000 (00:25 +0100)] 
test: add test case for tmpfs quota logic + PAMName= ask-password logic

9 months agohomectl: add support for configuring tmpfs limits
Lennart Poettering [Fri, 10 Jan 2025 14:31:44 +0000 (15:31 +0100)] 
homectl: add support for configuring tmpfs limits

9 months agouser-runtime-dir: enforce /tmp/ and /dev/shm/ quota
Lennart Poettering [Fri, 10 Jan 2025 10:34:18 +0000 (11:34 +0100)] 
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.

9 months agouser-runtime-dir: some smaller modernizations/refactorings
Lennart Poettering [Thu, 23 Jan 2025 21:30:41 +0000 (22:30 +0100)] 
user-runtime-dir: some smaller modernizations/refactorings

9 months agouser-record: add fields for setting limits on /tmp/ and /dev/shm/
Lennart Poettering [Fri, 10 Jan 2025 10:33:59 +0000 (11:33 +0100)] 
user-record: add fields for setting limits on /tmp/ and /dev/shm/

9 months agodevnum-util: add macros to safely convert dev_t to pointers and back
Lennart Poettering [Thu, 23 Jan 2025 10:40:36 +0000 (11:40 +0100)] 
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.

9 months agoupdate TODO 35685/head
Lennart Poettering [Tue, 12 Nov 2024 08:43:32 +0000 (09:43 +0100)] 
update TODO

9 months agotest: test comprehensive tests for new (and old) nspawn userns modes
Lennart Poettering [Mon, 25 Nov 2024 14:01:00 +0000 (15:01 +0100)] 
test: test comprehensive tests for new (and old) nspawn userns modes

9 months agoman: document new nspawn functionality around unpriv support
Lennart Poettering [Mon, 25 Nov 2024 13:51:32 +0000 (14:51 +0100)] 
man: document new nspawn functionality around unpriv support

9 months agonspawn: add support for 'managed' userns mode even when we run privileged
Lennart Poettering [Mon, 25 Nov 2024 11:20:13 +0000 (12:20 +0100)] 
nspawn: add support for 'managed' userns mode even when we run privileged

So far, we supported two modes:

1. when running unpriv we'd get the mounts from mountfsd, and the userns
   from nsresourced
2. when running priv we'd do the mounts/userns ourselves

This untangles this a bit, so that we can also use mountfsd/nsresourced
when running privilged.

I think this is generally a bit nicer, and probably something we should
switch to entirely one day, as it reduces the variety of codepaths.

With this patch the default behaviour remains unchanged, but by
selecting the new "managed" option for --private-users= the codepaths
via mountfsd/nsresourced can be explicitly requested even when running
with privs.

This is mostly just reworks that we check for arg_userns_mode !=
USER_NAMESPACE_MANAGED rather than arg_privileged for a number of
codepaths, but requires more fixes, too. The devil is in the details.

9 months agonspawn: support foreign mappings also when nspawn doing the mapping itself
Lennart Poettering [Wed, 13 Nov 2024 11:13:30 +0000 (12:13 +0100)] 
nspawn: support foreign mappings also when nspawn doing the mapping itself

This adds a new "foreign" value to --private-users-ownership= which is a
lot like "map", but maps from the host's foreign UID range rather than from the
host's 0.

(This has nothing much to do with making unprivileged directory-based
containers work, it's just very handy that we can run privileged
contains with such a mapping too, with an easy switch)

9 months agonspawn: allow to run unpriv from dir
Lennart Poettering [Mon, 11 Nov 2024 16:09:06 +0000 (17:09 +0100)] 
nspawn: allow to run unpriv from dir

This simply calls into mountfsd to acquire the root mount and uses it as
root for the container.

Note that this also makes one more change: previously we ran containers
directory off their backing directory. Except when we didn't, and there
were a variety of exceptions: if we had no privs, if we ran off a disk
image, if the directory was the host's root dir, and some others.

This simplifies the logic a bit: we now simply always create a temporary
directory in /tmp/ and bind mount everything there, in all code paths.
This simplifies our code a bit. After all, in order to control
propagation we need to turn the root into a mount point anyway, hence we
might just do it at one place for all cases.

9 months agodissect-image: add client side API wrapper for MountDirectory() varlink call
Lennart Poettering [Mon, 11 Nov 2024 16:45:18 +0000 (17:45 +0100)] 
dissect-image: add client side API wrapper for MountDirectory() varlink call

This is simply a Varlink API client that taks a directory path and
userns fd and returns a mount fd.

9 months agomntfsd: add api to mount dirs for containers
Lennart Poettering [Fri, 8 Nov 2024 11:15:16 +0000 (12:15 +0100)] 
mntfsd: add api to mount dirs for containers

systemd-mountfsd so far provided a MountImage() API call for mounting a
disk image and returning a set of mount fds. This complements the API
with a new MountDirectory() API call, that operates on a directory
instead of an image file. Now, what makes this interesting is that it
applies an idmapping from the foreign UID range to the provided target
userns – and in which case unpriveleged operation is allowed (well,
under some conditions: in particular the client must own a parent dir of
the provided path).

This allows container managers to run fully unprivileged from
directories – as long as those directories are owned by the foreign UID
range. Basic operation is like this:

1. acquire a transient userns from systemd-nsresourced with 64K users
2. ask systemd-mountfsd for an idmapped mount of the container dir
   matching that userns
3. join the userns and bind the mount fd as root.

Note that we have to drop various sandboxing knobs from the mountfsd
service file for this to work, since the kernel's security checks that
try to ensure than an obstructed /proc/ cannot be circumvented via
mounting a new procfs will otherwise prohibit mountfsd to duplicate the
mounts properly.

9 months agouser-record: make a NULL UserDBMatch be equivalent to no filtering 36141/head
Lennart Poettering [Wed, 22 Jan 2025 15:24:17 +0000 (16:24 +0100)] 
user-record: make a NULL UserDBMatch be equivalent to no filtering

9 months agouserdb: move setting of 'service' varlink parameter into userdb_connect()
Lennart Poettering [Wed, 22 Jan 2025 15:34:16 +0000 (16:34 +0100)] 
userdb: move setting of 'service' varlink parameter into userdb_connect()

We currently set this at two distinct places right before calling
userdb_connect(). let's do this inside of userdb_connect() instead, and
derive it directly from the socket path.

This doesn't change behaviour but simplifies things a bit.

9 months agouserdbd: separate parameter structure of GetMemberships() varlink call from the GetUs...
Lennart Poettering [Tue, 21 Jan 2025 22:28:12 +0000 (23:28 +0100)] 
userdbd: separate parameter structure of GetMemberships() varlink call from the GetUserRecord() one

The GetUserRecord() and GetMemberships() have quite different arguments,
hence let's use separate structures for both.

This makes sense on its own, since it makes the structures a bit
smaller, but is also preparation for a later commit that adds a bunch of
new fields to one of the structs but not the other.

9 months agosd-varlink: add sd_varlink_get_description() call 36137/head
Lennart Poettering [Wed, 22 Jan 2025 15:13:59 +0000 (16:13 +0100)] 
sd-varlink: add sd_varlink_get_description() call

9 months agosd-json: add new sd_json_variant_unset_field() call
Lennart Poettering [Wed, 22 Jan 2025 15:13:27 +0000 (16:13 +0100)] 
sd-json: add new sd_json_variant_unset_field() call

9 months agodocs: mention the two other userdb services we ship these days
Lennart Poettering [Thu, 23 Jan 2025 14:21:36 +0000 (15:21 +0100)] 
docs: mention the two other userdb services we ship these days

9 months agoudev-rules: check OWNER/GROUP= setting more strictly (#36123)
Yu Watanabe [Thu, 23 Jan 2025 20:09:39 +0000 (05:09 +0900)] 
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.

9 months agocreds: permit interactive polkit auth when encrypting/decrypting through IPC
Mike Yuan [Wed, 22 Jan 2025 17:25:17 +0000 (18:25 +0100)] 
creds: permit interactive polkit auth when encrypting/decrypting through IPC

9 months agocore/job: fix typo
Mike Yuan [Thu, 23 Jan 2025 17:02:34 +0000 (18:02 +0100)] 
core/job: fix typo

9 months agoNEWS: mention OWNER=/GROUP= in udev rules now refuses non-system user/group 36123/head
Yu Watanabe [Thu, 23 Jan 2025 17:33:05 +0000 (02:33 +0900)] 
NEWS: mention OWNER=/GROUP= in udev rules now refuses non-system user/group

9 months agotest: add test cases for OWNER=/GROUP= with non-system user/group
Yu Watanabe [Thu, 23 Jan 2025 00:13:38 +0000 (09:13 +0900)] 
test: add test cases for OWNER=/GROUP= with non-system user/group

9 months agoudev-rules: ignore non-system user/group in OWNER=/GROUP=
Yu Watanabe [Wed, 22 Jan 2025 21:08:23 +0000 (06:08 +0900)] 
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.

9 months agoudev-rules: ignore OWNER=/GROUP= with unknown user/group
Yu Watanabe [Wed, 22 Jan 2025 20:59:04 +0000 (05:59 +0900)] 
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".

9 months agoudev-rules: get_user_creds()/get_group_creds() return -ESRCH when user/group does...
Yu Watanabe [Thu, 23 Jan 2025 17:16:36 +0000 (02:16 +0900)] 
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.

9 months agounits: modprobe@.service tweaks (#36132)
Lennart Poettering [Thu, 23 Jan 2025 17:18:10 +0000 (18:18 +0100)] 
units: modprobe@.service tweaks (#36132)

9 months agosd-device: chase sysattr and refuse to read/write outside of sysfs (#36004)
Yu Watanabe [Thu, 23 Jan 2025 16:58:19 +0000 (01:58 +0900)] 
sd-device: chase sysattr and refuse to read/write outside of sysfs (#36004)

9 months agoudevadm: introduce cat command to show udev rules (#35893)
Yu Watanabe [Thu, 23 Jan 2025 16:49:42 +0000 (01:49 +0900)] 
udevadm: introduce cat command to show udev rules (#35893)

Closes #35818.

9 months agounits: don't load squasfs/erofs kmods explicitly 36132/head
Lennart Poettering [Thu, 23 Jan 2025 13:49:46 +0000 (14:49 +0100)] 
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.

9 months agounits: mountfsd needs to pull DM and loop kmods
Lennart Poettering [Thu, 23 Jan 2025 13:47:10 +0000 (14:47 +0100)] 
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

9 months agounits: add a longer comment to modprobe@.service explaining when to use it
Lennart Poettering [Thu, 23 Jan 2025 13:47:03 +0000 (14:47 +0100)] 
units: add a longer comment to modprobe@.service explaining when to use it

9 months agosd-device: use device_in_subsystem() at more places 36004/head
Yu Watanabe [Sat, 18 Jan 2025 01:41:06 +0000 (10:41 +0900)] 
sd-device: use device_in_subsystem() at more places

9 months agosd-device: use specific setters for read entries from uevent file
Yu Watanabe [Sat, 18 Jan 2025 01:40:32 +0000 (10:40 +0900)] 
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.

9 months agosd-device: use sd_device_get_sysattr_value() to read uevent file
Yu Watanabe [Sat, 18 Jan 2025 01:39:21 +0000 (10:39 +0900)] 
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.

9 months agosd-device: use sd_device_get_sysattr_value() to read special symlinks
Yu Watanabe [Sat, 18 Jan 2025 01:33:19 +0000 (10:33 +0900)] 
sd-device: use sd_device_get_sysattr_value() to read special symlinks

Then, cached result may be used. No functional change, just refactoring.

9 months agosd-device: chase sysattr and refuse to read/write files outside of sysfs
Yu Watanabe [Sat, 11 Jan 2025 22:03:49 +0000 (07:03 +0900)] 
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".

9 months agofileio: make read_virtual_file_at() accept O_PATH file descriptor
Yu Watanabe [Fri, 17 Jan 2025 21:45:03 +0000 (06:45 +0900)] 
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.

9 months agofileio: make write_string_file_at() accept O_PATH fd and an empty filename
Yu Watanabe [Fri, 17 Jan 2025 21:43:12 +0000 (06:43 +0900)] 
fileio: make write_string_file_at() accept O_PATH fd and an empty filename

Then, introduce an inline wrapper write_string_file_fd().

9 months agofileio: fix verification on failure in write_string_file_full()
Yu Watanabe [Fri, 17 Jan 2025 21:36:31 +0000 (06:36 +0900)] 
fileio: fix verification on failure in write_string_file_full()

Fixes a bug introduced by 0ab5e2a4b4f5d435cb66b591ef5c700894663fd3.

9 months agoudevadm: introduce cat command 35893/head
Yu Watanabe [Tue, 7 Jan 2025 07:58:37 +0000 (16:58 +0900)] 
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.

9 months agobash-completion/udevadm-verify: suggest found udev rules files
Yu Watanabe [Thu, 9 Jan 2025 10:25:49 +0000 (19:25 +0900)] 
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.

9 months agoudevadm-verify: chase specified paths
Yu Watanabe [Thu, 9 Jan 2025 01:27:11 +0000 (10:27 +0900)] 
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.

9 months agoudev-rules: log the first line number when continued
Yu Watanabe [Fri, 10 Jan 2025 18:45:38 +0000 (03:45 +0900)] 
udev-rules: log the first line number when continued

9 months agoudev: sort builtins
Yu Watanabe [Tue, 7 Jan 2025 08:41:41 +0000 (17:41 +0900)] 
udev: sort builtins

Then, 'udevadm test-builtin --help' lists builtins alphabetically.

9 months agoshell-completion/udevadm: add net_driver
Yu Watanabe [Tue, 7 Jan 2025 08:39:12 +0000 (17:39 +0900)] 
shell-completion/udevadm: add net_driver

Follow-up for 2b5b25f123ceb89b3ff45b2380db1c8a88b046d9.

9 months agotree-wide: use hash ops with destructor (#36107)
Yu Watanabe [Thu, 23 Jan 2025 13:20:42 +0000 (22:20 +0900)] 
tree-wide: use hash ops with destructor (#36107)

9 months agomkosi: Add back --preserve-env when running integrationt tests
Daan De Meyer [Thu, 23 Jan 2025 09:35:06 +0000 (10:35 +0100)] 
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.

9 months agohashmap: drop hashmap_free_free() and friends 36107/head
Yu Watanabe [Wed, 22 Jan 2025 02:37:06 +0000 (11:37 +0900)] 
hashmap: drop hashmap_free_free() and friends

9 months agotest: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 02:10:10 +0000 (11:10 +0900)] 
test: use hash ops with destructor

9 months agoremount-fs: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:51:13 +0000 (10:51 +0900)] 
remount-fs: use hash ops with destructor

9 months agoexec-util: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:49:07 +0000 (10:49 +0900)] 
exec-util: use hash ops with destructor

9 months agonetwork: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:46:09 +0000 (10:46 +0900)] 
network: use hash ops with destructor

9 months agosd-journal: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:39:35 +0000 (10:39 +0900)] 
sd-journal: use hash ops with destructor