Commit Graph

6713 Commits

Author SHA1 Message Date
Yu Watanabe
8e091ec420 basic/linux: import prctl.h from linux 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe
6e338c25d8 missing_network: drop unnecessary definitions
They are already defined in glibc-2.31.
2025-03-04 02:24:49 +09:00
Yu Watanabe
b4ea2e7249 missing_namespace: drop unnecessary entries
Our kernel baseline is 5.4.
2025-03-04 02:24:49 +09:00
Yu Watanabe
dc1a78a462 basic/linux: import loop.h from kernel 6.14-rc4, and drop missing_loop.h 2025-03-04 02:24:49 +09:00
Yu Watanabe
fa716b6fc7 missing_keyctl: import keyctl.h from kernel 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe
e7e91769e8 basic/linux: import ioprio.h from kernel 6.14-rc4
This also fixes the maximum allowed ioprio class: 8 -> 7
2025-03-04 02:24:49 +09:00
Yu Watanabe
87fb62f598 missing_input: replace the header with genuine linux header 2025-03-04 02:24:49 +09:00
Yu Watanabe
4dbaa211b5 basic/linux: import hidraw.h and hid.h from linux-6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe
1b8f8a2d30 missing_fs: drop unnecessary entries
Now our kernel baseline is 5.4.
2025-03-04 02:24:49 +09:00
Yu Watanabe
c5cba760cf missing_fcntl: drop definitions covered by glibc-2.31
Note, this also fixes the definition for O_TMPFILE for parisc and hppa,
it should be 040000000 (seven zeros) rather than 0400000000 (eight zeros).
2025-03-04 02:24:49 +09:00
Yu Watanabe
883360f63a missing_type: char16_t and char32_t are always defined in uchar.h since C11
Now, we use C17, hence the fallback definitions can be dropped.
2025-03-04 02:24:49 +09:00
Yu Watanabe
905497c86d missing_stdlib: secure_getenv() exists since glibc-2.17 2025-03-04 02:24:49 +09:00
Yu Watanabe
e79d88320a alloc-util: reallocarray() exists since glibc-2.26 2025-03-04 02:24:49 +09:00
Yu Watanabe
6b557580fe missing_syscall: drop unnecessary definition of AT_EMPTY_PATH
It is defined since glibc-2.14 (46998f745736b3c8df5901a27b6c2a19f5cc5e98),
and the value was never changed.
2025-03-04 02:24:49 +09:00
Yu Watanabe
1d917ba421 missing_syscall: drop unnecessary ifdefs for syscall number
Nowadays, we define syscall numbers for newer syscalls.
Hence the conditions are not necessary.

This also adds several comments about when syscalls are introduced.
2025-03-04 02:24:49 +09:00
Yu Watanabe
2a6e117ddb missing_syscall: drop unnecessary syscall number definitions 2025-03-04 02:24:49 +09:00
Yu Watanabe
fbfe09ccd0 missing_syscall: drop unused rt_sigqueueinfo wrapper
The syscall is unused since 19e1a908b5.
2025-03-04 02:24:49 +09:00
Yu Watanabe
177f168f43 missing_syscall: copy_file_range is supported by glibc since 2.27
Now our baseline of glibc is 2.31, hence it is OK to drop our
definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
f2786bd3e7 missing_syscall: renameat2 is supported by glibc since 2.28
Now our baseline of glibc is 2.31, hence it is OK to drop our
definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
d322854cac missing_syscall: setns is supported by glibc since 2.14
Also, CLONE_PIDFD is defined in sched.h since 2.31.
Now our baseline of glibc is 2.31, hence it is OK to drop our
definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
96ff465861 missing_syscall: name_to_handle_at is supported by glibc since 2.14
Now our baseline of glibc is 2.31, hence it is OK to drop our
definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
65e844bdb8 missing_syscall: gettid is supported by glibc since 2.30
Now our baseline of glibc is 2.31, hence it is OK to drop our
definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
69a5c4b14c missing_syscall: getrandom is supported by glibc since 2.25
Now our baseline of glibc is 2.31, hence it is OK to drop our
definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
6ca5be8d3f missing_syscall: memfd_create() is supported by glibc since 2.27
Now, our baseline of glibc is 2.31, hence it is OK to drop it.
2025-03-04 02:24:36 +09:00
Lennart Poettering
1965d2b222 io-util: fix ppoll_usec() bypass
If a non-zero timeout is specified we should not bypass ppoll() even if
no fds are specified, since it will still act as a time based sleep in
that case.
2025-03-03 10:47:09 +01:00
Lennart Poettering
789f4f7ee0 tty-askpw-agent: react to SIGTERM while waiting for console
I noticed that systemd-tty-password-agent would time out when asked to
stop via SIGTERM, and eventually be killed, under some circumstances.
It took me a while but i figured out what was going on:

systemd-ask-pw-agent blocks SIGTERM because it wants async notifications
on SIGTERM via signalfd() to listen on. That mostly works great: except
for one case: if we actually get a pw query request, and hence need to
acquire the terminal: we issue open_terminal() in that case, but if the
terminal is used otherwsie we'll hang, and because SIGTERM is blocked
we'll hang and cannot exit cleanly.

Address that: optionally, in acquire_terminal() look for SIGTERM by
unblcking the signal mask via ppoll() while we wait.
2025-03-03 10:47:09 +01:00
Yu Watanabe
aaa5065d8f bump minimum required version of glibc to 2.31, and drop many fallback logic around statx() (#36558)
glibc-2.31 was released on 2020-02-01, which is more than 5 years ago.
Let's also bump the baseline of glibc.
2025-03-01 04:18:17 +09:00
Lennart Poettering
8a69330e54 homed: port to notify_recv() + convert to PidRef (#36557)
Just some refactoring/modernization
2025-02-28 17:00:31 +01:00
Yu Watanabe
ee739ea692 mountpoint-util: make statx() failure critical
Two error conditions are unreachable, as now both glibc and kernel
support statx(). In other many places, failure in statx() are handled as
critical, even if it is filtered by seccomp or so. Let's follow the same
way here.
2025-03-01 00:40:22 +09:00
Yu Watanabe
d5ddc0e0d3 stat-util: drop statx_fallback()
Now both our required baseline of glibc and kernel support statx.
2025-03-01 00:33:32 +09:00
Yu Watanabe
4424e6c811 tree-wide: drop workarounds for statx()
struct statx in glibc header was introduced in glibc-2.28
(fd70af45528d59a00eb3190ef6706cb299488fcd), but at that time,
sys/stat.h conflicts with linux/stat.h. Since glibc-2.30
(5dad6ffbb2b76215cfcd38c3001778536ada8e8a), sys/stat.h includes
linux/stat.h if exists.

Since now our baseline of glibc is 2.31. Hence, we can drop workarounds
for struct statx by importing linux/stat.h from newer kernel (v6.14-rc4).
2025-03-01 00:33:28 +09:00
Yu Watanabe
a3d0471b03 basic/linux: update kernel headers from v6.14-rc4 2025-02-28 23:38:45 +09:00
Yu Watanabe
91421f8379 recurse-dir: fix wrong assertion and error code in log
Fixes a bug in b5a07e524e (v250).
2025-02-28 23:37:52 +09:00
Lennart Poettering
09b3390529 pidref: take more fields into account in pidref_compare_func() 2025-02-28 14:18:20 +01:00
Lennart Poettering
2ad187fb68 pidref: export hash funcs
That way we can use them for definition of additional hash_ops that map
pidrefs to arbitrary other resources.
2025-02-28 14:18:07 +01:00
Lennart Poettering
46bd501faa Issue OSC ANSI sequence whenever we change "context" of a TTY, i.e. acquire privs, enter container or VM or similar (#35224)
This is mostly a strawman to get a discussion going regarding how to
communicate to terminal emulators such as ptyxis about run0 (and nspawn,
and vmspawn, and moe) and what it does.

It's hierarchical and I think still relatively simple.

/cc @chergert
2025-02-27 22:12:54 +01:00
Yu Watanabe
78f2c17454 parse-util: extend the maximum length of nftable identifiers
Since kernel v4.14, more specifically, after the following four commits,
e46abbcc05
b7263e071a
387454901b
6150957521
the maximum length of nftable identifiers are extended to 255.

Now, our kernel baseline is 5.4, hence we can freely use the extended
name length.

This also modernizes code a bit, and adds test cases.

Closes #36542.
2025-02-28 04:57:00 +09:00
Lennart Poettering
5b3eaf9e68 terminal-util: change conditioning in terminal_reset_defensive()
So far we conditioned the logic that issues ansi sequences for resetting
the TTY based on whether something is a pty is not (under the assumption
we need no reset on ptys, since they are shortlived).

This is simply wrong though. The pty that a container getty is invoked
on is generally long-lived: as long as the container is up, and it will
be reused between getty instances/sessions all the time. In such a case
we really should reset properly.

Let's instead make the logic dependent on whether TERM is set to
anything other than "dumb". The previous commit made sure we always set
TERM in a sensible way in systemd-run, hence this
*explicit* logic sounds like a much better choice now, as it mea
2025-02-27 15:17:34 +01:00
Lennart Poettering
9ab703d8e1 terminal-util: change 2nd parameter of terminal_reset_defensive() to flags
let's convert the 2nd argumeng form a boolean to a proper flags
parameter. Doesn't change behaviour in anyway, but is more readable, and
prepares ground for adding more flags soon.
2025-02-27 15:13:15 +01:00
Lennart Poettering
c63c6413e7 fs-util: add some assert()s 2025-02-26 18:12:04 +01:00
Lennart Poettering
14871a6529 efivars: kill SystemdOptions efi var support
This has been depracted since v254 (2023). Let's kill it for
good now, it has been long enough with 2y. Noone has shown up who wants
to keep it. And given it doesn't work in SB world anyway, and is not
measured is quite problematic security wise.
2025-02-26 17:28:43 +01:00
Yu Watanabe
8e0037fb3b sd-event: always operate on child source via pidfd (#36480) 2025-02-23 04:41:28 +09:00
Luca Boccassi
dad055ee52 Coding style followups (#36476) 2025-02-21 21:58:54 +00:00
Mike Yuan
3ddbc34e15 process-util: refuse FORK_WAIT + FORK_FREEZE combination 2025-02-21 21:35:05 +00:00
Mike Yuan
37149e692a process-util: introduce SIGINFO_CODE_IS_DEAD helper 2025-02-21 18:08:02 +01:00
Mike Yuan
012658fc85 basic/utf8: add missing assertion
Follow-up for 104a6b8c39
2025-02-21 16:12:59 +01:00
Mike Yuan
3ab19c1f0a basic/strv: minor coding style follow-ups
Follow-up for 428146dc89

Addresses https://github.com/systemd/systemd/pull/36271#discussion_r1958334800
2025-02-21 16:12:59 +01:00
Daan De Meyer
dc2f960b78 process-util: Allow setting ret_pid with FORK_DETACH in safe_fork()
Let's allow getting the pid even if the caller sets FORK_DETACH. We
do this via a socketpair() over which we send the inner child pid.
2025-02-20 21:00:52 +01:00
Daan De Meyer
f48103ea61 process-util: Implement safe_fork_full() on top of pidref_safe_fork_full()
Let's switch things around, and move the internals of safe_fork_full() into
pidref_safe_fork_full() and make safe_fork_full() a trivial wrapper on top
of pidref_safe_fork_full().
2025-02-20 20:13:53 +01:00
Yu Watanabe
a6eb22968c terminal-util: fix possible NULL pointer dereference
Fixes a bug introduced by 94a2b1cd25.
Fixes CID#1591787.
2025-02-18 18:34:39 +01:00