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

61051 Commits

Author SHA1 Message Date
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
Zbigniew Jędrzejewski-Szmek
db62f51a9f basic/filesystems: fs_in_group() returns a boolean
is_{temporary,network}_fs() looked like they are incorrectly casting an error
to true, but actually the return type is misdeclared.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
3ae6b3bf72 basic: rename util.h to logarithm.h
util.h is now about logarithms only, so we can rename it. Many files included
util.h for no apparent reason… Those includes are dropped.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
ee617a4e5c basic: move a bunch of cmdline-related funcs to new argv-util.c+h
I wanted to move saved_arg[cv] to process-util.c+h, but this causes problems:
process-util.h includes format-util.h which includes net/if.h, which conflicts
with linux/if.h. So we can't include process-util.h in some files.

But process-util.c is very long anyway, so it seems nice to create a new file.
rename_process(), invoked_as(), invoked_by_systemd(), and argv_looks_like_help()
which lived in process-util.c refer to saved_argc and saved_argv, so it seems
reasonable to move them to the new file too.

util.c is now empty, so it is removed. util.h remains.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
c47511da7e meson: add version.h as dependency to more targets
version.h can be generated after compilation starts, creating a race condition
between compilation of various .c files and creation of version.h. Let's add it
as a dependency to more build targets that require version.h or build.h.

So far we played whack'a'mole by adding versiondep whenever compilation failed.
In principle any target which includes compilation (i.e. any that has .c
sources directly), could require this. I don't understand why we didn't see
more failures… But it seems reasonable to just add the dependency more widely.
2022-11-08 18:18:34 +01:00
Lennart Poettering
084ecae56f update TODO 2022-11-08 16:39:27 +01:00
Daan De Meyer
6c2ff4a050 mkosi: Build and install kernel selftests 2022-11-08 16:24:21 +01:00
Daan De Meyer
165176d199 mkosi: Add back libasan/libubsan libraries
These were accidentally removed as part of #24025
2022-11-08 16:20:51 +01:00
Zbigniew Jędrzejewski-Szmek
d6b4d1c7c4 basic: move version() to build.h+c 2022-11-08 13:41:14 +01:00
Zbigniew Jędrzejewski-Szmek
c8715007e0 basic,shared: move disable_coredumps() to coredump-util.[ch] 2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
3ec2ad35ba basic: move container_get_leader() to process-util.[ch]
basic/util.[ch] is a grab-bag of unrelated functions. Let's move a few
of the remaning functions to better locations.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
baa6a42d27 basic: create new basic/initrd-util.[ch] for initrd-related functions
I changed imports of util.h to initrd-util.h, or added an import of
initrd-util.h, to keep compilation working. It turns out that many files didn't
import util.h directly.

When viewing the patch, don't be confused by git rename detection logic:
a new .c file is added and two functions moved into it.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
b61b95ae9e tests: move tests for eqzero() to a new file
It's a bit silly to have a separate file that one short test, but this is the
last part of the test code that is misplaced, and here consistency beats
brevity.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
737f274e1e tests: move tests for PROTECT_ERRNO to the right file
Also, rename them to uppercase so that the test name matches what we're
actually testing.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
2ba6823716 tests: create test-raw-clone.c for raw-clone.h
The include for process-util.h is added for reset_cached_pid(). This
essentially fixes a pre-existing missing include.
2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
da603935d5 tests: create test-limits-util.c for limits-util funcs 2022-11-08 13:41:13 +01:00
Zbigniew Jędrzejewski-Szmek
0e58dc999c sd-journal: make prot_from_flags() static and rename
The function had just one caller and a name that didn't explain much.
Let's make it static and rename for clarity.

While at it, the only caller was not doing error handling correctly
— the function would potentially return a negative error value which
wasn't handled. In practice this couldn't happen, but let's remove
this ambiguity.
2022-11-08 13:41:13 +01:00
Frantisek Sumsal
45ff459b6a test: adjust systemd-mount's tests based on recent coverage reports 2022-11-08 12:44:37 +01:00
Frantisek Sumsal
bf9b5691b8 test: install realpath into the test images 2022-11-08 12:43:57 +01:00