1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-04 17:47:03 +03:00

70034 Commits

Author SHA1 Message Date
Luca Boccassi
81930bc091 semaphore: speed up build
- avoid stripping debug symbols and creating dbgsym packages
- avoid LTO, slows down build a lot
- avoid compressing packages, they are thrown out immediately after use
- avoid building udeb packages, not needed

(cherry picked from commit 7eedcb4e3ba34487d128abd3c86e0467bbd0bc92)
2024-10-09 16:18:12 +01:00
Ronan Pigott
a8d83342f8 load-fragment: terminate the specifier table (#34421)
Otherwise an invalid specifier iterates over uninitialized data.

Fixes a bug introduced by 0b40688d1830abc6f59b1f1f67eccd757c23eb09 (v254).

(cherry picked from commit 32b8065e876c6f89f55b1bb30eeb442d3921fb3a)
(cherry picked from commit 5dc97968d6ef732508311ecff555b305a05b6fe5)
2024-10-09 16:18:12 +01:00
Mike Yuan
9cf6035d14 various: correct laccess() error check
laccess is our own macro that uses RET_NERRNO.

(cherry picked from commit 7c1dd9e288047a69d4a6a6dd6585725410cfdadd)
(cherry picked from commit 4296a567d48ee43917b4f338fa1e927ffd53b36b)
2024-10-09 16:18:12 +01:00
Lukas Nykryn
3b0731b9d4 core: warn if a generator is world-writable
... because that is obviously a security risk.

(cherry picked from commit da32cac8a014ddf048fc7bad84dafdbc204d4dc8)
(cherry picked from commit 7ac58949a37db3ddb662908d3aadaf5934fec222)
2024-10-09 16:18:12 +01:00
Yu Watanabe
d0569c4405 test: add test case for issue #34637
(cherry picked from commit 88d186e4829bc7ef4a4253fe2bf4857903bca830)
(cherry picked from commit 7b9e412d8aba8f415f35d02da5e5fa5bd92632cc)
2024-10-09 16:18:12 +01:00
Yu Watanabe
54bc0dab04 udev-node: skip stack directory creation for diskseq
The disk/by-diskseq symlink should not be shared with multiple block
devices. Hence, it is not necessary to create stack directory for the
symlink that manages which device owns the symlink.

This is not just a optimization.
If a service unit tries to mount a disk image but the service fails, then
the diskseq of the loop device for the image may be continuously increased
during restart, and inodes in /run may increase rapidly, as the stack
directories are cleaned up only when udev queue is empty.

Fixes #34637.

(cherry picked from commit 09373c1a50297079e6b0447ea97af4e9a60f77fa)
(cherry picked from commit 02a5e5a32338869cc0ac352da81cf6d83da5c9e9)
2024-10-09 16:18:12 +01:00
Daniel Martinez
129c30beb6 Use case insensitive comparison for the machine's architechture
boot loader specification states:

architecture: refers to the architecture this entry is for. The argument
should be an architecture identifier, using the architecture vocabulary
defined by the EFI specification (i.e. IA32, x64, IA64, ARM, AA64, …).
If specified and it does not match the local system architecture this
entry should be hidden. The comparison should be done case-insensitively.

Example: architecture aa64

https://uapi-group.org/specifications/specs/boot_loader_specification/#type-1-boot-loader-entry-keys
(cherry picked from commit f819a516dbbddb16724f33dcef5badcb6fe8b80b)
(cherry picked from commit d65b7426e93e50c470173614c2eaca094f318ab5)
2024-10-09 16:18:12 +01:00
Michal Koutný
5184f867e4 test: Add test for per-device cgroup properties
Reported in #34126

(cherry picked from commit 321637743313f896e275fd038996b8cfb5a070b3)
(cherry picked from commit 84cd501ae4d2689ac39e510d1d33b7e3234f5199)
2024-10-09 16:18:12 +01:00
Daan De Meyer
4a22a9e11b chase: Fix shortcut
We can't shortcut chaseat() if CHASE_PARENT is set.

(cherry picked from commit 87333bd1dc69195b93e9aee9b91c06fb167b152e)
(cherry picked from commit 83f7bced66041624a16a7b13a1405b9f9684c257)
2024-10-09 16:18:12 +01:00
Daan De Meyer
2b50ba47c2 repart: Don't copy root directory mode from source file
If the source is a file, don't copy the mode and such from it to
the root directory, even if the target is /.

(cherry picked from commit 413d3ce1b76b42ba691eea54cd1704b14602442e)
(cherry picked from commit 52fa3b52bd7bda59912136916c91f3487b1924cc)
2024-10-09 16:18:12 +01:00
Jörg Behrmann
7cc52eb6e1 man: Use proper conjunction and remove superfluous or
(cherry picked from commit 56f32d9e782f8ba43f17cb04687c915a7e41d10e)
(cherry picked from commit 5b5f5666b2fd32950325387a3e0bc0b60f0b1808)
2024-10-09 16:18:12 +01:00
Luca Boccassi
42521e2d2d man: consolidate list of active unit states into a shared table
Avoids the need to maintain the same list over and over again, and
link it to the defition table in the implementation as a reminder
too

(cherry picked from commit 3509fe124d3a4fe2934028f83ae156ade050c8fe)
(cherry picked from commit 1075727f7fe9436d2e468147cf663aaa1be867fd)
2024-10-09 16:18:12 +01:00
Lukas Nykryn
02447d2888 man: using WantedBy=default.target is not a good idea
We had several users, that wrote their unit files with
WantedBy=default.target because it should be started "every time".
But for example in Fedora/CentOS/RHEL, this often breaks for
example selinux relabels (where we just want to do a relabel and reboot).

(cherry picked from commit 67b6404b80cf8078f3d9ec6d4c2f34ac25b15077)
(cherry picked from commit adc57cd81c02e5afc8efcbc64eb3a6305a97c62c)
2024-10-09 16:18:12 +01:00
Daan De Meyer
44e3f1cc35 tree-wide: Fix Wformat warnings
The latest clang has started catching more integer promotions which
cause us to pass the wrong type to printf() format specifiers so let's
fix those.

(cherry picked from commit c73d14c43e7998ca54011875ad25afc634d57498)
(cherry picked from commit e129e3a8618b1b56f70978cb1db1d66a0fdcd573)
2024-10-09 16:18:12 +01:00
Lennart Poettering
bb0091dd91 man: drop reference to /bin/ from docs regarding binary search path
We don't support "split /usr" systems anymore, hence no point in
mentioning /bin/ anymore as being part of the binary search path.

(cherry picked from commit f39e66b85a4a97818a618758e34019d052aeb772)
(cherry picked from commit 96c0549bda0c2fc682a9dee308ad1a90d2ebd422)
2024-10-09 16:18:12 +01:00
Lennart Poettering
9496ea860c man: soft deprecate use of ";" for separating multiple command lines in ExecStart=
So far we supported this syntax:

    ExecStart=foo ; bar

as equivalent to:

    ExecStart=foo
    ExecStart=bar

With this change we'll "soft" deprecate the first syntax. i.e. it's
still supported in code, but not documented anymore.

The concept was originally added to make things easier for 3rd party
.ini readers, as it allowed writing unit files with a .ini framework
that doesn't allow multiple assignments for the same key. But frankly,
this is kinda pointless, as so many other of our knobs require the
double assignment.

Hence, let's just stop advertising the concept, let's simplify the docs,
by removing one entirely redundant feature from it.

Replaces: #34570
(cherry picked from commit 225f18b9a9d39331ea862478ab2ff893678e249d)
(cherry picked from commit aeda397aedc02d32672cb10402b0b63e64b7a17e)
2024-10-09 16:18:12 +01:00
Lennart Poettering
82019cc691 tree-wide: always do dlopen() with RTLD_NOW + RTLD_NODELETE
Let's systematically use RTL_NOW|RLTD_NODELETE as flags passed to
dlopen(), across our codebase.

Various distros build with "-z now" anyway, hence it's weird to specify
RTLD_LAZY trying to override that (which it doesn't). Hence, let's
follow suit, and just do what everybody else does.

Also set RTLD_NODELETE, which is apparently what distros will probably
end up implying sooner or later anyway. Given that for pretty much all
our dlopen() calls we never call dlclose() anyway, let's just set this
everywhere too, to make things systematic.

This way, the flags we use by default match what distros such as fedora
do, there are no surprises, and read-only relocations can be a thing.

Fixes: #34537
(cherry picked from commit bd4beaa2ebfbbec0a1263a7091a91e528ce8cf13)
(cherry picked from commit e012eedd727a38bd18c9a540b92b95aa880d2b42)
2024-10-09 16:18:12 +01:00
Helmut Grohne
ec4619d2c2 bpf: fix cross build failure on Debian
For compiling bpf code, the system include directory needs to be
constructed. On Debian-like systems, this requires passing a multiarch
directory. Since clang's -dump-machine prints something other that the
multiarch triplet, gcc was interrogated earlier, but that also yields a
wrong result for cross compilation and was thus skipped resulting in
clang not finding asm/types.h.

Rather than, -dump-machine we should ask for -print-multiarch (which
rarely differs). Whenever gcc is in use, this is right (even for cross
building). Since clang does not support -print-multiarch and its
-dump-machine never matches Debian's multiarch, we resort to asking gcc
when building natively. For cross builds using clang, we are out of
luck.

(cherry picked from commit 608009dc6218f7c41420f665586f2449b64a08f7)
(cherry picked from commit 1bd02a6e04270e6f01909cdc8b4e968f95ce5d4b)
2024-10-09 16:18:12 +01:00
Marcel Hellwig
a422935fe0 Update sd_bus_message_append_array.xml
fix pointer constness in documentation

(cherry picked from commit fec09ff094670a6903b12b1c599b00b39a2b0c88)
(cherry picked from commit 072ea04e26c84ac25419316c659f4d89d8002f34)
2024-10-09 16:18:12 +01:00
Daan De Meyer
3697aa81ea Add %posttrans versions of the systemd %postun scriptlets
On upgrades, only the %postun scriptlets of the old package version
run. This means that any changes related to restarting daemons require
two releases before they're actually used.

%postun is used because it runs after the old package has been removed,
which is important as it means any lingering dropins from the old package
will have been removed as well.

To allow deploying fixes in just a single release while still running after
the old package has been removed, let's introduce %posttrans versions of these
scriptlets as %posttrans of the new package runs on upgrade and install after
the old package has been removed.

(cherry picked from commit 9fd8a9dffe9b8f29da52e4e1481926bceed5ce6c)
(cherry picked from commit d1f11d909f673ade60a4e66a4733c200f9013be3)
2024-10-09 16:18:12 +01:00
Lennart Poettering
f353d09b9d man: add a comment that inode type policy might be enforces via an LSM or similar
Just to tighten the language a bit, why people should care about where
they place their inodes.

(cherry picked from commit 5b53894123b9d01f5738b02befd4189625c5451f)
(cherry picked from commit 4bdbfb3dd4c45720357d066fa8e4f65bccc610f6)
2024-10-09 16:18:12 +01:00
Lennart Poettering
caa153615e man: clarify that the defined file hiearchy is just a skeleton
(And specifically mention /usr/include + /var/spool as not covered here,
but being OK to add downstream)

(cherry picked from commit fd6e079e7b296696028c161224d2a86fce70726f)
(cherry picked from commit c14890f588745a87c7b4a9a7ed0991e03a7b91ea)
2024-10-09 16:18:12 +01:00
Lennart Poettering
6dd8eb72c2 man: drop /var/spool/ mention from file-hierarchy(7) man page
Today it seems this is mostly used by mail and printer servers, and it's
not clear to me at all what the property is that makes
/var/spool/<package> the better place for the relevant data than
/var/lib/<package>.

Hence, in the interest of shortening the spec, let's not mention the dir
anymore. In particular as the dir really isn't used by us much, for
example we do not have a counterpart for RuntimeDirectory=,
StateDirectory=, … that would cover the spool.

Since most systems these days we care about probably come *without* a
printer or mail server, let's maybe no mention this in the man page that
is supposed to discuss the rough skeleton how things are set up. After
all, people are supposed to exend the skeleton with their stuff, and
this sounds more like a case for an extension of the skeleton instead of
being considered part of the skeleton itself.

(cherry picked from commit b0201b36d2e0181d08530aaad496322812c4e77e)
(cherry picked from commit 82783a3c5fd262c9006a5f9091a4875b1dad1c5a)
2024-10-09 16:18:12 +01:00
Lennart Poettering
f813e842fa man: drop mention of /usr/include/ from file-hierarchy(7) man page
The man page is supposed to provide a "generalized, though minimal and
modernized subset" (as per introductory pargapraghs), from a systemd
perspective. But the thing is that /usr/include/ really doesn't matter
to us. It's a development thing, and slightly weird (because it arguably
would be better places in /usr/share/include/ or so). It's not going to
be there on 95% of deployed systems, and we really don't want people to
bother with it on such systems.

We only define the skeleton of directories in this document, and it's
expected that people extend it, and I think this really should be one of
those dirs that is an extension of our skeleton, but not part of the
skeleton, if that makes any sense.

(cherry picked from commit 9e7b691073922433a71cf49dcaaf7f9f61f58e6d)
(cherry picked from commit e5ac408af76ca1b6827de08a1960970a7d8db15d)
2024-10-09 16:18:12 +01:00
Zbigniew Jędrzejewski-Szmek
64d833dfa6 systemctl: fix printing of RootImageOptions
The type is a(ss), so a custom printer is required.

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

(cherry picked from commit 69c751c61cb2b386afe51f03b58f8f7ceeeb643e)
(cherry picked from commit 28ced52894cf6921d1fe9831f2def29de164e189)
2024-10-09 16:18:12 +01:00
Mickaël Salaün
a3705b6981 seccomp-util: include @sandbox in @default
Every services and containers should be able to protect their users and
limit the impact of security bugs thanks to the security syscalls
provided by seccomp and Landlock.  The goal of these syscalls is to
improve security with additional restrictions.  They are designed to be
safely used by unprivileged (and then potentially malicious) users.

Remove the now-redundant "seccomp" entry for nspawn.

(cherry picked from commit e9966634754b8c9ee3f3c579f25d938e185c282e)
(cherry picked from commit c53c1a0fac49645588409a0a4917b2f12a5d5910)
2024-10-09 16:18:12 +01:00
Zbigniew Jędrzejewski-Szmek
54ccd49876 man: fix formatting in file-hierarchy
Somebody wrapped the text, but whitespace is preserved in <programlisting>, so
the output was mangled. It also doesn't make sense to run systemd-path as root
(as indicated by '#'), so drop that. Also, this chunk should be a separate
paragraph.

(cherry picked from commit 1ca81b2e005ccef6e9ddf06c3e3441bae0a6e1d5)
(cherry picked from commit 53b5032ffdb4f619560d69d033ef309784c41f1f)
2024-10-09 16:18:12 +01:00
Nils K
0d25e8b030 Fix reference to FileDescriptorStoreMax= directive
(cherry picked from commit 543015a164c1fbf22c13c357efb180cf1adc5f03)
(cherry picked from commit c1431b7eff6f8d6b0d571c1ec7bfc49cefbba1f4)
2024-10-09 16:18:12 +01:00
Ivan Kruglov
b71956482c machine: resolve race condition in TEST-13-NSPAWN.machinectl.sh
I encountered this race condition while working on TEST-13-NSPAWN.varlinkctl.sh.
The long-running machine's init script sometimes does not have time to start and
register signals. As result, occasiounally failed tests.

(cherry picked from commit e826a8bed447f3b3f9ad487f96ab7f8c7620c75b)
(cherry picked from commit 0cd10d410b49303894c48521c0629b97e72b43bc)
2024-10-09 16:18:12 +01:00
Simon Pilkington
6a6cf125da creds: fix cat with encrypted credentials
Fixes: https://github.com/systemd/systemd/issues/34547
(cherry picked from commit 32951fe4de683f5d42cec2fb2e036f766b051e2b)
(cherry picked from commit bc0ba0030b83cea3c5bf62695bb70f406fe6d12d)
2024-10-09 16:18:12 +01:00
Daan De Meyer
d371cb4725 repart: Determine verity sig size based on partition designator
Verity= is an image build concept, not a first boot concept, whereas
a partition designator is always available, so let's do the size stuff
based on that.

(cherry picked from commit e11745d000d7e9b3112bb336735c1bdfa77e9add)
(cherry picked from commit 4143bc70ed7d131cda9f0aa2f86d4aedd38e0fce)
2024-10-09 16:18:12 +01:00
Michal Koutný
f45acd05be core/cgroup: Apply IODevice*= directives in configured order
Different device paths may resolve to same device node
(lookup_block_device()), e.g.
        IOReadBandwidthMax=/dev/sda1 18879
        IOReadBandwidthMax=/dev/sda2 18878
where both partitions resolve to /dev/sda and when these values are
applied (they are associated with original paths, i.e. as if applied for
different device) in the order from io_device_limits.

The parsing code prepends, so they end up in reverse order wrt config
file. Switch the direction so that the order of application matches the
order of configuration -- i.e. semantics in all other unit file
directives.

Apply same change to all directives that use per-device lists. (The
question whether partitions should be resolved to base device is
independent.)

And apply the changes equally to DBus properties write handlers.

Fixes #34126

(cherry picked from commit 0fa0dfa04465651a18107d503f9967f84bd761d1)
(cherry picked from commit 00dfa7964b5e48a37596207ad8b2862b157cffaf)
2024-10-09 16:18:12 +01:00
Zbigniew Jędrzejewski-Szmek
964e68bf27 man: say that SYSEXT_SCOPE=initrd also applies to exitrds
We generally do _not_ want the same sysexts to be loaded in both initrd and
exitrd phases. The environment is completely different and it's unlikely that
the same code can be useful in both places. Nevertheless, it can be useful in
_some_ cases, for example when the sysexts contains debugging tools.

I think we don't need to differentiate between initrds and exitrds through
SYSEXT_SCOPE, because the two types are made available in completely different
locations and loaded through a different mechanism, with very little chance of
an initrd being loaded as an exitrd without an explicit admin action (or the
other way around). So let's not complicate our code or definitions by an
explicit "exitrd" sysext designator, but just clarify that "initrd" also
encompasses exitrds in this context.

(cherry picked from commit 7352a0093f4ef96c361be22337cde3296d79da01)
(cherry picked from commit 2cd8079efabb8f17e6e58f1fd6c051d388648146)
2024-10-09 16:18:12 +01:00
Zbigniew Jędrzejewski-Szmek
8980c12317 man: slightly enhance docs about "exitrd" and remove TODO entry for it
The concept is fairly well established and present in our docs in various
places.

Say that the exitrd is also marked by the presence of /etc/initrd-release.

(cherry picked from commit ace26a511ff63dbc15f1b2b0b941cbd3294a288c)
(cherry picked from commit b78f99e71b5ffa57caa5508e871ba17a6ff686d7)
2024-10-09 16:18:12 +01:00
Daan De Meyer
baf1840666 repart: Add a log message when we're about to fsync().
(cherry picked from commit f3b8e81f5443fefb1dd2bb62d6b41c2559dca475)
(cherry picked from commit 08cf1c5ce525bcf52548a8b3713b71cda7545c20)
2024-10-09 16:18:12 +01:00
Daan De Meyer
cef973c15d Add an extra debug log to dissect_image()
(cherry picked from commit 0121b84e41cd187e44c275a23db1a656656ec37f)
(cherry picked from commit efd5e357d7ed6b7def0d12631835efd6a5bf5f5a)
2024-10-09 16:18:12 +01:00
Yu Watanabe
b054898f12 sd-ipv4acd: fix assertion triggered when an ARP received in STARTED state
When a network is busy, an ARP may be received before the timer event
source triggered first time.

Fixes #34489.

(cherry picked from commit 146b44d0a0001712ced2f22ca76d242eedac26ad)
(cherry picked from commit 06eb9b14829f3a5819f6daefb09fdb855cd868f4)
2024-10-09 16:18:12 +01:00
Mike Yuan
56f4272ac7 tmpfiles: ERRNO_IS_NOINFO -> _IS_NEG_, correct negative errno checks
(cherry picked from commit 755877f20a2e18d1a2c4149662c2caec80230879)
(cherry picked from commit 7884db1b93754901750f21cf1c04e38be0e94f11)
2024-10-09 16:18:12 +01:00
cvlc12
75e6be9d42 man: update PCR and Secure Boot key names and paths
(cherry picked from commit dbf5b09de40a9d22b67611524bea12feae657462)
(cherry picked from commit f535bbea13d93028c30f64dfac22ddac6e705f9d)
2024-10-09 16:18:12 +01:00
Yu Watanabe
299c64d8c2 test: add tests for seccomp_suppress_sync()
(cherry picked from commit c07e10628b6add9ee9664956a28d3f727c9848f8)
(cherry picked from commit 308c93c51f85f1b6a5e6a3def951fa8e5643048d)
2024-10-09 16:18:12 +01:00
Yu Watanabe
04a54264be seccomp-util: pass negative fds as is to fsync() and friends
Closes #34478.

Co-authored-by: Mike Yuan <me@yhndnzj.com>
(cherry picked from commit 144fbbac235b6b89d5d31795be1cc0dca9852ccc)
(cherry picked from commit 4bbd6f589ad97a0df6ab59e03c8c535d298d05eb)
2024-10-09 16:18:12 +01:00
Luca Boccassi
5ce348ab30 portable: ensure PORTABLE_FORCE_ATTACH works even when there is a leftover unit
Force means force, we skip checks with PID1 for existing units, but
then bail out with EEXIST if the files are actually there. Overwrite
everything instead.

(cherry picked from commit 1e2d1a7202400e08a00782f32804fdc503259806)
(cherry picked from commit 2552348da2c961ac9732614eb129228bba4d51da)
2024-10-09 16:18:12 +01:00
Luca Boccassi
5f934ae220 test: mount ld.so.cache in minimal nspawn container if present
In some cases (SUSE Tumbleweed) this is needed as a library (libz) is
not in the default path, so it fails to run.

(cherry picked from commit 1e17e48b96bb509754a0a11ea8bd0394965564c6)
(cherry picked from commit a2c84836efc5216e99af4c3e4ba3f6c2be7e67e1)
2024-10-09 16:18:12 +01:00
Luca Boccassi
799ecea375 hwdb: update to main@{2024-09-10}
git restore -s origin/main hwdb.d/ test/hwdb.d

(cherry picked from commit f13e3a93d7c2c549ff9a83cdbb04c30ab9e46bea)
v255.12
2024-09-10 22:33:00 +02:00
Yu Watanabe
a505f10b4b tree-wide: check if non-empty password is acquired
(cherry picked from commit 204529d0fcde9a95119b489225620f36649c2f5b)
(cherry picked from commit e80e9dce63787d1d4494ed65d7c27018344387d5)
2024-09-10 22:33:00 +02:00
Yu Watanabe
553d5b03bd ask-password: refuse empty password strv
Fixes #34270.

(cherry picked from commit 623a8b1922bdbd2fb06bc5f2c67d3d6930efc58e)
(cherry picked from commit 34881c9d5afdd05e9e6f1824cbea9d1954ea80c0)
2024-09-10 22:33:00 +02:00
Yu Watanabe
6c44b31673 test: fix indentation
(cherry picked from commit fe6049d0210c89a595ae598d87dcefe7bfbe3a1d)
(cherry picked from commit dda8cb4a8ef702ba526f0c2021c92fa85431330b)
2024-09-10 22:33:00 +02:00
Yu Watanabe
fbfe769c45 test: add test case for systemd-repart --seed=random
For issue #34257.

(cherry picked from commit 56d6ebd40468e2a743b39ad7d87b0675bdf9a042)
(cherry picked from commit 69282da9aab90c2dc1e440b04af5b2163779515a)
2024-09-10 22:33:00 +02:00
Yu Watanabe
175dafa27b repart: initialize seed earlier
As the seed is used by context_load_partition_table() -> derive_uuid().

Fixes #34257.

(cherry picked from commit b8a8000aba4620a1d93ac1d04dbb86050d9c5fe8)
(cherry picked from commit f85a4fba330822c44f9b2deb527acecc03bcfed9)
2024-09-10 22:33:00 +02:00
Yu Watanabe
bc72d9557c nspawn: refuse to bind mount device node from host when --private-users= is specified
Also do not chown if a device node is bind-mounted.

Fixes #34243.

(cherry picked from commit efedb6b0f3cff37950112fd37cb750c16d599bc7)
(cherry picked from commit a23591891b9e85107f39d103eabbb5bc9a6ced6f)
2024-09-10 22:33:00 +02:00