Commit Graph
58 Commits
Author SHA1 Message Date
Yu Watanabe c418543a65 include: update kernel headers from v7.0-rc1
In v7.0-rc1, the kernel introduces typelimits.h to define __KERNEL_INT_MIN/_MAX.
Also, NULL_FS_MAGIC has been introduced for immutable rootfs..
2026-02-24 23:08:52 +09:00
Yu Watanabe a5e6f4f81d include: update kernel headers from v6.19 2026-02-18 02:46:05 +09:00
Mike Yuan 6b039272e9 basic: add generated statx_mask_one_to_name()/statx_attribute_to_name() 2026-02-05 14:14:39 +01:00
Kai Lueke 23115eeaf1 sysext: Skip refresh if no changes are found
When the extensions for the final system are already set up from the
initrd we should avoid disrupting the boot process with the remount
(which currently isn't atomic) and the daemon reload for
systemd-confext and systemd-sysext. Similarly, when sysupdate ran and
updated extensions it's best to avoid the remount and daemon reload if
no changes are found.
To do this, encode the current extension state in more detail than
before where only the names of the extensions where encoded in the
overlay mount. This can also be used to provide more details about the
extension origin in "systemd-sysext status (--json=)". During the
refresh add a check whether the old state matches the new state and in
this case skip the refresh unless the user provides a flag to always
refresh. Besides the extension name and the resolved path the best
method for identification is the verity hash but that is not available
for plain image files or directories. Therefore, also include data to
check for file/directory replacements. The creation/modification times
are not always real on reproducible images or extracted archive content.
The file handle together with the unique mount ID is the next best
identifier we can use when we have no verity hash. Fall back to an inode
when we get no handle. With the creation/modification time and the path
this should be good enough. Using a unique mount ID is important (with
a fallback to the regular non-unique mount ID) instead of st_dev because
st_dev gets reused too easily, e.g., by a loop device mount and the
mount ID helps to catch this. For the mount ID to be valid it has to be
resolved before we enter the new mount namespace. Thus, it gets provided
by the image dissect logic and handed over to the sysext subprocess
which runs in a new mount namespace.
Luckily, we can rule out online modification of directories or image
files because this is anyway not well supported with overlay mounts, so
we don't do a file checksum nor do we recurse into a directory to look
for the most recently touched files.  But, as said, with the
always-refresh flag one can force a reload.
2026-02-04 00:05:24 +01:00
Yu Watanabe 149a8e6306 Bump required minimum version of glibc to 2.34
Major distributions already have glibc >= 2.34.
Let's bump the required minimum version.

Note, glibc-2.34 was released on 2021-08-01.
2026-01-28 10:56:53 +09:00
Yu Watanabe c02f81cb2d include: update linux kernel headers from v6.19-rc5 2026-01-18 15:32:08 +01:00
calm329 ac2b5f6cbf basic: move BPF_JMP_A to override/linux/bpf_insn.h
Move the BPF_JMP_A macro from override/linux/bpf.h to
override/linux/bpf_insn.h. The bpf.h override conflicts with libbpf's
-I/usr/include/bpf/uapi include path. Since bpf_insn.h is not typically
installed at /usr/include/linux/ or /usr/include/bpf/uapi/linux/, the
override works without conflicts.

Fixes #40331
2026-01-13 12:14:11 +09:00
Usama Arif 32614b9aab core: introduce MemoryTHP= unit file setting
Transparent Hugepages (THP) is a Linux kernel feature that manages
memory using larger pages (2MB on x86, compared to the default 4KB).
The main goal is to improve memory management efficiency and system
performance, especially for memory-intensive applications.
However, it can cause drawbacks in some scenarios, such as memory
regression and latency spikes. THP policy is governed for the entire
system via /sys/kernel/mm/transparent_hugepage/enabled.
However, it can be overridden for individual workloads via prctl(2)
call.
MemoryTHP= is used to disable THPs at exec-invoke to stop
providing THPs for workloads where the drawbacks outweigh the advantages.
When set to "disable", MemoryTHP= disables THPs completely for the
process, irrespecitive of global THP controls.
When set to "madvise", MemoryTHP= disables THPs for the process except
when specifically madvised by the process with MADV_HUGEPAGE or MADV_COLLAPSE.
2026-01-06 03:26:14 -08:00
Yu Watanabe 5863641bb7 Require libxcrypt-4.4.0 or newer and drop support of libcrypt
libcrypt was no longer built by default since glibc-2.38, and it has been
completely removed since glibc-2.39.

Let's always use libxcrypt, unless when building with musl. As already
major distribution already have libxcrypt-4.4.x, hence let's also bump
the required minimum version to 4.4.0.

libxcrypt cannot be built with musl, hence the previous fallback logic
in libcrypt-util.c are moved to musl/crypt.c.

Note, libxcrypt-4.4.0 was released on 2018-11-20.
See also #38608.
2026-01-02 12:55:53 +09:00
Matt Fleming 4dcbfbb1ad process-util: Add support SCHED_EXT scheduling policy
Allow CPUSchedulingPolicy to be set to "ext". SCHED_EXT is a new
scheduling policy in Linux v6.12 that allows processes to be scheduled
using custom BPF schedulers instead of the default in-kernel ones.

Selectively setting the SCHED_EXT policy is useful for systems running
in "partial mode" where not all processes are run using a custom
scheduler.

Fallback to SCHED_OTHER and print an error message for systems where
SCHED_EXT isn't available.
2025-12-20 18:31:55 +01:00
Luca Boccassi 28c5929e90 Update syscalls table
ninja -C build update-syscall-tables update-syscall-header
2025-12-17 13:33:26 +00:00
Luca Boccassi e20e9d2968 include: update kernel headers from v6.19~rc1 2025-12-16 11:43:29 +00:00
Yu Watanabe 53f5aa3fd2 musl: introduce wrappers for getopt() and getopt_long()
musl's getopt_long() behaves something different in handling optional arguments:
```
$ journalctl _PID=1 _COMM=systemd --since 19:19:01 -n all --follow
Failed to add match 'all': Invalid argument
```
This introduces getopt_long_fix() that reorders the passed arguments to make
getopt_long() provided by musl works as what we expect.

Also, musl's getopt() always behaves POSIXLY_CORRECT mode, and stops parsing
arguments when a non-option string found. Let's always use getopt_long().
2025-12-05 11:01:09 +01:00
Yu Watanabe 26b2085d54 include: update kernel headers from v6.18 2025-12-04 11:10:03 +00:00
Yu Watanabe 69646ac0e2 include: fix typo
Follow-up for ec32732043.
2025-12-04 07:50:26 +09:00
Luca Boccassi 2ded1c5a6e syscalls: add 'pragma export' to script that generates header
Otherwise it gets lost every time the header is regenerated

Follow-up for 3111327ca4
2025-11-26 01:15:33 +00:00
Daan De Meyer 87fbd33372 clang-tidy: Fix all remaining misc-include-cleaner violations
- Remove unused includes
- Add common false positive headers to misc-include-cleaner.IgnoreHeaders
- Add IWYU pragma keep for uncommon false positive headers
2025-11-22 10:19:41 +01:00
Yu Watanabe bd3fc5c539 Revert "musl: utmpx: add several missing definitions"
This reverts commit 3ae7d8fd87.

Now utmp support is always disabled when building with musl,
and all definitions are unused in that case. Let's remove it.
2025-11-18 03:06:02 +09:00
Luca Boccassi b186ce49de Chores for RC1 (#39757) 2025-11-17 10:53:15 +00:00
Luca Boccassi 5b81a76313 Update syscalls table
ninja -C build update-syscall-tables update-syscall-header
2025-11-17 08:56:39 +00:00
Yu Watanabe 07e437f569 musl: glob-util: filter out . and .. even if GLOB_ALTDIRFUNC is not supported
musl neither support GLOB_ALTDIRFUNC nor GLOB_BRACE.
Let's make safe_glob() work even when GLOB_ALTDIRFUNC is not supported.
Currently, GLOB_BRACE is simply ignored when it is not supported.
2025-11-17 12:19:22 +09:00
Emil Renner BerthingandYu Watanabe 3bc03c67f0 musl: add fallback parse_printf_format() implementation
musl does not provide parse_printf_format(). Let's introduce a fallback
method.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-11-17 12:19:22 +09:00
Yu Watanabe 3ae7d8fd87 musl: utmpx: add several missing definitions 2025-11-17 11:27:07 +09:00
Yu Watanabe 384e88a238 musl: stdio: check if stream is writable earlier in fputs() and friends 2025-11-15 05:10:33 +09:00
Yu Watanabe 46ea7c3e32 musl: make strtoll() accept strings start with dot
glibc accepts strings start with '.' and returns 0, but musl refuses
them. Let's accept them, as our code assumes the function accept such
strings.
2025-11-15 03:41:40 +09:00
Yu Watanabe ebb422dd2b musl: introduce GNU specific version of strerror_r()
musl provides XSI compliant strerror_r(), and it is slightly different
from the one by glibc.
Let's introduce a tiny wrapper to convert XSI strerror_r() to GNU one.

The wrapper also patches musl's spurious catchall error message.
2025-11-15 03:37:30 +09:00
Yu Watanabe 69dd6d9420 musl: add several missing statx macros
glibc's sys/stat.h includes linux/stat.h, and we have copy of it from
the latest kernel, hence all new flags are always defined.
However, musl's sys/stat.h does not include linux/stat.h, and moreover,
they conflict with each other, hence we cannot include both header
simultaneously. Let's define missing macros to support musl.
2025-11-14 04:59:03 +09:00
Chen QiandYu Watanabe dd102894e7 musl: add missing FTW_CONTINUE macro
This is to avoid build failures like below for musl.

  test-recurse-dir.c:23:24: error: ‘FTW_CONTINUE’ undeclared

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-11-14 04:59:03 +09:00
Yu Watanabe 8324ef4213 musl: replace netinet/if_ether.h with our own implementation
musl's netinet/if_ether.h conflicts with linux/if_ether.h.
The reimplementation is mostly equivalent with what glibc does.
2025-11-14 04:59:03 +09:00
Yu Watanabe 6400e8dbd9 musl: provide several missing definitions for prctl() 2025-11-14 04:59:03 +09:00
Yu Watanabe 03d0fa4e4f musl: introduce dummy function for gnu_get_libc_version()
As the header gnu/libc-version.h and gnu_get_libc_version() function
are glibc specific, and musl does not provide them.
2025-11-14 04:59:03 +09:00
Yu Watanabe bc610c70af musl: introduce dummy functions for mallinfo(), malloc_info(), and malloc_trim()
These functions are not provided by musl.
2025-11-14 04:59:03 +09:00
Yu Watanabe a2b7bcce27 musl: introduce dummy gshadow header file for userdb
Even 'gshadow' meson option is disabled, src/shared/userdb.c and
src/shared/user-record-nss.c include gshadow.h unconditionally.
Let's introduce dummy header to make them compiled gracefully.
2025-11-14 04:59:03 +09:00
Yu Watanabe 17e343b58b musl: meson: check existence of renameat2()
musl-1.2.5 does not provide renameat2(). Note, it is added by
https://github.com/kraj/musl/commit/05ce67fea99ca09cd4b6625cff7aec9cc222dd5a,
hence hopefully it will be provided by musl-1.2.6 or newer.
2025-11-13 04:44:00 +09:00
Yu Watanabe 907ce9c315 libc: drop unnecessary __THROW attribute
It is for C++, not necessary for us.
2025-11-12 14:17:44 +08:00
Yu Watanabe 208f88def3 include: update struct pidfd_info and relevant constants 2025-10-19 10:01:46 +09:00
Yu Watanabe b31a571849 include: import linux/coredump.h from kernel v6.17.1 2025-10-19 10:01:46 +09:00
Yu Watanabe bb437748da include: update kernel headers from v6.17.1 2025-10-12 22:17:56 +02:00
Zbigniew Jędrzejewski-Szmek ea44302b29 meson: using f-strings in meson
Those were added before 0.61 which is our minimum version.

Dots were dropped from the end of some messages. Most messages did not have the
trailing dot.

0.63 added support for multi-line f-strings. We can't use those yet.
2025-10-03 21:21:52 +02:00
Daan De Meyer 3111327ca4 include: Add missing IWYU pragmas 2025-09-19 12:44:29 +02:00
Luca Boccassi 01caeddbe3 Update syscall numbers
ninja -C build update-syscall-tables update-syscall-header
2025-09-17 09:48:00 +01:00
Luca Boccassi 27a1e162a1 Update syscalls tables
ninja -C build update-syscall-tables update-syscall-header
2025-08-20 13:19:51 +01:00
Yu Watanabe 4dfadc90fd include: update kernel headers from v6.17-rc1 2025-08-11 22:22:16 +09:00
Yu Watanabe 706e622e88 include: update kernel headers from v6.16-rc7
- netfilter changes in v6.16-rc1 were reverted,
- vm_sockets.h now includes sys/socket.h, hence our workaround is not
  necessary anymore.
2025-07-27 23:50:06 +01:00
Luca Boccassi d6a70c1523 syscalls table: add sh (#38338) 2025-07-25 19:23:00 +01:00
Luca Boccassi a50c687b01 syscalls-table: add sh and regenerated table 2025-07-25 17:17:28 +01:00
Zbigniew Jędrzejewski-Szmek 5e405f612e meson: add instructions for adding new arch to syscall.h 2025-07-25 17:53:48 +02:00
Zbigniew Jędrzejewski-Szmek c5dcbd073e meson: use files() not find_program() for helper scripts
We went back and forth between 'prog.sh', files('prog.sh'), and
find_program('prog.sh'). We want to use files() or find_program() so that we
get a good error message if the file is missing. Behaviour of meson changed
over time, and in the past not all forms could be used in all places. For
example 0f4c4f3824 added find_program() in many
places to avoid repeated messages. But it seems that all recent meson versions
work fine with files().

find_program prints silly messages:
  Program tools/make-man-index.py found: YES
       (/home/zbyszek/src/systemd/tools/make-man-index.py)
  Program tools/meson-render-jinja2.py found: YES
       (/home/zbyszek/src/systemd/tools/meson-render-jinja2.py)
  ...
We know that those files will be found, they are part of the git checkout.
With files() this is gone and the meson output is easier to read.
2025-07-25 14:04:17 +02:00
Zbigniew Jędrzejewski-Szmek 8aedfd979f tools: make all .py program files executable
All those files are standalone programs that can be executed directly.
Some .py files were marked executable, others weren't, probably accidentally.
Mark them all as executable in preparation for subsequent changes.
2025-07-25 12:33:13 +02:00
Yu Watanabe 2b69797b6d Include more headers explicitly (#38169)
Similar to the recent change like
4f18ff2e29.
2025-07-11 20:21:33 +09:00