Commit graph

64731 commits

Author SHA1 Message Date
Ronan Pigott 110789987d zsh: amend completion for networkctl edit 2023-05-22 12:14:04 +01:00
Yu Watanabe 6554f56361 wait-online: downgrade log level of failure that interface is removed or unmanaged during processing it
Closing #27145.
2023-05-22 19:06:06 +09:00
Jan Janssen f70f992273 boot: Read files in small chunks on broken firmware
Fixes: #25911
2023-05-22 10:52:17 +01:00
Yu Watanabe e7432ed7ca
Merge pull request #27726 from yuwata/network-wireguard-doc
network: update doc
2023-05-22 16:46:38 +09:00
Daan De Meyer 137f5f9169
Merge pull request #26577 from ChenQi1989/revert-revert-journal
Revert "Revert "journal: Make sd_journal_previous/next() return 0 at …
2023-05-22 07:51:01 +02:00
Yu Watanabe f8c5301e44 man: AllowedIPs= can be specified multiple times
Closes #27507.
2023-05-22 14:18:46 +09:00
Yu Watanabe 54189b2ec3 network/wireguard: make AllowedIPs= cleared by specifying an empty string 2023-05-22 14:15:49 +09:00
Yu Watanabe 23ff8a776c test: install test specific modules in test_append_files() 2023-05-22 12:40:05 +09:00
Chen Qi 7a4ee86161 Revert "Revert "journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL""
This reverts commit 1db6dbb1dc.

The original patch was reverted because of issue #25369. The issue was created
because it wrongly assumed that sd_journal_seek_tail() seeks to 'current' tail.
But in fact, only when a subsequent sd_journal_previous() is called that it's
pointing to the tail at that time. The concept of 'tail' in sd_journal_seek_tail()
only has a logical meaning, and a sd_journal_previous is needed. In fact, if we
look at the codes in journalctl, we can see sd_journal_seek_tail() is followed by
sd_journal_previous(). By contrary, a sd_journal_next() after a 'logical' tail does
not make much sense. So the original patch is correct, and projects that are
using 'sd_journal_next()' right after 'sd_journal_seek_tail()' should do fixes
as in https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2823#note_1637715.
2023-05-22 02:54:40 +09:00
Yu Watanabe a94149601a sd-journal: save correct location specifier 2023-05-22 02:54:40 +09:00
Yu Watanabe 43e460a584 test-journal-interleaving: extend tests to clarify the issue in sd_journal_next() or friends
This illustrates bug in sd_journal_next() or friends;
calling sd_jounral_next() followed by sd_journal_seek_tail() makes the
location saved in sd-journal something corrupted, and subsequent
sd_journal_previous() or friends may fail or provides unexpected result.
2023-05-22 02:49:25 +09:00
Dmitry V. Levin 9e36da1541 udevadm-verify: introduce --no-summary option
When udevadm verify is invoked by an analyzer tool like rpminspect
to verify individual udev rules files, the summary just clutters the
output, so provide an option to turn the summary off.
2023-05-21 23:20:30 +09:00
Yu Watanabe ddf0d5cc0d
Merge pull request #27157 from YHNdnzj/networkctl-edit
networkctl: add verb edit and cat to operate on network configs
2023-05-21 21:36:56 +09:00
Mike Yuan a3d975b240
test: add tests for networkctl edit/cat 2023-05-21 15:55:42 +08:00
Mike Yuan 96bab8fd63
networkctl: add verb edit and cat to operate on network configs
This adds two verbs, edit and cat, to networkctl for
operating on network configs (namely .network, .netdev
and .link files). Specially, if the config name is
prefixed by @, it will be treated as network interface
name, and operations will be performed on config files
associated with the link.

Closes #26906
2023-05-21 15:48:57 +08:00
Mike Yuan 35c0e3444d
conf-parser: move config_get_dropin_files to conf-files 2023-05-21 15:46:25 +08:00
Mike Yuan d260875f78
networkctl: mark some verbs as online only 2023-05-21 15:46:25 +08:00
Mike Yuan 8dfc3bf597
networkctl: fix a typo in log message 2023-05-21 15:46:25 +08:00
Mike Yuan 43449ca327
networkctl: add missing asserts 2023-05-21 15:46:25 +08:00
Mike Yuan 6c6930077c
networkctl: check netns only if networkd is running 2023-05-21 15:46:22 +08:00
Mike Yuan 2b30967f6b
Merge pull request #27719 from mrc0mmand/fuzz-tweaks
fuzz: a couple of fixes for issues found by Nallocfuzz
2023-05-21 15:41:15 +08:00
Frantisek Sumsal a19b6bd554 sd-event: check the allocation before calling expand_to_usable()
As it might hide a possible allocation error since it uses
the returns_nonnull attribute:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==8==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000004 (pc 0x7f317897db8d bp 0x7ffd436fe9a0 sp 0x7ffd436fe970 T0)
==8==The signal is caused by a WRITE memory access.
==8==Hint: address points to the zero page.
SCARINESS: 10 (null-deref)
    #0 0x7f317897db8d in source_new /work/build/../../src/systemd/src/libsystemd/sd-event/sd-event.c:1214:18
    #1 0x7f317897e68c in sd_event_add_time /work/build/../../src/systemd/src/libsystemd/sd-event/sd-event.c:1417:13
    #2 0x7f317897a0f6 in event_reset_time /work/build/../../src/systemd/src/libsystemd/sd-event/event-util.c:68:21
    #3 0x4e2c8e in client_initialize_time_events /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp-client.c:1366:13
    #4 0x4eb0fd in client_initialize_events /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp-client.c:1380:9
    #5 0x4eb0fd in client_start_delayed /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp-client.c:1410:16
    #6 0x4e30aa in client_start /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp-client.c:1415:16
    #7 0x4e30aa in sd_dhcp_client_start /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp-client.c:2045:13
    #8 0x4e700e in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-client.c:73:15
    #9 0x5062f8 in NaloFuzzerTestOneInput (/build/fuzz-dhcp-client+0x5062f8)
    #10 0x525283 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #11 0x524a6a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #12 0x526139 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #13 0x526e05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
    #14 0x51616f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #15 0x516a38 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10
    #16 0x506555 in main (/build/fuzz-dhcp-client+0x506555)
    #17 0x7f3177ce3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #18 0x420c4d in _start (/build/fuzz-dhcp-client+0x420c4d)

Found by Nallocfuzz.
2023-05-20 23:08:51 +02:00
Frantisek Sumsal 5b6f7b104c fuzz: avoid a couple of NULL pointer dereferences
In case one of the allocations fails.

For example:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==17==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fb352a476e5 bp 0x7ffe45154850 sp 0x7ffe45154008 T0)
==17==The signal is caused by a READ memory access.
==17==Hint: address points to the zero page.
SCARINESS: 10 (null-deref)
    #0 0x7fb352a476e5  (/lib/x86_64-linux-gnu/libc.so.6+0x1886e5) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #1 0x435878 in __interceptor_strlen /src/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc
    #2 0x4de1e4 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-calendarspec.c:20:21
    #3 0x4deea8 in NaloFuzzerTestOneInput (/build/fuzz-calendarspec+0x4deea8)
    #4 0x4fde33 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #5 0x4fd61a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #6 0x4fece9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #7 0x4ff9b5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
    #8 0x4eed1f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #9 0x4ef5e8 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10
    #10 0x4df105 in main (/build/fuzz-calendarspec+0x4df105)
    #11 0x7fb3528e3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #12 0x41f80d in _start (/build/fuzz-calendarspec+0x41f80d)

Found by Nallocfuzz.
2023-05-20 23:08:51 +02:00
Frantisek Sumsal 02af58acad README: drop the CentOS CI SELinux job
It has been failing for more than a year and I don't think that anyone
cares about the stuff it keeps finding.
2023-05-20 17:12:01 +02:00
Mike Yuan 93773df467
Merge pull request #27714 from yuwata/cryptenroll-password
cryptenroll-password: tiny cleanups
2023-05-20 16:33:16 +08:00
Yu Watanabe 70b53893f1 cryptenroll: update log messages 2023-05-20 14:21:10 +09:00
Yu Watanabe cefa4a02ab cryptenroll: drop unmet condition 2023-05-20 14:21:10 +09:00
Yu Watanabe b3bd6ccd1e
Merge pull request #27707 from mrc0mmand/tests
test: provide coverage for a couple of recent-ish issues
2023-05-20 08:40:01 +09:00
Yu Watanabe 294c20198b test: replace Makefile for several tests with symlink to the one for TEST-01-BASIC 2023-05-20 05:42:24 +09:00
Yu Watanabe 396f6900ae
Merge pull request #27676 from ldv-alt/udevadm-verify
udevadm-verify: add support for directory arguments
2023-05-20 05:41:05 +09:00
Yu Watanabe 24d724087f
Merge pull request #27701 from poettering/switch-root-same-file
switch-root: use same_files() logic when checking whether new and old root dir are actually the same
2023-05-20 05:39:28 +09:00
Luca Boccassi 382e18fd95
Merge pull request #27438 from bluca/dump_ratelimit
manager: restrict Dump*() to privileged callers or ratelimit
2023-05-19 21:29:58 +01:00
Frantisek Sumsal a9ec30ab7e test: check if we correctly handle locales with leading spaces
Provides coverage for #27179.
2023-05-19 21:35:47 +02:00
Frantisek Sumsal 305aa43815 tests: run all functions with testcase_ prefix automagically 2023-05-19 20:03:34 +02:00
Frantisek Sumsal b74df879fc test: check if we correctly handle invalid UTF-8 in mount stuff
Provides coverage for #27611.
2023-05-19 20:03:34 +02:00
Frantisek Sumsal 928733cd86 test: assorted TEST-13-NSPAWN tweaks 2023-05-19 20:03:34 +02:00
Frantisek Sumsal c11c50a53f test: check if we can use --merge with --follow
Provides coverage for #24565.
2023-05-19 20:03:34 +02:00
Lennart Poettering 3530fd8913 namespace-util: use inode_same_at() instead of FORMAT_PROC_FD_PATH()
Doesn't matter much, but this makes it leas magic and independent of
/proc/ mounts. (Well, it actually doesn't, since the right-hand path is
also in /proc/, but still...
2023-05-19 17:42:41 +02:00
Lennart Poettering 563e684689 stat-util: rename files_same() → inode_same()
Let's be more accurate about what this function does: it checks whether
the underlying reported inode is the same. Internally, this already uses
a better named stat_inode_same() call, hence let's similarly name the
wrapping function following the same logic.

Similar for files_same_at() and path_equal_or_same_files().

No code changes, just some renaming.
2023-05-19 17:42:41 +02:00
Lennart Poettering 5268188de1 switch-root: check if old and new root fs is same via files_same_at() 2023-05-19 17:42:31 +02:00
Lennart Poettering 676ade310a stat-util: add _at() variant for files_same() 2023-05-19 17:41:08 +02:00
Frantisek Sumsal e47622a61c journalctl: make --follow work with --merge again
Set --boot with --follow only if it's not already set and if --merge is
not used, since it's not compatible with --boot.

Follow-up to 2dd9285bac.
Resolves: #24565
2023-05-19 23:48:13 +09:00
Lennart Poettering 75edb7ca96
Merge pull request #27700 from poettering/switch-root-sync
switch-root: add sync() before getting rid of auxiliary mounts of old root
2023-05-19 07:27:23 -07:00
Luca Boccassi d936595672 manager: restrict Dump*() to privileged callers or ratelimit
Dump*() methods can take quite some time due to the amount of data to
serialize, so they can potentially stall the manager. Make them
privileged, as they are debugging tools anyway. Use a new 'dump'
capability for polkit, and the 'reload' capability for SELinux, as
that's also non-destructive but slow.

If the caller is not privileged, allow it but rate limited to 10 calls
every 10 minutes.
2023-05-19 15:18:23 +01:00
Luca Boccassi 53d6987f9e ratelimit: add ratelimit_left helper 2023-05-19 15:17:35 +01:00
Frantisek Sumsal 2808a9fc36
Merge pull request #27698 from mrc0mmand/test-tweaks
test: a couple of performance-related tweaks
2023-05-19 15:29:35 +02:00
Lennart Poettering 5221b55bb3 switch-root: sync() before MNT_DETACH unmounting all old mounts
As discussed here:

https://github.com/systemd/systemd/pull/27670#discussion_r1196716794
2023-05-19 14:31:11 +02:00
Lennart Poettering b7106af465 tree-wide: remove (void) cast around sync()
The call is void anyway, it doesn't return an failure indication. Hence,
no need to cast void to (void)...

(We got this right in most cases, but forgot some)
2023-05-19 14:21:21 +02:00
Lennart Poettering 9287925a0d update TODO 2023-05-19 14:04:07 +02:00
Lennart Poettering 2191bcbbd6
Merge pull request #27670 from poettering/switch-root-umount-all
umount all mounts during MS_MOVE switch root
2023-05-19 05:03:23 -07:00