Commit Graph

49395 Commits

Author SHA1 Message Date
Mike Yuan
4eec099db8 switch-root: update comment regarding dropped mounts
Follow-up for 07c5c2ab8b
2024-05-16 19:18:59 +08:00
Mike Yuan
2599b32e72 fd-util: check and log error properly for fd_reopen_propagate_append_and_position
Follow-up for b8e25bff38
2024-05-16 19:17:25 +08:00
Yu Watanabe
2e93331605 pe-binary: .initrd section is optional for UKI
.osrel is also optional, but sd-boot and bootctl requires it.
So, let's keep .osrel section at least now.

Fixes #32774.
2024-05-16 12:56:22 +02:00
Zbigniew Jędrzejewski-Szmek
b3aa88a475 Merge pull request #32800 from YHNdnzj/preserve-cred-mounts
switch-root: preserve the whole cred mount tree (/run/credentials/)
2024-05-16 12:45:40 +02:00
Luca Boccassi
b410d2dcab Merge pull request #32857 from dtardon/drop-assert
Drop invalid asserts
2024-05-16 12:04:51 +02:00
Daan De Meyer
452f91d846 core: Skip private /tmp for generators in manager test runs
For manager test runs, the generator output paths are located in
/tmp, which means that if we mount a private /tmp for generators,
we lose all the generated units (actually the generators will just
fail because the directories don't exist, but if they did exist,
we'd still lose all the units).

Let's avoid the problem by skipping the private /tmp for manager
test runs. This also avoids any possible privilege issues with
mounting a private /tmp that might happen in this scenario.
2024-05-16 10:17:00 +02:00
David Tardon
119f22526e journald-server: drop another invalid assert()
config_parse_forward_to_socket() is not used for parsing unit files
either.

Follow-up-for: f31cff849d
2024-05-16 10:10:25 +02:00
David Tardon
2ef7cdc425 journald-server: drop invalid assert()
config_parse_compress() is not used for parsing unit files, hence unit
is always NULL.

Fixes #32856

Follow-up-for: 6813be2eba
2024-05-16 10:10:19 +02:00
Yu Watanabe
60dbecff27 systemctl: fix "applying zero offset to null pointer" UBSan error
Fixes #32837.
2024-05-15 20:24:03 +02:00
Mike Yuan
07c5c2ab8b switch-root: preserve the whole cred mount tree (/run/credentials/)
Currently, during soft-reboot, some services may survive,
but their associated credential mounts are dropped.
Let's instead preserve them, as discussed.
2024-05-16 00:48:16 +08:00
Luca Boccassi
0403065876 Merge pull request #32844 from YHNdnzj/mount-defaultdep-followup
core/mount: correctly set DefaultDependencies=no for mounts from mountinfo
2024-05-15 18:23:26 +02:00
Luca Boccassi
5de20f5619 Merge pull request #32818 from keszybz/libsystemd-network-size-check
Check packet size in libsystemd-network
2024-05-15 17:33:22 +02:00
Mike Yuan
bb5f3e6410 core/mount: correctly set DefaultDependencies=no for mounts from mountinfo
Follow-up for 3c0a1b1e70

Before this commit, DefaultDependencies=no is set in
mount_add_extras(). However, when generating mount units
from /proc/self/mountinfo, we don't have a unit in memory
yet, and mount_setup_new_unit() doesn't call into
mount_add_extras().

Fixes #32838
2024-05-15 22:02:32 +08:00
Mike Yuan
bb33c5da87 core/swap: rename variable 'new' -> 'new_unit'
Follow-up for ba31a5018f

'new' is already used as a macro for memory allocation.
Let's avoid the confusion here.

Addresses https://github.com/systemd/systemd/pull/31902#discussion_r1557672858
2024-05-15 21:54:21 +08:00
Daan De Meyer
d02a41a9d4 core: Fix assertion in parse_smbios_strings() 2024-05-15 13:30:35 +02:00
Luca Boccassi
e0d13e719e Merge pull request #32830 from yuwata/home-skel
home: fix ownership of files copied from skelton directory
2024-05-15 01:26:15 +02:00
Yu Watanabe
05e64ea45d home: fix ownership of files copied from skelton directory
Fixes #32808.
2024-05-15 06:38:41 +09:00
Zbigniew Jędrzejewski-Szmek
e9bdbb6bbc core,vconsole-setup: treat locking failure as non-fatal
Locking of the tty device and then /dev/console was added to synchronize
vconsole-setup with other writers to the console. But it turns out that often
the locking doesn't work and we carved out various cases where we ignore
failure:
- lack of permissions (in the user manager)
- missing device node

It turns out that there's at least one more failure mode: we get -EIO when the
console is (mis-)configured to point to an invalid device. E.g. in
rhbug#2273069 the reporter has a VM in Proxmox without a virtual console
configured and has 'console=tty console=ttyS0' on the kernel cmdline. I
couldn't reproduce this under libvirt, but failure with EIO has been reported
by at least four users in #30501.

Note that in systemd-vconsole-setup we report this is a hard failure, while
in the manager, we only do a debug line. So it's possible that the failure
also occured there, causing the rest of the setup of the tty to be skipped
without further notice.

Ignore the locking failure, since there's just too many ways it can fail. If we
proceed without a lock, we're back to the situation before we started locking,
which wasn't too bad. OTOH, skipping setup of the console is problematic for
users, and it seems better to try to do the setup without locking.

Fixes https://github.com/systemd/systemd/issues/30501,
https://bugzilla.redhat.com/show_bug.cgi?id=2273069.
2024-05-14 23:22:41 +02:00
Luca Boccassi
76fe0035df Merge pull request #32817 from YHNdnzj/core-varlink
core/core-varlink: trivial cleanups
2024-05-14 22:40:01 +02:00
Luca Boccassi
c7bee5b5d2 Merge pull request #32816 from bluca/chores
Chores for RC2
2024-05-14 22:07:40 +02:00
Zbigniew Jędrzejewski-Szmek
1743b8bad1 core/exec-credential: downgrade warning about missing cred to debug
Follow-up for 6b34871f5d.

The general idea is that the list of credentials to load can and will specify
credentials which actually aren't provided, so a warning is too much. Let's
downgrade this to "info". If it turns out to be too noisy, we can downgrade
further in the future.
2024-05-14 20:13:57 +02:00
Zbigniew Jędrzejewski-Szmek
8e41e460e0 test: rename file with stub functions
icmp6-util-linux.c sounds like a specialized implementation of the functions in
icmp6-util.c. But it's just a set of stub versions used in tests. Rename the
file to make this more obvious.
2024-05-14 18:56:41 +02:00
Zbigniew Jędrzejewski-Szmek
b17b91db80 libsystemd-network: use normal style for error checking
We generally use a flat list. The switch stmt was generating excessive
indentation.
2024-05-14 18:56:41 +02:00
Zbigniew Jędrzejewski-Szmek
caa4bfd468 libsystemd-network: check size of icmpv6 packets
Coverity was complaining that we use the received packet size as a loop bound
without checking. This is indeed a bit iffy, because depending on how the host
is configured, the packet could be rather large. Let's refuse anything more
than the standard size early to prevent suspicious activity.

Resolves coverity CID#1534892, CID#1543949.
2024-05-14 18:56:35 +02:00
Zbigniew Jędrzejewski-Szmek
f7a6418d47 libsystemd-network: remove double initialization 2024-05-14 18:55:34 +02:00
Mike Yuan
cd711b6ec9 core/varlink: make manager_setup_varlink_server static
Follow-up for 6906c028e8

Also, use correct log level for varlink_server_add_interface_many().
2024-05-15 00:46:06 +08:00
Mike Yuan
e28501fee2 core/varlink: use FOREACH_ELEMENT more 2024-05-15 00:44:27 +08:00
Luca Boccassi
93df5217b9 tree-wide: 'allows to' -> 'allows one to'
As flagged by Lintian
2024-05-14 18:33:27 +02:00
Luca Boccassi
efcbf3e670 Update syscalls table
ninja -C build update-syscall-tables update-syscall-header
2024-05-14 17:01:08 +01:00
Timo Rothenpieler
00f1714311 cgroup-util: allow cg_read_pid() to skip unmapped (zero) pids 2024-05-14 16:12:20 +02:00
Radoslav Kolev
19614a08d1 libsystemd-network: skip dhcp server test in case of EAFNOSUPPORT
We want to eanble running tests as part of the build, but
our builds run in VMs with networking disabled.
2024-05-14 15:00:29 +02:00
Mike Yuan
2c41722995 Merge pull request #32804 from YHNdnzj/bootspec-modernization
shared/bootspec: some fixes/modernizations
2024-05-14 20:55:52 +08:00
Daan De Meyer
3c0a1b1e70 core: Imply DefaultDependencies=no for credential mounts
Currently, on soft-reboot, /run/credentials/@system is unmounted
because it has DefaultDependencies=yes and as such will have
Conflicts=umount.target and Before=umount.target. Let's make sure
credential mounts survive soft-reboot by implying DefaultDependencies=no
for credential mounts.
2024-05-14 12:42:45 +02:00
Mike Yuan
97dfed142d shared/bootspec: use FOREACH_ARRAY more 2024-05-14 18:19:19 +08:00
Mike Yuan
4ea554e681 shared/bootspec: use isempty where appropriate 2024-05-14 18:19:19 +08:00
Mike Yuan
94e9ae6f53 shared/bootspec: use path_make_absolute where appropriate 2024-05-14 18:19:19 +08:00
Mike Yuan
73a8d8b0ca shared/bootspec: inline iterator var
Also, do not bump 'line' until the end of the loop.
Otherwise, log_syntax() below logs about the wrong
line number.
2024-05-14 18:18:48 +08:00
Mike Yuan
19cb99e74a shared/bootspec: add missing assertions 2024-05-14 18:18:47 +08:00
Radoslav Kolev
381c3b64d0 sd-event: increase test-event timeout to 120s
The test-event test seems to be taking quite a bit more time than
the other 'simple tests', which usually complete in < 1s. In case
of a slower or loaded machine the default 30s timeout is not enough.
2024-05-14 11:34:22 +02:00
Yu Watanabe
171f8d7ba7 dlfcn-util: fix typo
Follow-up for 2f6bd11c1a.
2024-05-14 18:10:46 +09:00
Luca Boccassi
c98f2b8167 bootctl: fix crash when parsing addon without .cmdline section
Follow-up for 706ca67d30
2024-05-14 14:50:58 +08:00
Matt Muggeridge
68adffed02 network: IPv6 Compliance RFC4862: Address Lifetime Expiry (Hosts Only) [v6LC.3.2.2]
RFC 4862 Section 5.5.3, bullet e, sub-bullet 3 applies to existing
addresses, i.e. when address_get() returns success. If the address is
new (i.e. address_get() fails), then we should not be adding 2 hours to
the lifetime_valid_usec. Instead, use the valid_lifetime from the RA's
Prefix Information Option.

This change allows v6LC.3.2.2 to pass. Also verified all v6LC3.2.* tests
pass. This covers all the v6LC tests from Group2: Router Advertisement
Processing and Address Lifetime.

Fixes #32652.
2024-05-14 07:08:43 +09:00
Matt Muggeridge
2d393b1b6d network: IPv6 Compliance: Router Advertisement Processing, Reachable Time [v6LC.2.2.15] (#32792)
Previously, RA option fields were being ignored when the Router Lifetime
value was zero. Remove this logic to be compliant with RFC4861.

Extract from: https://www.ietf.org/rfc/rfc4861.html#section-4.2, p.21,
first paragraph:

    The Router Lifetime applies only to
    the router's usefulness as a default router; it
    does not apply to information contained in other
    message fields or options.

This affected IPv6 Conformance test:
    v6LC.2.2.15: Router Advertisement Processing, Reachable Time.

Fixes #31842.

Co-authored-by: Matt Muggeridge <Matt.Muggeridge@hpe.com>
2024-05-14 06:50:51 +09:00
Lennart Poettering
c5ecf09494 curl-glue: catch libcurl attempting to change timeout handler when we destroy a curl context on exit
If we destroy both an event loop and a curl contect object at the same
time, then we get into this weird situation where curl wants us to
reconfigure a timout event source right before destruction, which
sd-event will refuse however, since it is already being shutdown.

Hence, catch that and simply don't bother adjusting the timeout, since
we cannot get back from there anyway.
2024-05-14 05:29:15 +09:00
Lennart Poettering
ddbfc4d17e machined: return recognizable error when we try to register the same machine name twice 2024-05-13 12:25:22 -06:00
Mike Yuan
d9b8d86bcd core/service: remove unnecessary reset of notify_access_override
This already gets reset in service_enter_dead()
and service_start().
2024-05-14 00:49:59 +08:00
Lennart Poettering
13d6c5de41 varlink: rename vsockCid → vSockCid field 2024-05-14 00:49:45 +08:00
Yu Watanabe
0e2e3fa35a journal-rate-limit: replace in-house management of JournalRateLimitGroup with OrderedHashmap
No functional change, just refactoring.
2024-05-13 19:21:23 +09:00
Yu Watanabe
8df477675d journal-rate-limit: split out journal_ratelimit_group_acquire()
No functional change, just refactoring.
2024-05-12 10:32:14 +09:00
Yu Watanabe
bab044b94b journal-rate-limit: introduce cleanup function for JournalRateLimitGroup
This also makes journal_ratelimit_group_new() use structured initializer.
2024-05-12 10:32:14 +09:00