1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-03 05:18:09 +03:00
Commit Graph

78192 Commits

Author SHA1 Message Date
Lennart Poettering
7a8556b901
confext/sysext: add initrd-specific units (#35426)
In the rootfs these need to run after /var/lib/ has been set up. In the
initrd we want them to run as soon as possible so that they can be used
to customize setting up the rootfs.
2024-12-18 10:33:38 +01:00
Yu Watanabe
5830d34b40 core: drop unnecessary header inclusion
Follow-up for e76fcd0e40.
2024-12-18 09:30:25 +01:00
Yu Watanabe
80080f34f3 TEST-07-PID1: fix typo
Follow-up for e76fcd0e40.
2024-12-18 10:46:51 +09:00
Lennart Poettering
4f6086ceb4
pam_systemd: some refactorings and bugfixes (#35178)
Inspired at #35171 I had another closer look at pam_systemd, and found a
bunch of things to fix, and correct.
2024-12-17 23:02:00 +01:00
Lennart Poettering
be883be6d3
remove fallbacks for memfd-less kernels (#35605)
Let the culling continue: let's remove support for kernels that lack
memfd, i.e. pre-3.17 kernels.

This is a nice simplification of things.
2024-12-17 23:01:29 +01:00
Nick Rosbrook
96c4d9d94d test: skip TEST-69-SHUTDOWN on ubuntu too 2024-12-17 19:04:04 +00:00
Lennart Poettering
3ee8082947 update TODO 2024-12-17 18:26:15 +01:00
Lennart Poettering
6db5a6e799 doc: document new baseline requires memfd_create() 2024-12-17 18:26:15 +01:00
Lennart Poettering
4dac692094 fuzz-journal-remote: use memfd_new_and_seal() where appropriate
This means we can drop memfd_new_and_map() and results in generally
shorter code.
2024-12-17 18:26:15 +01:00
Lennart Poettering
65d9ef40f2 pid1: drop check that ensures /run/ has plenty space before reexec/reload
Now that we only support serialization into a memfd (rather than a file
in /run/) there's no point to check the free space in /run/. Let's drop it.

One error scenario gone. Yay.
2024-12-17 18:26:15 +01:00
Lennart Poettering
d54bbc4cdc memfd-util: trivial modernizations 2024-12-17 18:26:15 +01:00
Lennart Poettering
5d1e57b820 serialize: add explicit calls for finishing serialization
These new calls will do three things:

1. in case of FILE* stuff: flush any pending bytes onto the fd, just in
   case
2. seal the backing memfd
3. seek back to the beginning.

Note that this adds sealing to serialization: once we serialized fully,
we'll seal the thing off for further modifications, before we pass the
fd over to the target process. This should add a bit of robustness, and
maybe finds a bug or two one day, if we accidentally write to a
serialization that is complete.
2024-12-17 18:26:15 +01:00
Lennart Poettering
4d98709cb2 memfd-util: introduce memfd_new_full() helper
This is just like memfd_new(), but allows fine grained control of the
sealing flags.

This switches over all uses of memfd_new() where we actually want
sealing to use memfd_new_full().

This then allows use to use memfd_new() for two further calls, where we
previously used the more lowlevel memfd_create_wrapper().
2024-12-17 18:26:15 +01:00
Lennart Poettering
9b1d97cccd memfd-util: explain what memfd_create_wrapper() is for in a comment 2024-12-17 18:26:15 +01:00
Lennart Poettering
caf1436ee8 memfd-util: use TASK_COMM_LEN at one more place
Note this corrects the size of the array from 17 to 16, as the 16
already includes space for a trailing NUL.
2024-12-17 18:26:15 +01:00
Lennart Poettering
ce66a2f2bb sd-journal: drop memfd fallback 2024-12-17 18:26:15 +01:00
Lennart Poettering
52cd287933 serialize: drop memfd fallback when serializing 2024-12-17 18:26:15 +01:00
Lennart Poettering
e1c52c9238 memfd-util: short memfd_clone_fd() 2024-12-17 18:26:15 +01:00
Lennart Poettering
db5381c49c memfd-util: simplify memfd_new_and_seal()
Let's use pwrite() to write the contents of the memfd. This has the
benefit of not moving the file offset, which means we don't have to
reset it after at all.
2024-12-17 18:26:15 +01:00
Lennart Poettering
a87a9625f8 tree-wide: drop acquire_data_fd_full() helper
Let's drop support systems lacking memfds, i.e. pre kernel 3.17 systems.
This allows us to drastically simplify the "data fd" concept, so far
that we can remove it entirely.

This replaces acquire_data_fd() with a specialized call to
memfd_new_and_seal(), not that memfds can be the only implementation of
the concept.
2024-12-17 18:26:15 +01:00
Lennart Poettering
f07fe275d5 pam_systemd: introduce pam_get_data_many() helper and make use of it
This is to pam_get_data() what pam_get_item() is to pam_get_item_many().
2024-12-17 17:52:23 +01:00
Lennart Poettering
7f471bd3b2 pam_systemd: fix error code confusion when prepping D-Bus message
We got confused by the error codes here, and sometimes return PAM errors
where the caller propagated them unconverted as negative errno errors. Fix that.
2024-12-17 17:52:21 +01:00
Lennart Poettering
32580792df pam_systemd: split pam_sm_open_session() into more digestable blocks
Let's separate four different parts of pam_sm_open_session():

1. Acquiring of our various parameters from pam env, pam data, pam items
2. Mangling of that data to clean it up
3. Registering of the service with logind
4. Importing shell credentials into environment variables
5. Enforcement of user record data

This makes the code a lot more readable, and gets rid of an ugly goto
label.

It also corrects things: if step 3 doesnt work because logind is not
around, we'll now still do step 4, which we previously erroneously
skipped.

Besides that no real code changes.
2024-12-17 17:52:18 +01:00
Lennart Poettering
166a678fea pam_systemd: split out setting of shell env vars from credentials and move it later
Let's shorten the code of pam_sm_open_session() a bit, and also make
sure the importing of the env vars from the creds also happens if the
session registration with logind is skipped.
2024-12-17 17:52:14 +01:00
Lennart Poettering
5e782e4de3 pam_systemd: drop "uid" field from SessionContext
Let's instead just pass over the UserRecord, it's a much more useful
object with lots more information we'll sooner or later need
(preparation for later commits).
2024-12-17 17:52:11 +01:00
Lennart Poettering
014d23c395 pam_systemd: drop "pid" field from SessionContext
We never use the field and this is not going to change...

This addresses a weird asymmetry, as create_session_message() always
went to the process' own PID when doing pidfds but otherwise (i.e.
without pidfds) would honour the PID specified as function parameter.
2024-12-17 17:52:08 +01:00
Lennart Poettering
6082ccf792 pam_systemd: normalize parsing of XDG_VTNR
Let's make it more like the parsing of the "incomplete" boolean env var,
to streamline things.
2024-12-17 17:51:57 +01:00
Lennart Poettering
8d08f18b52
discover-image: modernize image discovery around O_PATH (#35513)
let's always pin the image fd as early as we can, then derive all
properties off it, to have a consistent view on things.
2024-12-17 17:39:59 +01:00
Lennart Poettering
00a415fc8f tree-wide: remove support for kernels lacking ambient caps
Let's bump the kernel baseline a bit to 4.3 and thus require ambient
caps.

This allows us to remove support for a variety of special casing, most
importantly the ExecStart=!! hack.
2024-12-17 17:34:46 +01:00
Daan De Meyer
96ec3911f3
machine: introduce io.systemd.Machine.{MapFrom, MapTo} methods (#35064)
This PR introduces varlink's alternatives to the following DBus methods:
- MapFromMachineUser
- MapToMachineUser
- MapFromMachineGroup
- MapToMachineGroup
2024-12-17 16:51:51 +01:00
Antonio Alvarez Feijoo
5aab7ad075 boot: do not build test-hwids-section.c if ukify is disabled
Otherwise the build fails:

```
[22/3075] Generating src/boot/test-hwids-section.c with a custom command (wrapped by meson to capture output)
FAILED: src/boot/test-hwids-section.c
/usr/bin/meson --internal exe --capture src/boot/test-hwids-section.c -- /usr/bin/python3.10 /mnt/work/systemd/upstream-fork/main/src/boot/generate-hwids-section.py /mnt/work/systemd/upstream-fork/main/src/boot/hwids
--- stderr ---
Traceback (most recent call last):
  File "/mnt/work/systemd/upstream-fork/main/src/boot/generate-hwids-section.py", line 12, in <module>
    import ukify
  File "/mnt/work/systemd/upstream-fork/main/src/boot/../ukify/ukify.py", line 61, in <module>
    import pefile  # type: ignore
ModuleNotFoundError: No module named 'pefile'
```

Follow-up for 640f8c3eb8
2024-12-17 11:15:39 +00:00
Ivan Kruglov
1fc1a32941 machine: tests for io.systemd.Machine.{MapFrom, MapTo} methods 2024-12-17 11:25:24 +01:00
Ivan Kruglov
8351463f67 machine: introduce io.systemd.Machine.{MapFrom, MapTo} methods 2024-12-17 11:25:24 +01:00
Lennart Poettering
98e28335b7 discover-image: modernize image discovery around O_PATH
let's always pin the image fd as early as we can, then derive all
properties off it, to have a consistent view on things.
2024-12-17 11:21:57 +01:00
Lennart Poettering
476b7c3a68 discover-image: make sure quota logic works on O_PATH fds 2024-12-17 11:21:57 +01:00
Lennart Poettering
abeedbde90 btrfs-util: make sure btrfs_subvol_get_info_fd() works on O_PATH fds 2024-12-17 11:21:57 +01:00
Lennart Poettering
e837c257d0 chattr-util: move O_PATH conversion from read_attr_at() to read_attr_fd() 2024-12-17 11:19:55 +01:00
Lennart Poettering
7f8c27758b update TODO 2024-12-17 11:18:01 +01:00
Yu Watanabe
c195fdba12
test: Add CHID matching test (#35532) 2024-12-17 13:21:04 +09:00
Yu Watanabe
47f58740aa
core: make ProtectHostname= optionally take a hostname (#35626)
Closes #35623.
2024-12-17 13:20:08 +09:00
Yu Watanabe
b58b00e4c3 systemctl-edit: ignore ENOENT from unit_is_masked()
If a specified unit does not exist, then it is definitely not masked.

Fixes #35632.
2024-12-17 13:19:35 +09: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
Lennart Poettering
0543b02cf8 networkd: show wireguard private key read error number
Noticed while looking at #35641
2024-12-16 18:54:57 +00:00
Luca Boccassi
930d65ccca mkosi: temporarily disable panic_on_warn
Due to a BTRFS issue in kernel 6.12 (and backported in Ubuntu to 6.8)
there's a warning triggered by some tests, and it then causes a panic.

The BTRFS issue has a patch but it is not available in any distro yet,
so disable panic_on_warn until it reaches Arch and Ubuntu Noble. Bugs
have been filed.
2024-12-16 18:54:32 +00:00
anonymix007
640f8c3eb8 test: Add test-chid-match 2024-12-16 21:02:54 +03:00
Yu Watanabe
7c4e351861 boot: introduce smbios_raw_info_get_cached() to cache populated SMBIOS raw info
Then, drop cache in smbios_info_populate().
No functional change, just refactoring and preparation for later commit.
2024-12-16 21:02:54 +03:00
anonymix007
f28cedfa31 boot: Add chid.c to libefitest
Also fix compilation for testing CHID matching in userspace
2024-12-16 21:02:54 +03:00
anonymix007
48acd7fe90 boot: Deduplicate efi.h and efi-fundamental.h
These definitions are needed for both userspace and EFI, so keep them in efi-fundamental.h
2024-12-16 21:02:54 +03:00
Lucas Adriano Salles
56785120a0
hwdb: fix key toggle touchpad for VAIO VJFH52 (#35645)
Fixes #35644.
2024-12-17 00:10:42 +09:00
Yu Watanabe
e76fcd0e40 core: make ProtectHostname= optionally take a hostname
Closes #35623.
2024-12-16 23:55:44 +09:00