Commit Graph

6733 Commits

Author SHA1 Message Date
Mike Yuan
33db9f214b missing_syscall: drop raw_getpid()
This used to be relevant since in old versions of glibc an internal
cache is maintained, while we might sidestep their invalidation
with raw_clone(). After glibc 2.25 getpid() is a trivial wrapper
for the syscall, and hence there's no need to have a separate
raw_getpid().
2025-03-04 23:03:24 +01:00
Mike Yuan
c133fcd5c0 locale-util: modernize is_locale_utf8() a bit 2025-03-04 23:03:23 +01:00
Mike Yuan
87838420aa basic/sys/mount: sort includes 2025-03-04 23:02:39 +01:00
Mike Yuan
c74380cceb missing_fs: drop FS_KEY_DESCRIPTOR_SIZE
We now directly import linux/fscrypt.h, so this def is duplicate
2025-03-04 23:02:37 +01:00
Yu Watanabe
c4eef17990 dirent-util: add several assertions in posix_getdents()
Follow-up for e86a492ff0.
2025-03-04 22:54:01 +01:00
Lennart Poettering
4f4c37bc07 log: explicitly size log_target_max_level()
We always validate that the target value is below _LOG_TARGET_SINGLE_MAX
before acessing it, but we don't actually size the array like that.
let's fix that.

This doesn#t effectively change anything, but it makes things more
explicit what the limit here is.
2025-03-04 18:07:00 +01:00
Daan De Meyer
5abf819a5f basic: remove unnecessary definition in missing_xyz.h (#36565) 2025-03-04 08:41:14 +01:00
Yu Watanabe
f342c2420a chattr-util: two trivial cleanups (#36593) 2025-03-04 13:13:25 +09:00
Yu Watanabe
42f6a96e6c fileio: move call of label_ops_post() before error handling of creating files
Fixes CID#1563946.
2025-03-04 05:18:15 +09:00
Yu Watanabe
e86a492ff0 dirent-util: introduce simple wrapper of posix_getdents()
glibc exports getdents64 syscall as is, but musl exports it as
posix_getdents(). Let's introduce a simple wrapper of posix_getdents().

Note, our baseline for glibc is 2.31. Hence, we can assume getdents64()
always defined when building with glibc.
2025-03-04 04:23:57 +09:00
Yu Watanabe
ec32732043 basic: introduce our own sys/mount.h implementation
To resolve conflict with sys/mount.h and linux/mount.h or linux/fs.h.

The conflict between sys/mount.h and linux/mount.h is resolved in
glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), but our baseline
is still glibc-2.31. Also, even with the version or newer, still
sys/mount.h conflicts with linux/fs.h, which is included by
linux/btrfs.h.

This introduces our own implementation of sys/mount.h, that can be
simultaneously included with linux/mount.h and linux/fs.h. This also
imports linux/fs.h, linux/mount.h, and several other dependent headers.
The introduced sys/mount.h header itself may not be enough simple, but
by using the header, we can drop most of workarounds in other source files.
2025-03-04 02:24:49 +09:00
Yu Watanabe
bc2bb59bdd missing_audit: AUDIT_NLGRP_READLOG is defined since kernel v3.16
More specifically, since 451f921639fea4600dfb9ab2889332bdcc7b48d3.
Now, our kernel baseline is 5.4. Hence, we can drop the definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe
aa14f19398 basic/linux: import capability.h from kernel 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe
b9b006c504 missing_wait: add short comment about P_PIDFD 2025-03-04 02:24:49 +09:00
Yu Watanabe
003b845cb2 missing_timerfd: TFD_TIMER_CANCEL_ON_SET is defined since glibc-2.26 2025-03-04 02:24:49 +09:00
Yu Watanabe
e75372958d missing_threads.h: threads.h exists since glibc-2.28 2025-03-04 02:24:49 +09:00
Yu Watanabe
75b101718c missing_socket: drop unnecessary definitions
All removed definitions are in glibc-2.31
2025-03-04 02:24:49 +09:00
Yu Watanabe
2c2d832eb0 missing_securebits: remove unnecessary header
Our kernel baseline is 5.4, hence all entries in the headers are defined
in linux/securebits.h.
2025-03-04 02:24:49 +09:00
Yu Watanabe
a7cb43d8d1 missing_resource.h: RLIMIT_RTTIME is defined since glibc-2.14
Now our baseline is glibc-2.31.
2025-03-04 02:24:49 +09:00
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
Yu Watanabe
a997f3387f chattr-util: drop mostly unused 'previous' argument from chattr_path() and friends 2025-03-04 00:47:12 +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