1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-02 12:58:35 +03:00

78665 Commits

Author SHA1 Message Date
Lennart Poettering
8703a50835 coredump: acquire further attributes via pidref rather than pid 2025-01-10 14:14:17 +01:00
Lennart Poettering
9237a63a80 process-util: add new helper pidref_get_ppid_as_pidref() 2025-01-10 14:14:17 +01:00
Lennart Poettering
8c0da3af28 tree-wide: port more code to namespace_open_by_type() 2025-01-10 14:09:48 +01:00
Lennart Poettering
b25430deab terminal-util: pidref'ify two terminal related calls 2025-01-10 14:09:48 +01:00
Lennart Poettering
fa8b70f2c8
userdb: define new 64K "foreign UID" range (#35932)
This is establish the basic concepts for #35685, in the hope to get this
merged first.

This defines a special, fixed 64K UID range that is supposed to be used
by directory container images on disk, that is mapped to a dynamic UID
range at runtime (via idmapped mounts).

This enables a world where each container can run with a dynamic UID
range, but this in no way leaks onto the disk, thus making supposedly
dynamic, transient UID range assignments persistent.

This is infrastructure later used for the primary part of #35685: unpriv
container execution with directory images inside user's home dirs, that
are assigned to this special "foreign UID range".

This PR only defines the ranges, synthesizes NSS records for them via
userdb, and then exposes them in a new "systemd-dissect --shift" command
that can re-chown a container directory tree into this range (and in
fact any range).

This comes with docs. But no tests. There are tests in #35685 that cover
all this, but they are more comprehensive and also test nspawn's hook-up
with this, hence are excluded from this PR.
2025-01-10 13:49:11 +01:00
Lennart Poettering
7893362508 process-util: do not unblock unrelated signals while forking
This makes sure when we are blocking signals in preparation for fork()
we'll not temporarily unblock any signals previously set, by mistake.

It's safe for us to block more, but not to unblock signals already
blocked. Fix that.

Fixes: #35470
2025-01-10 16:10:31 +09:00
Lennart Poettering
a71731bd2e repart: modernize set_gpt_flags() 2025-01-10 16:08:07 +09:00
Luca Boccassi
8442ac9c02 meson: add install tags for udev and hwdb
Allows building and installing them individually, like
other existing components
2025-01-10 15:15:13 +09:00
Daan De Meyer
96403d5121 tree-wide: Fix python formatting
The new release of ruff formats a few more things which causes linter
failures in CI so let's fix those formatting nits.
2025-01-10 14:58:56 +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
Daan De Meyer
8965d57f4b fmf: Use one fewer than number of available CPUs again
This effectively reverts b8582198ca1e6fe390f7169e623a9130b68a6b36
as I can not get the testing farm bare metal machines working
downstream and even if I managed to, without also using the testing
farm bare metal machines upstream (for which there is no capacity),
the setup would very quickly bitrot anyway so we'll just run the
container based tests for now.
2025-01-09 15:45:41 +01:00
Daan De Meyer
6e761c5a93 fmf: Log clock source 2025-01-09 15:24:51 +01:00
Daan De Meyer
0e444c948e fmf: Move meson logs and failed test journals to test artifacts dir 2025-01-09 15:13:18 +01:00
Lennart Poettering
46f881e321 update TODO 2025-01-09 14:40:17 +01:00
Lennart Poettering
0ae98d2f23 update TODO 2025-01-09 14:36:37 +01:00
Lennart Poettering
d8113a2863
Stash the subscriber list when we disconenct from the bus (#35406)
If we unexpectly disconnect from the bus, systemd would end up dropping
the list of subscribers, which breaks the ability of clients like logind
to monitor the state of units.

Stash the list of subscribers into the deserialized state in the event
of a disconnect so that when we recover we can renew the broken
subscriptions.

---

Fixes: #8672 #26744
2025-01-09 14:34:55 +01:00
Lennart Poettering
c0041cd8f1
pam: add session class "none" to disable logind sessions (#35171)
pam_systemd is used to create logind sessions and to apply extended
attributes from json user records. Not every application that creates a
pam session expects a login scope, but may be interested in the extended
attributes of json user records. Session class "none" implements this
service by disabling logind for this session altogether.

---

Closes: #34988
2025-01-09 14:08:06 +01:00
Daan De Meyer
606034cc1e
machine: introduce io.systemd.Machine.OpenRootDirectory method (#35880)
This PR introduces io.systemd.Machine.OpenRootDirectory method which is
DBus's alternative to OpenMachineRootDirectory.
2025-01-09 13:06:38 +01:00
Daan De Meyer
103e92810a mkosi: Re-enable TEST-21-DFUZZER when running with sanitizers
Similar to how CentOS CI did it previously, let's only run
TEST-21-DFUZZER when built with sanitizers for maximum effect.
2025-01-09 11:48:23 +00:00
Daan De Meyer
c286e8b616
Two integration test fixes (#35937) 2025-01-09 12:25:41 +01:00
Daan De Meyer
67a91b183b
TEST-06-SELINUX: Add knob to allow checking for AVCs (#35921)
When running the integration tests downstream, it's useful to be able to
test that a new systemd version doesn't introduce any AVC denials, so
let's add a knob to make that possible.
2025-01-09 11:59:58 +01:00
Daan De Meyer
e1c883bf32 fmf: Force SELinux relabel when running within testing farm
We expect to run as root within testing farm and to have permissions
to do selinux relabelling so let's enable it explicitly.
2025-01-09 11:59:34 +01:00
Daan De Meyer
de19520ec9 TEST-06-SELINUX: Add knob to allow checking for AVCs
When running the integration tests downstream, it's useful to be
able to test that a new systemd version doesn't introduce any AVC
denials, so let's add a knob to make that possible.
2025-01-09 11:59:30 +01:00
Daan De Meyer
794d456cf4 test: Only plug in integration-test-setup.sh in interactive mode
If we're not running interactively, there's no point in the features
from integration-test-setup.sh which are intended for interactive
development and debugging so lets skip adding it in that case.
2025-01-09 11:28:15 +01:00
Daan De Meyer
90538ede55 test: Drop set -x from integration-test-setup.sh 2025-01-09 11:27:51 +01:00
Ivan Kruglov
04bf637e25 machine: set SD_VARLINK_SERVER_ALLOW_FD_PASSING_OUTPUT for varlink server 2025-01-09 10:51:18 +01:00
Ivan Kruglov
3ddd3adfcd machine: tests for io.systemd.Machine.OpenRootDirectory 2025-01-09 10:51:18 +01:00
Ivan Kruglov
8633bf5836 machine: introduce io.systemd.Machine.OpenRootDirectory 2025-01-09 10:51:18 +01:00
Ivan Kruglov
307458a6f4 machine: use machine_open_root_directory() in dbus 2025-01-09 10:51:18 +01:00
Ivan Kruglov
65275cfbe5 machine: machine_open_root_directory() 2025-01-09 10:51:18 +01:00
Ivan Kruglov
64db44f7fb process-util: read_errno() 2025-01-09 10:47:24 +01: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
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
Ronan Pigott
e1315a621a manager: s/deserialized_subscribed/subscribed_as_strv
Now that this field may get populated at runtime, the deserialized name
is misleading. Change the name to reflect its updated purpose.
2025-01-08 15:51:42 -07:00
Ronan Pigott
8402ca04d1 dbus: stash the subscriber list when we disconenct from the bus
If we unexpectly disconnect from the bus, systemd would end up dropping
the list of subscribers, which breaks the ability of clients like logind
to monitor the state of units.

Stash the list of subscribers into the deserialized state in the event
of a disconnect so that when we recover we can renew the broken
subscriptions.
2025-01-08 15:50:56 -07: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
55e4946f9c dissect: add new --shift command 2025-01-08 21:54:19 +01:00
Lennart Poettering
44eb6b81db userdb: synthesize stub user records for the foreign UID 2025-01-08 21:41:03 +01:00
Lennart Poettering
ec0c10fc9d user-classification: add new "foreign" UID range
This makes the UID range configurable via build time options, but of
course it really shouldn't be changed. The default range I picked is
outside even of IPAs current (ridiculously large) allocation ranges,
hence hopefully minimizes conflicts.
2025-01-08 21:41:03 +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