Commit graph

60867 commits

Author SHA1 Message Date
Lennart Poettering 0b556555c2 update TODO 2022-11-10 22:19:42 +01:00
Ricky Tigg 0529f580ee po: Translated using Weblate (Finnish)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main
2022-11-10 20:36:28 +01:00
Lennart Poettering 9df82722f6 update TODO 2022-11-10 15:59:58 +01:00
Cristian Rodríguez afd8e1d945 build: Use -fstrict-flex-arrays=1 if supported
Due to "historical reasons" both gcc and clang treat *all* trailing
arrays members as flexible arrays, this has an evil side effect
of inhibiting bounds checks on such members as __builtin_object_size
cannot say for sure that:

struct {
...
type foo[3];
}

has a trailing foo member of fixed size rather than unspecified.

Ideally we should use -fstrict-flex-arrays as is, but we have to
tolerate kernel uapi headers that use [0] and third party libraries
written in c89 that may use [1] like curl.
2022-11-10 21:07:59 +09:00
Yu Watanabe 7618ab1b71 test-network: skip test_match if alternative name is not supported by kernel
Fixes #25259.
2022-11-10 10:05:43 +00:00
Luca Boccassi 741504aa17
Merge pull request #24813 from DaanDeMeyer/at-all-the-things
Add more openat() style variants for existing stuff
2022-11-10 10:57:14 +01:00
Luca Boccassi 84fe5182d5
Merge pull request #25315 from poettering/dissect-mtree
dissect: add new --mtree switch to generate BSD comaptible mtree manifests of DDIs
2022-11-10 10:44:27 +01:00
Frantisek Sumsal a92401d558
Merge pull request #25280 from keszybz/initrd-with-overlayfs
Initrd with overlayfs
2022-11-10 08:22:15 +00:00
Zbigniew Jędrzejewski-Szmek a940f507fb pid1: skip cleanup if root is not tmpfs/ramfs
in_initrd() was really doing two things: checking if we're in the initrd, and
also verifying that the initrd is set up correctly. But this second check is
complicated, in particular it would return false for overlayfs, even with an
upper tmpfs layer. It also doesn't support the use case of having an initial
initrd with tmpfs, and then transitioning into an intermediate initrd that is
e.g. a DDI, i.e. a filesystem possibly with verity arranged as a disk image.

We don't need to check if we're in initrd in every program. Instead, concerns
are separated:
- in_initrd() just does a simple check for /etc/initrd-release.
- When doing cleanup, pid1 checks if it's on a tmpfs before starting to wipe
  the old root. The only case where we want to remove the old root is when
  we're on a plain tempory filesystem. With an overlay, we'd be creating
  whiteout files, which is not very useful. (*)

This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=2137631
which is caused by systemd refusing to treat the system as an initrd because
overlayfs is used.

(*) I think the idea of keeping the initrd fs around for shutdown is outdated.
We should just have a completely separate exitrd that is unpacked when we want
to shut down. This way, we don't waste memory at runtime, and we also don't
transition to a potentially older version of systemd. But we don't have support
for this yet.

This replaces 0fef5b0f0b.
2022-11-09 22:44:23 +01:00
Zbigniew Jędrzejewski-Szmek 3ed332e77a test-fd-util: fix typos and use log_tests_skipped() 2022-11-09 22:44:23 +01:00
Lennart Poettering baf6c93296 test: add trivial test for systemd-dissect --mtree 2022-11-09 22:20:51 +01:00
Lennart Poettering b5b40106c7 man: document new systemd-dissect --mtree switch 2022-11-09 22:20:51 +01:00
Lennart Poettering db02190eec dissect: add a new "--mtree" switch for generating a BSD mtree(5) compatible file manifest 2022-11-09 22:20:51 +01:00
Frantisek Sumsal 3a21c554a5 meson: add version.h dependency to more components
Follow-up to c47511da7e.

```
archlinux_systemd_ci: In file included from ../build/src/dissect/dissect.c:15:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: version.h: No such file or directory
archlinux_systemd_ci:     4 | #include "version.h"
archlinux_systemd_ci:       |          ^~~~~~~~~~~
archlinux_systemd_ci: compilation terminated.
```

```
archlinux_systemd_ci: In file included from ../build/src/journal/cat.c:13:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: 'version.h' file not found
archlinux_systemd_ci: #include "version.h"
archlinux_systemd_ci:          ^~~~~~~~~~~
archlinux_systemd_ci: 1 error generated.
```

```
archlinux_systemd_ci: In file included from ../build/src/sysext/sysext.c:10:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: version.h: No such file or directory
archlinux_systemd_ci:     4 | #include "version.h"
archlinux_systemd_ci:       |          ^~~~~~~~~~~
archlinux_systemd_ci: compilation terminated.
archlinux_systemd_ci: FAILED: systemd-inhibit.p/src_login_inhibit.c.o
```

```
archlinux_systemd_ci: In file included from ../build/src/login/inhibit.c:12:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: version.h: No such file or directory
archlinux_systemd_ci:     4 | #include "version.h"
archlinux_systemd_ci:       |          ^~~~~~~~~~~
archlinux_systemd_ci: compilation terminated.
```

...
2022-11-09 18:22:58 +00:00
Lennart Poettering b21ec07b54 recurse-dir: optionally, call callback when entering/leaving toplevel dir, too
So far recurse_dir() will call the callback whenever we enter a
directory, and then pass the struct dirent for that directory, and an fd
for the directory the dirent is part of (i.e. the parent of the
directory we call things for). For the top-level dir the function is
invoked for we will not call the callback however, because we have no
dirent for that, and not fd for the directory the top-level dir is part
of. Let's add a flag to call it anyway, and in that case pass a NULL
dirent and -1 as directory fd.

This is useful when we want to treat the top-level dir the same as any
dir further down.

This is done opt-in since the callback must be ablet to handle a NULL
dirent and a -1 directory fd.
2022-11-09 18:55:58 +01:00
Franck Bui a2f0dbb810 random-seed: make sure to load machine id even if the seed file is missing 2022-11-09 18:41:30 +01:00
Lennart Poettering 718e5d3f60
Merge pull request #25321 from poettering/acpi-timing-fix
acp-fpdt: minor tweaks/fixes
2022-11-09 18:32:34 +01:00
Lennart Poettering 0b24845d1f
Merge pull request #25302 from poettering/dissect-with
dissect: add new --with command for excuting commands with a DDI mounted
2022-11-09 18:31:54 +01:00
Lennart Poettering 31edf44064 acpi-fpdt: make sure length/type fields are available in acpi_fpdt_header
some extra safety: make sure the two fields we care about are actually
properly present before the buffer is over.
2022-11-09 15:16:12 +01:00
Lennart Poettering 8cee3283f0 acpi-fpdt: don't accidentally drop signedness of pread() return 2022-11-09 15:09:08 +01:00
Lennart Poettering ab10dfe0d5 acpi-fpdt: use our usual ret_xyz naming scheme 2022-11-09 15:08:40 +01:00
Lennart Poettering efffde8e5f test: extend TEST-50-DISSECT for systemd-dissect --list and --with 2022-11-09 14:57:23 +01:00
Lennart Poettering 1a06ce16b2 man: document the new --with switch of systemd-dissect 2022-11-09 14:57:23 +01:00
Lennart Poettering 06186c4c99 dissect: add new --with command 2022-11-09 14:57:23 +01:00
Lennart Poettering fab2294646 dissect: officially support initrd DDIs (to implement 2nd stage initrds)
Let's complete support for DDI discovery, and also support 2nd stage
initrds.
2022-11-09 14:43:55 +01:00
Lennart Poettering 00fa567d4a
Merge pull request #25314 from poettering/dissect-list-tweaks
dissect: minor tweaks to "systemd-dissect --list"
2022-11-09 14:42:30 +01:00
Lennart Poettering 2e1f76f6ea dissect: open pager in --list mode, output might be long 2022-11-09 11:52:50 +01:00
Lennart Poettering a245225e2d dissect: simplify flags for recurse_dir()
We are not interested in the struct dirent data, hence there's no point
in passing RECURSE_DIR_ENSURE_TYPE. Let's drop it, and thus avoid some
extrac work on file systems where readdir() does not report .d_type.

Also drop RECURSE_DIR_SAME_MOUNT, because DDIs after all may contain
multiple partitions, and we mount them all together. The --list command
really should report the full set of files in an image.
2022-11-09 11:44:17 +01:00
Lennart Poettering 0f01320ec7 dissect: remove unused variable 2022-11-09 11:41:38 +01:00
Daan De Meyer dcb3d0934c test-copy: Rework test_copy_tree_replace_dirs() to use new openat() helpers 2022-11-09 11:14:10 +01:00
Daan De Meyer 56e2bceddc rm-rf: Add rm_rf_physical_and_close()
In tests it's useful to be able to delete temporary directories
via a file descriptor to them, so let's add rm_rf_physical_and_close()
which gets the file descriptor path via /proc and tries to remove it
that way.
2022-11-09 11:14:10 +01:00
Daan De Meyer 0ab5e2a4b4 fileio: Add openat() like helpers 2022-11-09 11:14:10 +01:00
Daan De Meyer 92dae2bd23 mkdir: Add mkdirat_parents() 2022-11-09 11:14:10 +01:00
Daan De Meyer 8df60ed768 mkdir: Add mkdirat_safe() 2022-11-09 11:14:10 +01:00
Daan De Meyer 5545141758 fs-util: Add chown_and_chmod_at() 2022-11-09 11:14:10 +01:00
Daan De Meyer 5bc244aaa9 chase-symlinks: Add chase_symlinks_at() 2022-11-09 11:14:10 +01:00
Daan De Meyer 15b4b4ed06 path-util: Add path_make_relative_cwd() 2022-11-09 11:14:10 +01:00
Daan De Meyer e624d4cf07 tmpfile-util: Add fopen_temporary_at() 2022-11-09 11:14:10 +01:00
Daan De Meyer 86e69a44b4 tmpfile-util: Introduce mkdtemp_open() 2022-11-09 11:13:58 +01:00
Luca Boccassi a297b7297c
Merge pull request #25300 from DaanDeMeyer/kernel-selftests
mkosi: Build and install kernel selftests
2022-11-09 11:07:00 +01:00
blutch112 19b036cf31 po: Translated using Weblate (French)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: blutch112 <vincent.lefebvre59@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fr/
Translation: systemd/main
2022-11-09 09:22:57 +00:00
Zbigniew Jędrzejewski-Szmek 1a25a77f3e basic/virt: treat missing /proc as sign of being in a chroot
The logic of running_in_chroot() has been the same since the introduction of
this function in b4f10a5e89: if /proc is not
mounted, the function returns -ENOENT and all callers treat this as false. But
that might be the most common case of chrooted calls, esp. in all the naïve
chroots that were done with the chroot binary without additional setup.

(In particular rpm executes all scriptlets in a chroot without bothering to set
up /proc or /sys, and we have codepaths in sysusers and tmpfiles to support
running in such an environment.)

This change effectively shortcircuits various calls to udevadm, downgrades
logging in tmpfiles, and disables all verbs marked with VERB_ONLINE_ONLY in
systemctl. detect-virt -r is also affected:

$ sudo chroot /var/lib/machines/rawhide
before> systemd-detect-virt -r && echo OK
Failed to check for chroot() environment: No such file or directory
after> systemd-detect-virt -r && echo OK
OK
2022-11-09 10:10:59 +01:00
Zbigniew Jędrzejewski-Szmek 08221c5743 shared: make libmount_parse() non-inline
Back in e2857b3d87 I added this function
as static inline in order to avoid linking libmount into libshared.
Nevertheless, a dependency on libmount was added to libbasic in
9e7f941acb, and later moved to libshared
in 77c772f227. So the shenanigan with an
inline function is not useful, let's make it a normal function.
2022-11-09 09:20:34 +01:00
Zbigniew Jędrzejewski-Szmek 3ca4ec2012 shared/mount-util: fix comment
Just typos and grammar. In the end didn't add a use of a function, but
I read the comment carefully, and this commit is the result of that.
2022-11-09 09:20:34 +01:00
Zbigniew Jędrzejewski-Szmek b1fd5cd4ed Revert "initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs"
This reverts commit 1f22621ba3.

As described in the reverted commit, we don't want to get rid of the check
completely. But the check requires opting-in by setting SYSTEMD_IN_INITRD=lenient,
which is cumbersome and doesn't seem to actually happen.
https://bugzilla.redhat.com/show_bug.cgi?id=2137631 is caused by systemd refusing
to treat the system as an initrd because overlayfs is used. Let's revert this
approach and do something that doesn't require opt-in instead.

I don't think it makes sense to keep support for "SYSTEMD_IN_INITRD=lenient" or
"SYSTEMD_IN_INITRD=auto". To get "auto" behaviour, just unset the option. And
"lenient" will be reimplemented as a better check. Thus the changes to the
option interface are completely reverted.
2022-11-09 09:20:33 +01:00
Yu Watanabe bf18862267
Merge pull request #25291 from keszybz/util-cleanup
Split/rename util.c+h and def.h
2022-11-09 09:23:17 +09:00
Khem Raj 239e4a42a6 networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition
This helps in avoiding compiling errors on musl. Definition of
IFF_LOOPBACK is the reason for including linux/if_arp.h, this however
could be obtained from net/if.h glibc header equally and makes it
portable as well.
2022-11-09 01:17:37 +01:00
Yu Watanabe 68773437da
Merge pull request #25297 from mrc0mmand/aux-test-fixes
test: fix a race in the systemd-mount test
2022-11-09 06:34:23 +09:00
Lennart Poettering bb69ec9507 dissect: grey out trailing slash in --list output
Given this is just auxiliary info, let's make it a tiny bit less visible
then the main part of the path.
2022-11-08 21:35:34 +01:00
Zbigniew Jędrzejewski-Szmek 28db6fbff1 Rename def.h to constants.h
The name "def.h" originates from before the rule of "no needless abbreviations"
was established. Let's rename the file to clarify that it contains a collection
of various semi-related constants.
2022-11-08 18:21:10 +01:00