Commit Graph
6036 Commits
Author SHA1 Message Date
Lennart Poettering e02fb2099c namespace-util: add helper for allocating an empty userns fd 2024-04-06 16:08:23 +02:00
Lennart Poettering 5783b4a954 namespace-util: add detach_mount_namespace_harder()
This is just like detach_mount_namespace() but if need be uses unpriv
user namespaces to be able to execute CLONE_NEWNS.
2024-04-06 16:08:23 +02:00
Lennart Poettering afdd0efa63 uid-range: add some basic operations on UidRange objects
Helpers to compare and get size, and whether the object is empty.
2024-04-06 16:08:23 +02:00
Lennart Poettering 20ba086e77 uid-range: add new uid_range_load_userns_by_fd() helper
This is similar to uid_range_load_userns() but instead of reading the
uid_map off a process it reads it off a userns fd.

(Of course the kernel has no API for this right now, hence we fork off a
throw-away process which joins the user namespace, and then read off the
data from there.)
2024-04-06 16:08:23 +02:00
Lennart Poettering 6ebb53d945 uid-range: optionally load outside view of UID range from uid_map procfs file 2024-04-06 16:08:23 +02:00
Lennart Poettering 5bff40e719 uid-range: add uid_range_overlaps() helper 2024-04-06 16:08:23 +02:00
Luca Boccassi e92042269e Merge pull request #32123 from mrc0mmand/assorted-tweaks
A couple of assorted tweaks
2024-04-05 22:22:06 +01:00
Mike YuanandLennart Poettering 99f3b67f3f os-util: use ENDSWITH_SET where appropriate
Addresses https://github.com/systemd/systemd/pull/31435#discussion_r1553969156

Co-authored-by: Lennart Poettering <lennart@poettering.net>
2024-04-06 02:16:53 +08:00
Zbigniew Jędrzejewski-Szmek c1e7f938ca Merge pull request #31435 from bluca/portable_fix_versioned
portable: assorted bug fixes
2024-04-05 17:04:17 +02:00
Frantisek Sumsal e55db9e792 log: fix comment 2024-04-05 12:14:18 +02:00
Mike Yuan 596c9e671a string-util: add missing assertion in cellescape 2024-04-03 23:51:11 +08:00
Luca Boccassi 1c6ca6d924 Merge pull request #32065 from bluca/dlopen_debug
dlopen: fix bpf symbol loading check and log at debug level when loading a library
2024-04-03 16:36:35 +01:00
Luca Boccassi 26cbb21449 Merge pull request #32019 from bluca/gcrypt_dlopen
gcrypt: dlopenify for libsystemd
2024-04-03 16:10:00 +01:00
Luca Boccassi dd6c0df65c dlopen: log debug message when a library is dlopened
Useful to track what is being used and when
2024-04-03 14:23:04 +01:00
Luca Boccassi 8707c9b244 gcrypt: dlopenify for libsystemd
gcrypt is used only for journal sealing operations in libsystemd, so it
can be made into a dlopen dependency that is used only on demand. This
allows to reduce the footprint of libsystemd in the most common cases.

Keep systemd-pull and systemd-resolved with normal linking, as they are
executables, and usually built with OpenSSL support anyway.
2024-04-03 11:50:25 +01:00
Mike Yuan 80d1d9f5db efivars: minor modernization for efi_set_variable 2024-04-03 10:03:53 +08:00
Mike Yuan 1ca89d32ae signal-util: make struct timespec const 2024-04-03 10:03:53 +08:00
Mike Yuan 65b584334d time-util: drop unneeded 'struct' 2024-04-03 10:03:53 +08:00
Daan De Meyer cde08933a9 Fix assertion in socknameinfo_pretty() 2024-03-31 23:40:38 +01:00
Yu Watanabe 0966933b3d unit-def: append trailing comma for the last entry 2024-03-29 13:53:01 +09:00
Luca Boccassi 37543971af os-util: allow matching versioned image with extension-release file
Currently app_1.0.raw is refused if it contains extension-release.d/extension-release.app,
which stops one from using versioned images without using the force flag to disable
the check. Relax it so that only the actual name, and not the version, is compared, like
it already happens in other places.
2024-03-28 14:20:20 +00:00
Mike Yuan f8c700791e string-util: modernize string_contains_word_strv a bit
Also correct the comment on flags.
2024-03-28 17:16:25 +08:00
Mike Yuan 981b033510 basic/string-table: remove unnecessary brackets 2024-03-25 23:10:52 +08:00
Friedrich Altheide 5e3c08d375 basic/virt: Fix virtualbox detection on proprietary system via board_vendor
Identify an virtualbox instance even if product_name, sys_vendor and bios_vendor reflect the
information of the real hardware, by checking if board_vendor == "Oracle Corporation"

This fixes #13429 again
The previous fix was removed in #21127
2024-03-24 18:02:42 +00:00
Zbigniew Jędrzejewski-Szmek 1934242b72 Drop unnecessary path_equal_ptr() wrapper
path_equal already works with NULL pointers.
2024-03-23 13:21:06 +01:00
Daan De Meyer 16f182e59a Merge pull request #31839 from DaanDeMeyer/log
log: Add per target log levels
2024-03-22 15:11:11 +01:00
Daan De Meyer e8815abff6 log: Add per target log levels
For CI in mkosi, I want to configure systemd to log at debug level
to the journal, but not to the console. While we already have max
level settings for journald's forwarding settings, not every log line
goes to the journal, specifically during early boot and when units
are connected directly to the console (think systemd-firstboot), so
let's extend the log level options we already have to allow specifying
a comma separated list of values and lets allow prefixing values with
the log target they apply to to make this possible.
2024-03-22 12:46:32 +01:00
Yu Watanabe 431f2ffbea Merge pull request #31892 from YHNdnzj/machinectl-minor-cleanup
machinectl: minor modernization, use FOREACH_ARRAY
2024-03-22 08:10:39 +09:00
Mike Yuan 66d826026e cgroup-util: use path_find_first_component where appropriate
Prompted by 8922a728f7
2024-03-22 08:00:55 +09:00
Mike Yuan 51e0149173 nulstr-util: minor cleanup 2024-03-22 01:44:45 +08:00
Yu Watanabe 839dce5ecb Merge pull request #31862 from keszybz/add-strdup_to-helper
Add strdup_to() helper
2024-03-21 14:47:05 +09:00
Unique-Usman c0cd99eee6 Follow up with the PR #31819 2024-03-20 15:48:05 +00:00
Luca Boccassi c3a55dc469 Merge pull request #31844 from keszybz/missing-extra-checks
Add static asserts to verify that our missing_*.h headers defines are actually correct
2024-03-20 15:47:05 +00:00
Zbigniew Jędrzejewski-Szmek 196166dbb1 basic/unit-name: use strdup_to() in slice_build_parent_slice()
The handling of the buffer is not obvious, so add a comment.
2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 4ab305fa3b basic/time-util: use strdup_to() and reformat a bit 2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 6a705f1234 Replace strdup_or_null() by strdup_to()
I didn't know that this helper existed… It is very similar to strdup_to_full(),
but all callers can actually be replaced by strdup_to(), which has more fitting
semantics.
2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek f174b294f6 basic/string-util: use strdup_to() in string_extract_line() 2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 4eb3ec63b0 basic/socket-util: use strdup_to() in sockaddr_pretty()
The function was written to support ret==NULL, but the only caller always
passes ret, and sockaddr_pretty() also requires ret to be set, so that
half-implemented code wasn't very useful.
2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 94b75cdb06 basic/fileio: use strdup_to_full() in read_stripped_line()
The return value of read_stripped_line() is changed. Before we'd return the
number of characters read, but that number was not meaningful after we called
strstrip(). So just return 0 if nothing was read (EOF), and 1 if something was
read (not EOF). All the callers were only checking for <0 or ==0.
2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 4f77ddca59 various: also use strdup_to() in cases where we don't return immediately 2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 418b936d47 various: use strdup_to() after getenv() 2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek 454318d3e8 various: use strdup_to() in various obvious cases
strdup_to() returns 0 on success and here we convert obvious blocks
which either return -ENOMEM or 0.
2024-03-20 15:13:44 +01:00
Zbigniew Jędrzejewski-Szmek 8922a728f7 basic/cgroup-util: use strdup_to() and strdup_to_full() as appropriate 2024-03-20 15:13:44 +01:00
Zbigniew Jędrzejewski-Szmek 892c5902ae src/basic: add yet another strdup helper
It's a bit ugly to have both strdup_to() and strdup_to_full(). I initially
started with one variant, but then in some functions we want the additional
info, while in many other places, having 1 instead of 0 causes the return
value of whole chains of functions to be changed. It *probably* wouldn't cause
any difference, but there is at least of bunch of tests that would need to be
updated, so in the end it seems to have the two variants.

The output param is first to match free_and_strdup() and other similar
functions.
2024-03-20 15:12:12 +01:00
Zbigniew Jędrzejewski-Szmek 0dee6f7a7b basic/missing_audit: add explanatory comment
It seems we need to check for the header file because it's not available in
some fuzzer builds.
2024-03-20 12:26:24 +01:00
Zbigniew Jędrzejewski-Szmek aee547b97b basic/missing_*.h: indentation tweaks 2024-03-20 12:26:16 +01:00
Zbigniew Jędrzejewski-Szmek 4d6437d33c basic/missing_*.h: add asserts that the values are as expected
It's great that we provide fallback values, but if we got one of those wrong,
it could be a long time before anyone noticed. So let's add asserts that the
our internal defines actually match the official ones, when the latter are
available.

I did not add '#include "macro.h"' to missing_{audit,capability}, because
those are processed by an awk script that would need additional include
directories and could be confused by the additional lines. We don't include
those headers standalone anyway, so this is not necessary anyway.
2024-03-20 12:26:16 +01:00
Zbigniew Jędrzejewski-Szmek 7258971b13 basic/missing_ioprio: include the proper header file
IOPRIO_* is defined in linux/ioprio.h, so we were always using our fallback
definitions.

The header list in meson.build is sorted. I'm not sure why it wasn't.
2024-03-20 12:25:47 +01:00
Daan De Meyer 2e52b6c661 log: Make warning messages more consistent
Use our usual pattern of ", ignoring.".
2024-03-20 09:30:39 +01:00
Yu Watanabe 46325d9324 terminal-util: fix underlying with SYSTEMD_COLORS=no
Fixes #31857.
2024-03-19 22:21:56 +01:00