Commit Graph

1297 Commits

Author SHA1 Message Date
Yu Watanabe
a030f8cc94 meson: bump required minimum version to 0.62.0
The commit 8442ac9c02 set
install_tag option to install_emptydir() calls, but it requires
meson-0.62.0. Hence, after the commit, we cannot build systemd
with older meson anymore. As using install_tag is quite useful
for building systemd package, let's bump the requirement of
meson version to 0.62.0.

Note, the current meson versions of major distributions are:
CentOS 9:  0.63.3
CentOS 10: 1.4.1
Fedora 40: 1.4.1
Fedora 41: 1.5.1
Ubuntu 20.04 LTS (focal): 0.53.2 -- EOL on 2025-04
Ubuntu 22.04 LTS (jammy): 0.61.2 -- EOL on 2027-04
Ubuntu 24.04 LTS (noble): 1.3.2
Ubuntu 24.10 (oracular):  1.5.2
Debian 11 (bullseye): 0.56.2 (1.0.0 in backports) -- EOL on 2024-08
Debian 12 (bookworm): 1.0.1  (1.5.1 in backports)
openSUSE Leap 15.6:  1.6.1
openSUSE Tumbleweed: 1.6.1

As the next version (v258) is not expected to be released before
the end of 2025-04, it is OK to cut the support of Ubuntu 20.04 LTS and
Debian 11. Also, our policy for support of distributions explicitly says
only latest Ubuntu LTS and non-LTS releases are supported.
Hence, we can also cut Ubuntu 22.04, even if it is not EOL.

Follow-up for 8442ac9c02.
Closes #35967.
2025-03-10 02:41:40 +09:00
Lennart Poettering
41d9ed93d9 factory-reset: revamp infrastructure
This introduces a bunch of facilities:

1. The factory-reset.target unit that requests a factory reset is now
   complemented by factory-reset-now.target that executes it at next
   boot.

2. This latter is added to the initial transaction via the new trivial
   systemd-factory-reset-generator.

3. A tool systemd-factory-reset has been added to query, request,
   cancel, complete factory reset operations (via EFI variables). Two of
   these are wrapped into units that are plugged into
   factory-reset.target and factory-reset-now.target respectively. The
   tool also provides a simple Varlink API.

This should make things a lot cleaner, and both be useful as explicit
implementation on UEFI, and as template + hookpoints for alternative
implementations on non-UEFI.
2025-03-05 12:37:26 +01: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
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
b5337d1d52 meson: cleanup glibc header checkers 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
2e22dd218a memory-util: explicit_bzero() exists since glibc-2.25 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
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
Lennart Poettering
dadbb34919 profile: generate shell + command OSC events 2025-02-27 15:13:15 +01:00
Mike Yuan
384949f7de core: dlopen()'ify libapparmor
In Arch Linux we currently have a half-baked apparmor support,
in particular we cannot link systemd to libapparmor for service
context integration, since that will pull apparmor into base system.
Hence, let's turn this into a dlopen dep.

Ref: https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/issues/22
2025-02-21 14:22:51 +01:00
Mike Yuan
a0924d96cb missing_syscall: add {set,remove}xattrat() 2025-02-09 14:51:03 +01:00
Mike Yuan
0f633e5257 missing_syscall: drop more defs below our kernel baseline 2025-02-09 14:51:03 +01:00
Mike Yuan
d43dc71e99 meson: glibc now provides wrapper for sched_setattr()
C.f. 21571ca0d7
2025-02-09 14:51:03 +01:00
Yu Watanabe
be4f4c4343 meson: also skip uid/gid check for nobody user/group when id command not found
Follow-up for 8b413ae406.
2025-02-07 10:49:58 +00:00
Vyacheslav Yurkov
8b413ae406 meson: Skip getent when it's not found 2025-02-07 09:15:46 +09:00
Lennart Poettering
81cf3dc466 build: fail the build if we accidentally drop a "const" qualifier on a parameter
let's be strict here, our codebase allows it.
2025-01-20 21:44:23 +01:00
Mike Yuan
9cd064aa9f meson: bump C std to gnu17
GCC 8.4 (our baseline) defaults to gnu17 already.
2025-01-17 19:46:37 +00:00
Zbigniew Jędrzejewski-Szmek
4e97e697c0 Several fixlets for GCC warnings (#36051)
Replaces #36043 and #36039.
2025-01-16 22:41:31 +01:00
Miroslav Lichvar
af96ccfc24 udev: set clock group for PTP and RTC devices
Add a new group for clock devices to enable applications like linuxptp
to open clocks without root privileges.
2025-01-16 21:12:47 +01:00
Yu Watanabe
9c881fa867 fundamental-macro: conditionalize several gcc warning pragmas
This fixes the following error:

In file included from ../src/basic/macro.h:13,
                 from ../src/basic/env-util.h:9,
                 from ../src/nss-systemd/nss-systemd.c:7:
../src/fundamental/macro-fundamental.h:61:9: error: option ‘-Wzero-as-null-pointer-constant’ is valid for C++/ObjC++ but not for C [-Werror=pragmas]
   61 |         _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
      |         ^~~~~~~
../src/nss-systemd/nss-systemd.c:106:1: note: in expansion of macro ‘DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT’
  106 | DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2025-01-17 04:35:09 +09:00
Lennart Poettering
1d5f0a88e0 fundamental: unify gcc warning pragmas at one place
This also drops HAVE_WSTRINGOP_TRUNCATION as the corresponding option
was introduced in GCC 8, and our baseline is GCC 8.4.
2025-01-17 04:08:58 +09:00
Mike Yuan
70923ed358 meson: enable -Wzero-as-null-pointer-constant
Support for C added in gcc 15:
236c0829ee
2025-01-16 02:26:56 +01:00
Lennart Poettering
7adafb0832 missing: add quotactl_fd() wrapper 2025-01-15 13:24:04 +01:00
Luca Boccassi
af0a28854d meson: add udev/hwdb build aliases
Allows to do:

meson compile libudev udev hwdb
meson install --no-rebuild --tags libudev,udev,hwdb
2025-01-15 09:48:27 +00:00
Lennart Poettering
ec0c10fc9d user-classification: add new "foreign" UID range
This makes the UID range configurable via build time options, but of
course it really shouldn't be changed. The default range I picked is
outside even of IPAs current (ridiculously large) allocation ranges,
hence hopefully minimizes conflicts.
2025-01-08 21:41:03 +01:00
Luca Boccassi
6b61f34a46 Stop installing some markdown docs/ files
These files are rendered on systemd.io and targeted at contributors, not
users, so it's not really useful to install them on a running system.
2025-01-08 09:45:09 +01:00
Yu Watanabe
066e603ac6 meson: drop workaround for CentOS 8
CentOS 8 and RHEL 8 reached EOL.
2025-01-07 02:06:04 +09:00
Daan De Meyer
8224a48da9 Introduce systemd-pty-forward
This allows running a command with tinted terminal background.
2025-01-03 17:07:33 +01:00
Mike Yuan
c439bd25ca random-util: our baseline includes getrandom() (v3.17) now
Plus, linux/random.h never defined getrandom(), hence remove
the custom machinery for sys/random.h vs linux/random.h
in favor of single HAVE_GETRANDOM.
2025-01-02 20:40:45 +01:00
Mike Yuan
2627cd1343 random-util: drop needless conditionalization of sys/auxv.h
We assume its existence in basic/build-path.c, shared/userdb.c,
and coredump/coredump.c already, for which nothing has been reported
so far. So this seems safe to drop.
2025-01-02 20:34:21 +01:00
Mike Yuan
03ccee1939 errno-list: prefer strerrorname_np() as errno_to_name() provider 2025-01-02 12:01:53 +01:00
Mike Yuan
c415a4816c tree-wide: drop inclusion of linux/memfd.h
We carry our own definitions in missing_mman.h, and otherwise
sys/mman.h is employed. Let's drop the unneeded detection/inclusion
of linux/memfd.h hence.
2024-12-24 16:56:21 +01:00
Yu Watanabe
a4d1891475 meson: allow to customize the access mode for tty/pts devices
Then, switch the default value to "0600", due to general security
concerns about terminals being written to by other users.

Closing #35599.
2024-12-16 21:36:07 +00:00
Andreas Schwab
f5083b209c dmi: add RISC-V 64bit support 2024-12-05 03:59:32 +09:00
Daan De Meyer
1a077e05fb Add proper dependencies to ukify target
Also remove the systemd-measure dependency from the mkosi target as
mkosi doesn't invoke systemd-measure itself.
2024-11-15 10:32:24 +00:00
Lennart Poettering
67e003d7dd Introduce systemd-keyutil to do various key/certificate operations (#35095)
Let's gather generic key/certificate operations in a new tool
systemd-keyutil instead of spreading them across various special purpose
tools.

Fixes #35087
2024-11-11 16:09:07 +01:00
Zbigniew Jędrzejewski-Szmek
211d2f972d Rename src/partition to src/repart 2024-11-11 09:17:10 +01:00
Zbigniew Jędrzejewski-Szmek
a32e1f8896 Move growfs+makefs to src/growfs/
Those two programs are used together and it makes sense to keep them
together. makefs is smaller, so name the directory after growfs.
2024-11-10 14:09:46 +01:00
Mike Yuan
e997cfaa73 meson.build: add a few features to summary 2024-11-10 05:39:11 +09:00