Commit Graph
52792 Commits
Author SHA1 Message Date
Mike Yuan a7516260b3 core/manager: use FOREACH_ARRAY at one more place 2025-01-13 21:52:19 +01:00
Mike Yuan 33eeea4128 bus-util: do not reset the count returned by sd_bus_track_count_name()
Follow-up for 8402ca04d1

While at it, turn the retval check for sd_bus_track_count_name()
into assertion, given we're working with already established tracks
(service_name_is_valid() should never yield false in this case).

Addresses https://github.com/systemd/systemd/pull/35406#discussion_r1912066774
2025-01-13 21:52:18 +01:00
Mike Yuan 38a2c2bf6a shared/serialize: introduce serialize_id128() 2025-01-13 21:52:13 +01:00
Mike Yuan 3f03d39ca3 shared/serialize: make input params const 2025-01-13 16:56:08 +01:00
Mike Yuan 91080bc973 shared/bus-util: move string set append/get funcs to bus-message-util and bus-get-properties, respectively 2025-01-13 16:55:42 +01:00
Mike Yuan e3d37628aa shared/bus-util: move bus_message_hash_ops to bus-message-util 2025-01-13 16:24:44 +01:00
Mike Yuan ab33edb05b shared/bus-util: move bus_message_read_id128() to bus-message-util 2025-01-13 16:24:44 +01:00
Lennart Poettering 3d6f14d327 tmpfiles: move two commands to the right --help sections 2025-01-13 15:05:41 +01:00
Lennart Poettering 0fd2c1fa59 sysusers: use chase_and_stat() where appropriate 2025-01-13 11:46:56 +01:00
Lennart Poettering 48b176cb2d sysusers: add missing assert() 2025-01-13 11:46:56 +01:00
Lennart Poettering ca7d68f7f0 sysusers: modernize loading of user/group databases
Let's use chase(), and let's allocate sets/hashmaps on-the-fly.
2025-01-13 11:46:56 +01:00
Lennart Poettering 1696bc55f9 sysusers: rework --help to do sections, and ANSI highlighting 2025-01-13 11:46:56 +01:00
Lennart Poettering 361327e929 convert more code to PidRef (#35895) 2025-01-11 23:14:33 +01:00
Mike Yuan 95a5c658a3 namespace-util: use pidref_namespace_open_by_type() where appropriate
Several logs are dropped, since all callers log loudly already.
2025-01-11 16:06:38 +01:00
Mike Yuan a0e3dbdef5 uid-range: make uid_map_search_root() take UIDRangeUsernsMode 2025-01-11 15:53:15 +01:00
Mike Yuan 8c2c8235a6 namespace-util: introduce userns_enter_and_pin() helper
which generalizes forking a process into userns and freeze()

Addresses https://github.com/systemd/systemd/pull/35833/files#r1905508153
2025-01-11 15:53:14 +01:00
Mike Yuan c7704ecd04 namespace-util: group userns functions together 2025-01-11 15:53:14 +01:00
Mike Yuan 407ebf29cc basic: move nsfs ioctls from missing_fs to missing_namespace
Addresses https://github.com/systemd/systemd/pull/35833#discussion_r1905333757
2025-01-11 15:53:14 +01:00
Mike Yuan dfef02c675 process-util: drop duplicate assertions 2025-01-11 15:53:13 +01:00
Eaterminer 6cffdcd590 homectl: fix minor spelling mistake (#35963) 2025-01-11 14:17:05 +09:00
Luca Boccassi 8c5b359579 stub: drop PE sections parsing cap
This was added originally as it was thought that Windows applied
the same cap. Nowadays the specs do not mention it, and it is
believed Windows no longer applies it either, so drop it in order
to allow an arbitrary number of DTBs to be included

Fixes https://github.com/systemd/systemd/issues/35943
2025-01-10 22:51:46 +00:00
Lennart Poettering 97ac59f18d machine: follow ups for varlink PRs recently merged (#35940)
Follow ups for:
- https://github.com/systemd/systemd/pull/35880
- https://github.com/systemd/systemd/pull/35066
2025-01-10 22:12:22 +01:00
Lennart Poettering d4ed594a1a varlink: send linux errno name along with errno number in generic system error replies (#35912)
Let's make things a bit less Linux specific, and more debuggable, by
including not just the error number but also the error name in the
generic io.systemd.System errors we generate when all we have is an
"errno".
2025-01-10 15:40:48 +01:00
Lennart Poettering 0b8b13324e namespace-util: port namespace_get_leader() to PidRef 2025-01-10 14:22:49 +01:00
Lennart Poettering 47e45ea738 process-util: make pidref_safe_fork_full() work with FORK_WAIT
(This is useful for the test case added in the next commit, where it's
kinda nice being able to use pidref_safe_fork_full() and acquiring a
pidref of the child in the child in one go. There's no other value in
this than a bit of synctactic sugar for that test. But otoh thre's no
good reason to prohibit FORK_WAIT use like this, hence either way, this
commit should be a good thing.)
2025-01-10 14:14:17 +01:00
Lennart Poettering 36812cb659 coredump: port to pidref_namespace_open() 2025-01-10 14:14:17 +01:00
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 ed70124b2c test-varlink: add superficial test that validates varlink/errno translation both ways 2025-01-10 14:05:29 +01:00
Lennart Poettering f249cc7618 varlink: tweak what we include in "system error" messages
We so far only included the numeric Linux errno. That's pretty Linux
specific however. Hence, let's improve things and include an origin
string, that clearly marks Linux as origin. Also, include the string
name of the error.

Take these two fields into account when translating back, too. So that
we prefer going by symbolic name rather than by numeric id.
2025-01-10 14:05:29 +01:00
Lennart Poettering 14533598bd sd-json: make it safe to call sd_json_dispatch_full() with a NULL table
This is useful for generating good errors when dispatching varlink
methods that take no parameters, as we'll still generate precise errors
in that case, taking a NULL table as equivalent as one with no
entries.
2025-01-10 14:03:21 +01:00
Lennart Poettering a551f584e2 logind: split create session reply handling in two
This prepares ground so that later on we can reply with either D-Bus or
Varlink depending on the client's request.
2025-01-10 13:59:56 +01:00
Lennart Poettering 19cd2b6d20 logind: rework session creation logic, to be more reusable for varlink codepaths
This separates the preparatory checks that generate D-Bus errors from
the code that actually allocates the session. This make the logic easier
to follow and prepares ground so that we can reuse the 2nd part later
when exposing session creation via Varlink.
2025-01-10 13:59:56 +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
Ivan Kruglov d423f231f7 machine: VARLINK_ERROR_MACHINE_IMAGE_* defines 2025-01-10 11:49:49 +01:00
Ivan Kruglov c85e837744 machine: VARLINK_ERROR_MACHINE_* defines 2025-01-10 11:49:49 +01:00
Ivan Kruglov 6b77efe47e machine: fix logging of errno in machine_open_root_directory() 2025-01-10 11:49:49 +01:00
Ivan Kruglov 03b89cf213 basic: fixes in read_errno()
follow ups for https://github.com/systemd/systemd/pull/35880
2025-01-10 11:49:49 +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
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
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 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