Commit Graph
78626 Commits
Author SHA1 Message Date
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
Daan De Meyer b8582198ca fmf: Use different heuristic for number of process with many CPUs
Downstream we sometimes end up with machines with lots of CPUs which
leads to running out of memory when trying to run the tests in VMs.
So let's switch to a different heuristic when we have lots of CPUs to
avoid running out of memory.
2025-01-09 09:15:18 +01:00
Lennart Poettering 5ae3172867 hwids: add a new efi firmware type of device entry (#35747)
This change adds a new firmware type device entry for the .hwids
section.
It also adds compile time validations and appropriate unit tests for
them.
chid_match() and related helpers have been updated accordingly.

Duplicate of https://github.com/systemd/systemd/pull/35281
Last review feedback's from this above PR has been incorporated and
merged.

@anonymix007
2025-01-08 22:31:48 +01:00
Pontus Lundkvist d908b68c7d Remove no longer needed login-options override. Fixes agetty autologin.
The need for -o was introduced in db6aeda to set the -p flag for login.
Setting -o overrides agettys built-in handling of arguments, so "-- \\u" was needed to mimic it.

This broke the autologin-feature, since the -f (noauth) flag is not passed to login [1].

But with 3d2157e, the -p flag is dropped, but the full change wasn't reverted,
leaving autologin still broken - But for no reason since agetty does the right thing.

Reference:
[1]: https://github.com/util-linux/util-linux/blob/4e14b57/term-utils/agetty.c#L529-L550
2025-01-08 22:30:04 +01:00
Lennart Poettering 268d39d18a update TODO 2025-01-08 22:24:39 +01:00
Lennart Poettering b253555d6b udev/net: add three settings for ethtool features (#35906)
Closes #31415.
Closes #32979.
2025-01-08 21:37:21 +01:00
Lennart Poettering 0ee1171cbb nsresource: optionally mangle userns names passed to nsresourced (#35900)
We enforce quite strict rules on naming userns we assign uid ranges to
for users. So strict that they are hard to get right for clients. hence,
let's optionally mangle provided strings so that they work for us.

This should make it much easier to work with the API, as something
reasonable happens regarldess what kind of garbage a client sets as
name.

mangling the name is opt-in for clients, so that there's tight control
for the client on the name, but also "fire and forget".
2025-01-08 21:36:37 +01:00
Lennart Poettering a241b796fa pid1: allow removal of foreign-owned subcgroups of cgroups owned by some user (#35922)
This improves operation in unprivileged userns environments, where
unpriv user code might invoke a container with a delegated userns UID
range, and thus ends up with a subcgroup owned by another UID. With this
patch any user is always allowed to remove their own cgroups even if it
has subcgroups owned by other users.

This removes a DoS of sorts, and enforces the rule that users strictly
own everything below cgroups they own.
2025-01-08 21:36:16 +01:00
Daan De Meyer 44368f84d7 fmf: Dump CPU and memory information 2025-01-08 21:14:58 +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
Mike Yuan 684e4e5bfb two pidref tweaks (#35918) 2025-01-08 18:58:20 +01:00
Lennart Poettering 1d5fd2e621 test: add testcase that verifies we can safely delete subcgroups owned by other users if we own the parent
This is a test for the previous commits: we create an unpriv, delegated cgroup in
--user mode, then create a subcgroup that is owned by some other user
(to mimic the case where an unpriv user got a userns with delegated UIDs
assigned), and then try to stop the unit. traditionally this would fail,
because our unpriv systemd --user instance can't remove the subcrroup
owned by someone else. With the earlier patches this is addressed.
2025-01-08 15:27:25 +01:00
Lennart Poettering 51a70c8875 cgroup: when we fail to clean up a cgroup, let's ask PID 1 for help 2025-01-08 15:27:25 +01:00
Lennart Poettering 94634b4b03 pid1: add D-Bus API for removing delegated subcgroups
When running unprivileged containers, we run into a scenario where an
unpriv owned cgroup has a subcgroup delegated to another user (i.e. the
container's own UIDs). When the owner of that cgroup dies without
cleaning it up then the unpriv service manager might encounter a cgroup
it cannot delete anymore.

Let's address that: let's expose a method call on the service manager
(primarly in PID1) that can be used to delete a subcgroup of a unit one
owns. This would then allow the unpriv service manager to ask the priv
service manager to get rid of such a cgroup.

This commit only adds the method call, the next commit then adds the
code that makes use of this.
2025-01-08 15:27:25 +01:00
Lennart Poettering 59857b672c pid1: allow moving processes in a userns owned by the user, too
Let's liberalize process migration a bit. Previously, PID 1 would only
allow you to move processes into your own cgroups, if those processes
are owned by you too. This is now slightly relaxed: it's now also OK if
the processes are in a userns owned by you.

This makes process migration more useful in context of unpriv userns.
2025-01-08 15:27:25 +01:00
nl6720 96963e5615 dissect-image: mount the ESP with fmask=0177 (#35871)
Avoid showing the files on the ESP (i.e. a FAT formatted volume) as
executable by removing the execute permission from them.

IMO this makes the colored output of `ls` more sensible since the file
system will be mounted with `noexec` anyway.

Add a `fstype_can_fmask_dmask` function that checks if a file system
type can use the `fmask` and `dmask` mount options.

This replaces `fstype_can_umask` since it was only used in
`partition_pick_mount_options` which only cares about the file system
support for fmask & dmask now.

It somewhat reduces the coverage of the feature since there are more file
systems that support umask as opposed to those supporting dmask & dmask,
but it should not be much of an issue since fmask & dmask are supported
by vfat, exfat and ntfs3.
2025-01-08 15:19:33 +01:00
Lennart Poettering a73ddc7182 test: make sure the userns long name mangling codepaths are tested 2025-01-08 15:12:02 +01:00
Lennart Poettering ee6fd7ef82 nsresourced: add ability to mangle specified name if necessary
Let's optionally mangle any passed name on the server side so that it is
useful for identifying a userns, if it isn't suitable for that
right-away. This mostly means truncating it if too long.

It's just too nasty to leave this to the client side, since they'd have
to understand the precise rules for naming userns then.

While we are at it, add full Varlink IDL comments.
2025-01-08 15:12:02 +01:00
Lennart Poettering 364e275319 userns: refuse empty userns names
Let's tighten rules a bit.
2025-01-08 15:07:08 +01:00
Lennart Poettering dcb29a931c Simple pam_systemd clean-ups (#35919) 2025-01-08 15:03:36 +01:00
Lennart Poettering 0df46f8908 pidref: drop support for kernels lacking waitid(P_PIDFD, …)
Our baseline is not 5.4, which is where P_PIDFD was introduced.
2025-01-08 14:51:19 +01:00
Lennart Poettering 06744cbb52 pidref: copy fd id in pidref_copy() too 2025-01-08 14:51:19 +01:00
Daan De Meyer 8e3347f3bd fmf: Only mess with /etc/yum.repos.d when running within testing farm
If running tmt locally to debug the test script, make sure we don't
mess with /etc/yum.repos.d.
2025-01-08 13:37:23 +01:00
Daan De Meyer 7f1eceb168 Three fmf fixes (#35917) 2025-01-08 12:29:10 +01:00
Lennart Poettering 394a6ab68c logind: also potentially GC the session if we cannot send reply 2025-01-08 11:24:18 +01:00
Lennart Poettering 1b48aa3523 logind: indicate that 'error' parameter is input by making it const 2025-01-08 11:24:18 +01:00
Lennart Poettering e79502cdfa logind: split out logic that finds free session ID into helper call
Just some refactoring to make an overly large function a bit smaller.
2025-01-08 11:24:18 +01:00
Lennart Poettering 1b58ba768a logind: normalize parameter to create_session()
We can pass a properly typed Manager object here, no reason to pass it
as void*.
2025-01-08 11:20:18 +01:00
Daan De Meyer fc1b08dee2 fmf: Fix glob
Globs inside quotes aren't expanded and we need the glob to be more
specific to avoid matching multiple entries inside the tmt source
directory.
2025-01-08 11:15:43 +01:00
Daan De Meyer 0a85b37579 fmf: Fix dist-git example
All that's needed is dist-git-source: true so remove the other settings
that aren't required.
2025-01-08 10:25:50 +01:00
Daan De Meyer 0250db0139 fmf: Don't fail if we can't put selinux in permissive mode
The tests might be running unprivileged or in an environment without
selinux so let's not fail if we can't put it in permissive mode.
2025-01-08 10:25:05 +01:00
Luca Boccassi 6b61f34a46 Stop installing some markdown docs/ files
These files are rendered on systemd.io and targeted at contributors, not
users, so it's not really useful to install them on a running system.
2025-01-08 09:45:09 +01:00
Lennart Poettering 344376adb8 namespace-util: two new operations (#35833)
(This is preparation for #35685, but since it comes with nice test cases
should be safe to add on their own)
2025-01-08 09:35:21 +01:00
Lennart Poettering 2ade821859 namespace-util: add process_is_owned_by_uid() helper 2025-01-07 23:55:34 +01:00
Lennart Poettering 3d57b6692f namespace-util: add helper to get base UID from userns 2025-01-07 23:55:34 +01:00
Lennart Poettering 5b14690a39 namespace-util: slightly tweak proc_mounted() handling in namespace_is_init()
Let's not sloppily eat up errors here.
2025-01-07 23:51:28 +01:00
Lennart Poettering adcc805929 namespace-util: return recognizable error if namespace_open_by_type() fails because ns type not supported
This makes sure the the codepath that derives an nsfd from a pid works
the same for the pidfd case and the non-pidfd case: if we can verify
that /proc/ is mounted but the /proc/$PID/ns/ files are missing, we can
assume the ns type is not supported by the kernel. Hence return the same
ENOPKG error in this case as we already do in the pidfd ioctl based
codepath.
2025-01-07 23:51:28 +01:00
Mike Yuan 16ac586e5a Bump minimum kernel baseline to 5.4, recommended version to 5.7
As requested, a list of kernel version to feature mapping
for kernels older than minimum baseline is also included,
in order to ease potential backport work.
2025-01-07 22:43:45 +01:00
Lennart Poettering 0dfd89fa32 udev: introduce io.systemd.Udev varlink interface (#35721)
Replaces #25523.
2025-01-07 16:49:37 +01:00
Tobias Klauser 9379b23be3 resolve: fix typo in DNS_EDE_RCODE_PROHIBITIED constant name
Drop the extra `I` and rename the constant to DNS_EDE_RCODE_PROHIBITED
in accordance with the error code string.
2025-01-07 16:48:44 +01:00
Daan De Meyer 6640466cec mkosi: Bump device timeout back to default value
Hopefully fixes #35302
2025-01-07 16:20:35 +01:00
Jacob McNamee 9d1c28b2d8 stdio-bridge: fix polled fds
Poll fds associated with the bus instead of hardcoding stdin/stdout.

This is consequential under socket activation, when the provided fd
should be used instead of stdin/stdout.
2025-01-07 15:51:16 +01:00
Daan De Meyer 3c9ffd2e4b fmf: Check out target branch in packit 2025-01-07 15:27:19 +01:00
Daan De Meyer 86a6d7cc5a packit: Simplify configuration 2025-01-07 15:18:50 +01:00
Luca Boccassi 5c4cb68390 obs: also trigger Fedora package builds
The package is logistically separated, as the rpm sources conflict from Fedora
conflict with the rpm sources from SUSE (some files have the same name and
location but different, incompatible content), so Fedora builds can't be
triggered from the same package. The result is the same.
2025-01-07 13:56:52 +01: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
Daan De Meyer 414fe9629c mkosi: Install which in build image
Required by gdb-add-index to find gdb and not declared as a dependency
of the package.
2025-01-07 12:39:46 +01:00
Luca Boccassi f2b34ce7f3 test: add test case for AddDependencyUnitFiles assert
Follow-up for d87dc74e8f
2025-01-07 11:35:03 +00: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