1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00
Commit Graph

77295 Commits

Author SHA1 Message Date
Luca Boccassi
57b908caef
network: update tunnel or vxlan with Local=dhcp4 and friends (#34957)
Fixes #24854.
2024-11-01 11:10:21 +00:00
Luca Boccassi
890bdd1d77 core: add read-only flag for exec directories
When an exec directory is shared between services, this allows one of the
service to be the producer of files, and the other the consumer, without
letting the consumer modify the shared files.
This will be especially useful in conjunction with id-mapped exec directories
so that fully sandboxed services can share directories in one direction, safely.
2024-11-01 10:46:55 +00:00
dependabot[bot]
7fdcd903ab build(deps): bump actions/checkout from 4.2.0 to 4.2.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](d632683dd7...11bd71901b)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 11:25:37 +01:00
Lennart Poettering
cbddc201e5 man: <strong> is not a valid docbook tag, but <emphasis> is 2024-11-01 10:12:44 +01:00
Lennart Poettering
f0a1d44939 update NEWS 2024-11-01 10:12:41 +01:00
Lennart Poettering
e64ccd2242
coredump: rework protocol between coredump pattern handler and processing service (#34970)
In
68511cebe5
the ability to pass the
coredump's mount namespace fd from the coredump patter handler was added
to systemd-coredump. For this the protocol was augmented, in attempt to
provide both forward and backward compatibility.

The protocol as of v256: one or more datagrams with journal log fields
about the coredump are sent via an SOCK_SEQPACKET connection. It is
finished with a zero length datagram which carries the coredump fd (this
last datagram is called "sentinel" sometimes).

The protocol after
68511cebe5
is extended
so that after the sentinal a 2nd sentinel is sent, with a pair of fds:
the coredump fd *again* and a mount fd (acquired via open_tree()) of the
container's mount tree. It's a bit ugly to send the coredump fd a 2nd
time, but what's more important the implementation didn't work: since on
SOCK_SEQPACKET a zero sized datagram cannot be distinguished from EOF
(which is a Linux API design mistake), an early EOF would be
misunderstood as a zero size datagram lacking any fd, which resulted in
protocol termination.

Moreover, I think if we touch the protocol we should make the move to
pidfs at the same time.

All of the above is what this protocol rework addresses.

1. A pidfd is now sent as well

2. The protocol is now payload, followed by the coredump fd datagram (as
   before).  But now followed by a second empty datagram with a pidfd,
   and a third empty datagram with the mount tree fd. Of this the latter
   two or last are optional. Thus, it's now a stream of payload
   datagrams with one, two or three fd-laden datagrams as sentinel. If
   we read the 2nd or 3rd sentinel without an attached fd we assume this
   is actually an EOF (whether it actually is one or not doesn't matter
   here). This should provide nice up and down compatibility.

3. The mount_tree_fd is moved into the Context object. The pidfd is
   placed there too, as a PidRef. Thus the data we pass around is now
   the coredump fd plus the context, which is simpler and makes a lot
   more semantical sense I think.

4. The "first" boolean is replaced by an explicit state engine enum

Fixes: https://github.com/systemd/systemd/issues/34130
2024-11-01 08:15:05 +01:00
Lennart Poettering
098c3975ac coredump: make check that all argv[] meta data fields are passed strict
Otherwise, if some field is not supplied we might end up parsing a NULL
string later. Let's catch that early.
2024-10-31 23:09:14 +01:00
Lennart Poettering
b1694040af coredump: use memory_startswith() when looking at a data blob 2024-10-31 23:08:11 +01:00
Lennart Poettering
0e3e075b56 iovw: normalize destructors
instead of passing a boolean picking the destruction method just have
different functions. That's much nicer in context of _cleanup_, and how
we usually do things.
2024-10-31 23:08:11 +01:00
Lennart Poettering
811aa36ab6 iovw: add simpler iovw_done() destructor 2024-10-31 23:08:11 +01:00
Lennart Poettering
2865561eaa coredump: move to _cleanup_ for destroying iovw object 2024-10-31 23:08:11 +01:00
Lennart Poettering
19455dd600 coredump: parse rlimit field at same place as other fields 2024-10-31 23:08:11 +01:00
Lennart Poettering
960b045875 coredump: parse signal number at the same time as parsing other fields 2024-10-31 23:08:11 +01:00
Lennart Poettering
32756e57ef coredump: rename save_context() → context_parse_iovw()
The function doesn't "save" anything, it just parses iovw into the
individual fields, hence name the function accordingly.
2024-10-31 23:08:11 +01:00
Lennart Poettering
1f485bc735 coredump: acquire some process fields via pidref
Use pidref to acquire some fields. This just makes use of the pidref
helpers we already have. We acquire a lot of other data via classic pids
still, but for that we first have to write race-free pidref getters,
hence leave that for another time.
2024-10-31 23:08:11 +01:00
Lennart Poettering
313537da6f coredump: rework protocol between coredump pattern handler and processing service
In 68511cebe5 the ability to pass the
coredump's mount namespace fd from the coredump patter handler was added
to systemd-coredump. For this the protocol was augmented, in attempt to
provide both forward and backward compatibility.

The protocol as of v256: one or more datagrams with journal log fields
about the coredump are sent via an SOCK_SEQPACKET connection. It is
finished with a zero length datagram which carries the coredump fd (this
last datagram is called "sentinel" sometimes).

The protocol after 68511cebe5 is extended
so that after the sentinal a 2nd sentinel is sent, with a pair of fds:
the coredump fd *again* and a mount fd (acquired via open_tree()) of the
container's mount tree. It's a bit ugly to send the coredump fd a 2nd
time, but what's more important the implementation didn't work: since on
SOCK_SEQPACKET a zero sized datagram cannot be distinguished from EOF
(which is a Linux API design mistake), an early EOF would be
misunderstood as a zero size datagram lacking any fd, which resulted in
protocol termination.

Moreover, I think if we touch the protocol we should make the move to
pidfs at the same time.

All of the above is what this protocol rework addresses.

1. A pidfd is now sent as well

2. The protocol is now payload, followed by the coredump fd datagram (as
   before).  But now followed by a second empty datagram with a pidfd,
   and a third empty datagram with the mount tree fd. Of this the latter
   two or last are optional. Thus, it's now a stream of payload
   datagrams with one, two or three fd-laden datagrams as sentinel. If
   we read the 2nd or 3rd sentinel without an attached fd we assume this
   is actually an EOF (whether it actually is one or not doesn't matter
   here). This should provide nice up and down compatibility.

3. The mount_tree_fd is moved into the Context object. The pidfd is
   placed there too, as a PidRef. Thus the data we pass around is now
   the coredump fd plus the context, which is simpler and makes a lot
   more semantical sense I think.

4. The "first" boolean is replaced by an explicit state engine enum

Fixes: #34130
2024-10-31 23:08:11 +01:00
Lennart Poettering
ecfb4bb05e coredump: correct debug log message 2024-10-31 23:08:11 +01:00
Lennart Poettering
ea8eb370e7 coredump: minor modernizations 2024-10-31 23:08:11 +01:00
Lennart Poettering
393d0d2b69 coredump: rename pid → leader_pid
Let's rename this local variable, since we are not operating on the
coredump process here after all, but on the leader of the namespace the
coredump process in, which is quite different, hence let's make this
very clear via the name.
2024-10-31 23:08:11 +01:00
Lennart Poettering
aea215d5d9 update TODO 2024-10-31 23:07:48 +01:00
Yu Watanabe
4d8e5fefae sd-varlink: suppress one log message when callback already successfully enqueued an error response
Follow-up for d2ebf5cc1d.

The detailed error response is already logged, hence not necessary to
log again with the errno converted from the error response, which typically
less informative, e.g.
===
varlink-26-26: Setting state idle-server
varlink-26-26: Received message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"service":""}}
varlink-26-26: Changing state idle-server → processing-method
varlink-26-26: Sending message: {"error":"io.systemd.UserDatabase.BadService","parameters":{}}
varlink-26-26: Changing state processing-method → processed-method
varlink-26-26: Callback for io.systemd.UserDatabase.GetUserRecord returned error: Invalid request descriptor
varlink-26-26: Changing state processed-method → idle-server
varlink-26-26: Got POLLHUP from socket.
===
2024-10-31 22:58:35 +01:00
Luca Boccassi
e4a4a5bd2b
Rework sysupdate meson options (#34832)
systemd-sysupdated is still unstable and we'd like to make breaking
changes to it even after the v257 release, so we document it as such and
disable building it by default in release builds. The distro can still
opt-in, and we still build it in developer mode so it has CI coverage
2024-10-31 21:10:28 +00:00
Zbigniew Jędrzejewski-Szmek
243b63d8a6 meson: add separate option for sysupdated, disable in release builds
This commit introduces a build-time option to enable/disable sysupdated
separately from sysupdate. 'auto' translated to enabled by default in
developer builds.
2024-10-31 21:08:08 +00:00
Lennart Poettering
c8c13fdf51
Drop trailing NUL in .sbat/.sdmagic sections (#34950) 2024-10-31 21:48:18 +01:00
Lennart Poettering
02bf14d924
logind/systemctl: one follow-up for DesignatedMaintenanceWindow (#34966)
Fixes https://github.com/systemd/systemd/issues/33429
2024-10-31 21:47:45 +01:00
Lennart Poettering
5ca96e2717
machine: several follow-ups for recent change (#34882)
Follow-ups for #34761.
2024-10-31 21:43:18 +01:00
Lennart Poettering
ccf46aa54b sd-json: don't accidentally convert between unsigned/signed when parsing signal 2024-10-31 19:54:47 +01:00
Mike Gilbert
ff94426f8a posix_spawn_wrapper: do not set POSIX_SPAWN_SETSIGDEF flag
Setting this flag is a noop without a corresponding call to
posix_spawnattr_setsigdefault.

If we call posix_spawnattr_setsigdefault with a full signal set,
it causes glibc's posix_spawn implementation to call sigaction 63 times,
once for each signal. That seems wasteful.

This feature is really only useful for signals which have their
disposition set to SIG_IGN. Otherwise the dispostion gets set to
SIG_DFL automatically, either by clone(CLONE_CLEAR_SIGHAND) or the
subsequent execve.

As far as I can tell, systemd does not have any signals set to SIG_IGN
under normal operating conditions.
2024-10-31 18:16:58 +01:00
Mike Yuan
3e094f8489
bus-common-errors: use more appropriate errno for BUS_ERROR_DESIGNATED_MAINTENANCE_TIME_NOT_SCHEDULED
Fixes #33429
2024-10-31 15:46:27 +01:00
Mike Yuan
249bb7f894
systemctl: don't fall back to immediate shutdown silently if we cannot schedule one
The previous behavior of systemctl --when= seems absurd, i.e.
if we fail to schedule shutdown in the future it's performed
immediately. Let's instead hard fail, which also removes the need
of specializing on certain errnos (preparation for later commits).
2024-10-31 15:45:40 +01:00
Mike Yuan
57d8134d45
logind-dbus: return appropriate errno for unexpected errors
Follow-up for 0e10c3d872
2024-10-31 15:34:47 +01:00
Mike Yuan
5aa48b6de1
systemctl: use the retval of must_be_root() 2024-10-31 15:32:32 +01:00
Zbigniew Jędrzejewski-Szmek
d97b8d9d7b boot: stop appending NUL to .sdmagic and .sbat sections
Those text sections had a trailing NUL byte. It's debatable whether this is a
good idea or not. Correctly written consumers will look at the section size so
they wouldn't need this. Shim doesn't use a trailing NUL, so let's follow suit.

Fixes https://github.com/systemd/systemd/issues/33731.

898e9edc46 reworked this code, but didn't actually
change the logic. We have always been appending the trailing zero by using a
NUL-terminated string as the section contents. (I checked this with v253.18
from before the elf2efi rework.)

.sdmagic contains a string like "#### LoaderInfo: systemd-boot 257~devel ####",
which changes with each version, so previous versions would compare unequal
anyway, so we don't need to worry about backwards compatibility.
2024-10-31 14:58:12 +01:00
Daan De Meyer
1f9425d1c4 mkosi: Install gdb in centos/fedora build image
Lack of gdb-add-index has become a fatal error in Rawhide/c10s so
let's install gdb to make rpmbuild happy.
2024-10-31 13:44:13 +00:00
Yu Watanabe
3d8f2c1464 resolve: do not try to send varlink error more than once
After d2ebf5cc1d, sd_varlink_error() and
friends return negative errno.

Fixes https://github.com/systemd/systemd/pull/34946#discussion_r1823703636.
2024-10-31 18:45:08 +09:00
Yu Watanabe
80f38c1f65 test-network: add test case for tunnel Local=dhcp4
For issue #24854.
2024-10-31 18:41:44 +09:00
Yu Watanabe
b8b0c1a065 network: update tunnel or vxlan interface if the local address is changed
If a tunnel or vxlan is configured with Local=dhcp4 or so, then the
local address needs to be changed when it is changed.

Fixes #24854.
2024-10-31 18:41:44 +09:00
Yu Watanabe
76423f301e machine: lookup_machine_by_name_or_pidref() returns negative errno on failure
This effectively reverts d2c1451b73.

After the commit d2ebf5cc1d, sd_varlink_error()
returns negative errno, hence the function always return negative errno
on failure.
2024-10-31 11:02:35 +09:00
Yu Watanabe
0ef4a21b09 machine: use JSON_BUILD_PAIR_STRV_ENV_PAIR_NON_EMPTY()
Also use JSON_BUILD_PAIR_UNSIGNED_NOT_EQUAL().
2024-10-31 11:02:35 +09:00
Yu Watanabe
dbceb0507f sd-json: introduce JSON_BUILD_PAIR_STRV_ENV_PAIR_NON_EMPTY() macro
It is similar to JSON_BUILD_PAIR_STRV_NON_EMPTY, but takes the
list of environment variables.
2024-10-31 11:02:35 +09:00
Yu Watanabe
32d77f5df8 sd-json: use strv_env_get_merged() 2024-10-31 11:02:35 +09:00
Yu Watanabe
7633001cdd env-util: introduce strv_env_get_merged() 2024-10-31 11:02:35 +09:00
Yu Watanabe
e4d477efc6 env-util: replace 'char **' with 'char**' 2024-10-31 11:02:35 +09:00
Yu Watanabe
b1e11a252d TEST-13-NSPAWN: add test cases for listing multiple machines 2024-10-31 11:02:23 +09:00
Yu Watanabe
f0fdefc045 TEST-13-NSPAWN: trivially kill all processes in the container on termination
Follow-up for 841988f80d.

No functional change, as $PID is 0 when the trap is inserted.
2024-10-31 10:59:14 +09:00
Yu Watanabe
1856ab4503 TEST-13-NSPAWN: check returned machine list 2024-10-31 10:59:14 +09:00
Yu Watanabe
e79b58c825 TEST-13-NSPAWN: fix race between container exit and varlink call
Follow-up for 3cb72c7862.

The test container exits shortly, hence when varlinkctl is called, the
container may be already terminated. Let's make the container live
infinitely.
Also, this makes the os-release files removed after the container is started.
2024-10-31 10:59:14 +09:00
Yu Watanabe
20e1237ce1 machined: ACQUIRE_METADATA_NO is zero
Follow-ups for a94fbcaa35 and
9de215219c.
2024-10-31 10:59:14 +09:00
Yu Watanabe
f283816acb machine: use sd_json_variant_append_arraybo() and JSON_BUILD_PAIR_VARIANT_NON_NULL()
Follow-up for 45755275e5.
2024-10-31 10:59:14 +09:00
Yu Watanabe
5310cf3354 NEWS: fix typo 2024-10-31 10:58:25 +09:00