Commit Graph
70955 Commits
Author SHA1 Message Date
Luca Boccassi 9c41e4eb2f socket-util: check for sysconf() error before using value
Otherwise -1 will be casted to uint32_t. Found by coverity.

CID#1533989

Follow-up for 7e8aa5c2ee
2024-01-30 15:19:16 +00:00
Antonio Alvarez Feijoo 0fa25bd5f4 conf-parser: fix OOM check 2024-01-30 12:46:24 +00:00
Yu Watanabe a342d9e087 nspawn: resolve network interface names before moving to container network namespace
To escape a kernel issue fixed by
https://github.com/torvalds/linux/commit/8e15aee621618a3ee3abecaf1fd8c1428098b7ef,
let's resolve provided interface names earlier, and adjust the interface
name pairs with the result.

Fixes #31104.
2024-01-30 20:37:13 +09:00
Yu Watanabe 3652891c39 sd-device: use new interface name resolvers 2024-01-30 20:37:13 +09:00
Yu Watanabe 4e235561d6 sd-netlink: unify network interface name getter and resolvers
This makes rtnl_resolve_interface() always check the existence of the
resolved interface, which previously did not when a decimal formatted
ifindex is provided, e.g. "1" or "42".
2024-01-30 20:37:04 +09:00
Lennart Poettering e7be86519d sleep: upgrade fatal log message to LOG_ERR 2024-01-30 11:32:56 +01:00
Lennart Poettering 75d2752814 sleep: upgrade some unexpected errors to LOG_WARNING log messages 2024-01-30 11:32:41 +01:00
Lennart Poettering b782080b7a sleep: remove redundant debug log message 2024-01-30 11:31:56 +01:00
Lennart Poettering 032bf2da46 sleep: add mising error message 2024-01-30 11:31:36 +01:00
Zbigniew Jędrzejewski-Szmek 8835a6ff0c man/networkd.conf: remove strange comment
Does anyone even read those pages‽
2024-01-30 11:27:31 +01:00
Zbigniew Jędrzejewski-Szmek 9af1281ed7 pstore: align table 2024-01-30 10:11:30 +01:00
Zbigniew Jędrzejewski-Szmek e9dc98c56b journald: inline one variable declaration 2024-01-30 10:11:30 +01:00
Zbigniew Jędrzejewski-Szmek 2673d6fae0 shared/pretty-print: inline one more variable declaration 2024-01-30 10:11:30 +01:00
Zbigniew Jędrzejewski-Szmek f3663c0ec9 shared/pretty-print: use normal else-if cascade
This is not a hot path, but it seems silly to evalute subsequent branches,
which can never match once one has matched. Also, it makes the code harder to
read, because the reader has to first figure out that only one branch can
match.
2024-01-30 10:11:30 +01:00
Zbigniew Jędrzejewski-Szmek e1054a8bcd bsod: do not use STRLEN
The compiler optimizes strlen away, so we can use the simplest form that is
type safe and more natural. STRLEN is only for array initialization.
2024-01-30 10:11:07 +01:00
Zbigniew Jędrzejewski-Szmek 534fc25ad9 basic/alloc-util: drop unnecessary parens
By definition, a parameter cannot contain a comma because commas
are used to delimit parameters. So we also don't need to use parens
when the use site is delimited by commas.
2024-01-30 10:06:44 +01:00
Mike Yuan 70e80269aa env-util: drop _pure_ for strv_env_get_n
This function calls getenv() internally, making it
non-pure, as envvars can change between two calls
even if passed arguments are the same.
2024-01-30 03:30:02 +08:00
Mike Yuan 17ca151733 env-util: don't use strlen_ptr if known non-NULL 2024-01-30 03:29:53 +08:00
Mike Yuan ed5f10973b notify: warn if notify msg specified along with --booted 2024-01-30 03:28:57 +08:00
Mike Yuan 953134a585 notify: don't exit silently when --exec but no msg
Before this commit, if --exec is used but no message shall
be sent, we silently ignore --exec and exit, which is pretty
surprising. Therefore, let's emit clear error instead.
2024-01-30 03:28:16 +08:00
Mike Yuan 5d4cf5a87d man/systemd-notify: don't say "the latter" if more than 2 options 2024-01-30 03:27:36 +08:00
Mike Yuan a3158ff36e notify: if execve() failed, always show original error 2024-01-30 03:27:36 +08:00
Mike Yuan 7e26863e9c notify: deduplicate ppid handling 2024-01-30 03:27:35 +08:00
Mike Yuan 08ba0a951c notify: minor modernizations 2024-01-30 03:27:35 +08:00
Luca Boccassi 17f3e91e81 Merge pull request #31106 from poettering/bus-creds-pidref
sd-bus: port "sd_bus_creds" object to pidfds and use it everywhere
2024-01-29 19:19:17 +00:00
Lennart Poettering c496e5f67f update TODO 2024-01-29 14:43:22 +01:00
Lennart Poettering a667107594 man: document the new APIs 2024-01-29 14:43:05 +01:00
Lennart Poettering 4ac08d8ad6 tree-wide: port various things over to new pidref helpers
THis not only mkaes a lot of code shorter, but also safer, as we pin the
clients via a pidfd.
2024-01-29 14:42:59 +01:00
Lennart Poettering 1b78be0bb5 bus-util: add helper for getting PidRef structs from bus
This adds two helpers: one for extracting a PidRef from an sd_bus_creds
object, and one from doing this from and sd_bus_message object.
2024-01-29 14:42:42 +01:00
Lennart Poettering 75e00d5e32 sd-bus: tighten rules on sd_bus_query_sender_creds() a bit
Let's always derive credentials from a bus name or a conneciton fd if we
can, because they pin things.

Let's not go via PID really, because it's always racy to do so.

Note that this doesn't change much, since we wouldn't use such augmented
data for auth anyway (because it will be masked in the
sd_bus_creds.augmented mask as untrusted). But still, let's prefer
trusted data over untrusted data.
2024-01-29 14:42:37 +01:00
Lennart Poettering 25fd5343ca sd-bus: also read supplementary gids from bus driver 2024-01-29 14:42:30 +01:00
Lennart Poettering 71be64064c sd-bus: add pidfd to the sd_bus_creds structure
Let's continue with the pidfd'ification, and include pidfd in our
sd_bus_creds structure tha tracks a peers credentials.
2024-01-29 14:41:58 +01:00
Lennart Poettering 7e8aa5c2ee socket-util: start SO_PEERGROUP loop with sysconf(_SC_NGROUPS_MAX), too
We do this for getgroups_malloc() hence we should do this here too,
after all whether we do it for a socket peer or for ourselves doesn't
make too much of a difference.
2024-01-29 14:40:15 +01:00
r-vdp 25e6ce1c11 Fix bug where systemd-tmpfiles gets stuck on fifos in tmp.
Fixes #30690.
2024-01-29 12:16:38 +00:00
Mike Yuan 9561f24282 Merge pull request #31108 from yuwata/core-trivial-cleanups
core: several trivial cleanups
2024-01-28 02:08:54 +08:00
Yu Watanabe 94114711f7 core/service: introduce SERVICE_STATE_WITH_{MAIN,CONTROL}_PROCESS() 2024-01-27 23:08:42 +09:00
Yu Watanabe 6b09c99cba core/socket: introduce SOCKET_STATE_WITH_PROCESS() helper function 2024-01-27 23:08:42 +09:00
Yu Watanabe 28364bc324 core/unit: update outdated comment
Follow-up for 37eb258e91.
2024-01-27 23:08:26 +09:00
Daan De Meyer 09e6921758 units: Order pcrlock services after systemd-remounts-fs.service
These write to /var and as such need to wait until after the rootfs
has been remounted read-write.
2024-01-26 21:15:59 +00:00
David Venhoek 678bd12cfc timesyncd: make the transmit timestamp in requests fully random
This improves security against off-path attackers, and avoids leaking
the current system time.
2024-01-26 21:14:57 +00:00
Frantisek Sumsal 56cdf81a72 test: use lstat() instead of stat(follow_symlinks=False)
This makes the test compatible with Python 3.9, as the follow_symlinks
keyword was introduced in Python 3.10.
2024-01-26 21:13:28 +00:00
Luca Boccassi 9f177a38ab Merge pull request #31105 from mrc0mmand/test-nspawn
test: set -ex separately
2024-01-26 21:13:15 +00:00
Lennart Poettering 00f329f4b0 update TODO 2024-01-26 21:42:39 +01:00
Frantisek Sumsal d2e8dc780f test: clean up the code a bit 2024-01-26 18:09:09 +01:00
Frantisek Sumsal 7990028468 packit: add a libarchive runtime dependency too
Addresses https://github.com/systemd/systemd/pull/31075#issuecomment-1911117026:

[   40.039232] testsuite-50.sh[624]: ++ systemd-dissect --make-archive /tmp/tmp.RZEq3t/minimal_0.raw
[   40.044745] testsuite-50.sh[625]: ++ sha256sum
[   40.066693] systemd-dissect[621]: libarchive.so.13 is not installed: libarchive.so.13: cannot open shared object file: No such file or directory
[   40.068577] systemd-dissect[621]: Archive support not available (compiled without libarchive, or libarchive not installed?).
[   40.092242] systemd-dissect[624]: libarchive.so.13 is not installed: libarchive.so.13: cannot open shared object file: No such file or directory
[   40.095716] systemd-dissect[624]: Archive support not available (compiled without libarchive, or libarchive not installed?).
[   40.100510] testsuite-50.sh[538]: + test e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 '!=' ''
[   40.100510] testsuite-50.sh[538]: + test e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
[   40.108249] testsuite-50.sh[627]: + tar t
[   40.113791] testsuite-50.sh[626]: + systemd-dissect --make-archive /tmp/tmp.RZEq3t/minimal_0.raw
[   40.120300] testsuite-50.sh[628]: + grep etc/os-release
[   40.176288] systemd-dissect[626]: libarchive.so.13 is not installed: libarchive.so.13: cannot open shared object file: No such file or directory
[   40.180273] systemd-dissect[626]: Archive support not available (compiled without libarchive, or libarchive not installed?).
[   40.184017] testsuite-50.sh[627]: tar: This does not look like a tar archive
[   40.185430] testsuite-50.sh[627]: tar: Exiting with failure status due to previous errors

Follow-up for b68f4ca.
2024-01-26 16:10:00 +01:00
Frantisek Sumsal 8ee32f688f test: fix the container ID check
It never worked, but the fail was masked by missing set -e, see the
previous commit.

Also, throw env into the test container and dump the environment on
container start, to make potential failures easier to debug.
2024-01-26 15:44:39 +01:00
Luca Boccassi 34bbda18a5 man: add working example for sd_bus_set_watch_bind()
This example is able to deal with D-Bus going away and reappearing,
like on soft-reboot, so link it in both manpages.
2024-01-26 14:41:20 +00:00
Frantisek Sumsal 7b1c292953 test: set -ex separately
We call the entrypoint.sh script using `bash entrypoint.sh`, so -ex from
the shebang won't be used in that case. Whoopsie.
2024-01-26 15:29:49 +01:00
Luca Boccassi 343e35b36d core: add SYSTEMD_VERITY_SHARING env var for local development
When running an image that cannot be mounted (e.g.: key missing intentionally
for development purposes), there's a retry loop that takes some time
and slows development down. Add an env var to disable it.
2024-01-26 10:14:15 +00:00
Daan De Meyer 20eeec72ed Merge pull request #31095 from bluca/test_time_tz
test: unset TZ before timezone-sensitive unit tests are run
2024-01-26 09:02:34 +01:00