1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-09 12:58:26 +03:00

70029 Commits

Author SHA1 Message Date
Vladimir Stoiakin
9499741c0e TEST-24-CRYPTSETUP: depend on OpenSSL for testing PKCS#11 tokens 2024-01-07 05:26:54 +09:00
Frantisek Sumsal
f569dc6af2 repart: don't crash when looping over dropped partitions
Properly skip over dropped partitions and make sure they don't affect
the final graphical output (for example by leaving empty "spaces" where
their definition file name would otherwise be).

Resolves: #30742
2024-01-07 05:26:38 +09:00
Yu Watanabe
0417d1d0e8
Merge pull request #30803 from yuwata/network-route-parser-trivial-cleanups
network/route: trivial cleanups for conf parsers
2024-01-07 05:26:06 +09:00
Yu Watanabe
74e95e3a81 network/link: always join to the main interface when we receive IFLA_MASTER attribute
Otherwise, e.g. when we enumerate a bridge port first, then the bridge
main interface, then the port cannot be managed by the main interface.

Fixes #30682.
2024-01-07 05:25:55 +09:00
Frantisek Sumsal
b53bd7a32b test: reinitialize arg_transport before parsing arguments
Since libfuzzer feeds a single fuzzing process with multiple inputs, we
might carry over arg_transport from a previous invocation, tripping over
the assert in acquire_bus():

+----------------------------------------Release Build Stacktrace----------------------------------------+
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Aborting.
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2739==ERROR: AddressSanitizer: ABRT on unknown address 0x00000ab3 (pc 0xf7f52509 bp 0xffdf74cc sp 0xffdf74b0 T0)
SCARINESS: 10 (signal)
    #0 0xf7f52509 in linux-gate.so.1
    #1 0xf703b415 in raise
    #2 0xf70233f6 in abort
    #3 0xf772ac0a in log_assert_failed systemd/src/basic/log.c:968:9
    #4 0xf77300d5 in log_assert_failed_return systemd/src/basic/log.c:987:17
    #5 0xf7432bbf in bus_connect_transport systemd/src/shared/bus-util.c:284:9
    #6 0x818cd17 in acquire_bus systemd/src/systemctl/systemctl-util.c:53:29
    #7 0x815fd3c in help_boot_loader_entry systemd/src/systemctl/systemctl-logind.c:431:13
    #8 0x819ca87 in systemctl_parse_argv systemd/src/systemctl/systemctl.c:863:37
    #9 0x8197632 in systemctl_dispatch_parse_argv systemd/src/systemctl/systemctl.c:1137:16
    #10 0x813328d in LLVMFuzzerTestOneInput systemd/src/systemctl/fuzz-systemctl-parse-argv.c:54:13
    #11 0x81bbe7e in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned int) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #12 0x81bb5b8 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned int, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #13 0x81bd42d in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
    #14 0x81bd62e in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
    #15 0x81ac84c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned int)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #16 0x81d65c7 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #17 0xf7024ed4 in __libc_start_main
    #18 0x806bdb5 in _start

Resolves: #30802
2024-01-06 18:52:04 +01:00
Mike Yuan
f277e5f607
TODO: drop some implemented entries 2024-01-07 01:46:35 +08:00
Yu Watanabe
5c64017aa8 network/route-metric: unify error messages 2024-01-07 01:39:58 +09:00
Yu Watanabe
e2126e235e network/route-metric: pass attribute type to conf parsers
The passed attribute type will be used later.

This also
- rename conf parsers,
- sort gperf entries by the attr type.

No functional change, just refactoring and preparation for later commits.
2024-01-07 01:39:58 +09:00
Yu Watanabe
df8767fc8d network/route: move several conf parsers to networkd-route-metric.c and networkd-route-nexthop.c
This also split config_parse_route_boolean() into two:
for GatewayOnline= and boolean route metrics.

No functional change, just refactoring and preparation for later commits.
2024-01-07 01:39:58 +09:00
Yu Watanabe
f48e52bda8 network/route: rename n -> route in conf parsers 2024-01-07 01:39:58 +09:00
Yu Watanabe
d2bec2426f network/route: do not invalidate [Route] section when an empty string is assigned to MultiPathRoute= 2024-01-07 01:39:58 +09:00
Frantisek Sumsal
bea3db2ff9
Merge pull request #30801 from yuwata/test-network-cleanups
test-network: several cleanups
2024-01-06 11:26:39 +01:00
Yu Watanabe
6b07675d81 test-network: do not call networkctl if networkd is in failed state
Otherwise, networkd may be restarted by DBus and we may get wrong
results.
2024-01-06 14:48:18 +09:00
Yu Watanabe
10d670a3c1 test-network: introduce networkctl() and friends 2024-01-06 14:48:15 +09:00
Yu Watanabe
032fd10de8 test-network: use read_networkd_log() at one more place 2024-01-06 12:46:00 +09:00
Yu Watanabe
bd581438a1 test-network: sync journal before read
Otherwise, test cases that check journal entries, e.g. test_unit_file()
may fail.
2024-01-06 12:45:59 +09:00
Lennart Poettering
6db53d20f5 nspawn: lock down access to notify socket a bit
On Linux only the "w" access bit is necessary to connect to an AF_UNIX
socket, hence let's only set that and nothing else, to limit exposure.

Just paranoia.
2024-01-06 11:21:00 +09:00
Frantisek Sumsal
d7942fe5fc core: escape spaces in paths during serialization
Otherwise we split them incorrectly when deserializing them.

Resolves: #30747
2024-01-06 11:19:59 +09:00
Yu Watanabe
b82b4d258e
Merge pull request #30794 from poettering/parse-vsock-better
socket-util: add more careful parsers for AF_VSOCK cid/port
2024-01-06 11:16:19 +09:00
Yu Watanabe
7ba3e44651 udevadm: allow to override the default log level by environment variable
Previously, there was no way to override the log level for test and
test-builtin commands. Let's re-parse environment after setting the log
level to debug. Then, we can control the log level through environment
variable.
2024-01-06 08:30:58 +09:00
Yu Watanabe
976309db6a
Merge pull request #30796 from mrc0mmand/journalctl-namespaces
journalctl: provide shell completion for --namespace=
2024-01-06 08:30:31 +09:00
Lennart Poettering
a6a7983dbf dev-setup: rework make_inaccessible_nodes() around openat() and friends
Let's operate on fds rather than paths. Make some tweaks to the logic on
top:

1. Mark the resulting dir as read-only after we are done.
2. Use the new inode_type_to_string() calls to determine the inode
   names.
3. If an inode already exists, try to adjust the access mode, just in
   case.
4. Use FOREACH_ARRAY()
2024-01-06 08:27:51 +09:00
Yu Watanabe
0d1706b5fa
Merge pull request #30775 from yuwata/network-nexthop-is-ready
network: introduce nexthop_is_ready() helper function and use it
2024-01-06 08:27:35 +09:00
networkException
dcfac3a3f9 parse-helpers: allow port 0 for socket bind items
This patch adds a new parameter to parse_ip_port_range, giving callers
the option to allow ranges to have their min be 0 instead of 1.

This is then used by parse_ip_ports_token, intern used by
parse_socket_bind_item to allow port 0 when restricting bind system
calls with SocketBindDeny / SocketBindAllow.

With this, users running server software written using the golang
standard library will be able to effectively sandbox their software,
albeit with a small loss in security protections by allowing the
process to bind on a random port in the
/proc/sys/net/ipv4/ip_local_port_range.
2024-01-06 08:27:14 +09:00
Lennart Poettering
9807ee19b0
Merge pull request #30791 from poettering/nspawn-restrict-run-host
nspawn: make some files we expose in /run/host/ in nspawn read-only via access mode
2024-01-05 22:37:29 +01:00
Lennart Poettering
32fa24582c nspawn: add new common make_run_host() helper
This new helper creates the /run/host/ top-level dir inside the
container.
2024-01-05 22:34:47 +01:00
Lennart Poettering
8e471c6a9f socket-util: add more careful parsers for AF_VSOCK cid/port
Let's handle the magic CIDs, and filter out invalid ports.
2024-01-05 22:29:55 +01:00
Lennart Poettering
41dd51f8f5 missing: add a bunch of vsock related defines 2024-01-05 22:29:55 +01:00
Yu Watanabe
92a39246ad
Merge pull request #30790 from poettering/null-creds-allow-with-tpm
creds: allow using NULL encryption if explicitly requested even if TPM is available, and add a comprehensive credential encryption/decrpytion test
2024-01-06 04:26:38 +09:00
Frantisek Sumsal
178c8c24ec shell-completion: provide completion for journalctl --namespace=
Resolves: #30381
2024-01-05 19:21:51 +01:00
Frantisek Sumsal
2fe03e25fb shell-completion: fix mixed indent 2024-01-05 19:21:51 +01:00
Frantisek Sumsal
68f66a1713 journalctl: implement --list-namespaces
Apart from being useful on its own, this will be used in the following
commit for shell completions.
2024-01-05 19:21:51 +01:00
Lennart Poettering
05794f5c48 nspawn: set read-only access mode on two /run/host/ files
The diectory is mounted read-only anyway, hence this doesn't do much,
but let's lock this down on every level we can.
2024-01-05 17:31:08 +01:00
Lennart Poettering
2148c669d2 fileio: add new flag WRITE_STRING_FILE_MODE_0444
With this write_string_file() will create the file with 0444 access mode
(i.e. read-only).
2024-01-05 17:30:41 +01:00
Lennart Poettering
3a3315c705 test: add credential encryption/decryption test 2024-01-05 17:20:05 +01:00
Lennart Poettering
9c3d8db990 creds-util: optionally, allow NULL credentials even with TPM 2024-01-05 17:20:05 +01:00
Lennart Poettering
3289aba5a0
Merge pull request #30754 from poettering/iovecification
tpm2-util: convert various things over to struct iovec rather that data ptr + size
2024-01-05 14:45:15 +01:00
Lennart Poettering
53cea64542
Merge pull request #30784 from poettering/json-dispatch-enum
json: add macro for automatically defining a dispatcher for an enum
2024-01-05 14:44:59 +01:00
Lennart Poettering
fe10493ca8
Merge pull request #30785 from poettering/json-allow-extensions
json: add flag for allowing extension of json objects when dispatching, without otherwise being permissive
2024-01-05 14:44:50 +01:00
Yu Watanabe
ff4240fc22 test: wait for verbose-success.service finished
Otherwise, the command 'echo' may not be invoked yet.

Follow-up for 25aa35d465cf4725bc3ebd2a919e7f39ecafb920.
2024-01-05 13:08:10 +01:00
Lennart Poettering
f0e4244b2f tree-wide: use JSON_ALLOW_EXTENSIONS when disptching at various places
If we want to allow method replies to be extended without this breaking
compat, then we should set this flag. Do so at various method call
replies hence.

Also do it when parsing user/group records, which are expressly
documented to be extensible, as well as the hibernate JSON record.
2024-01-05 12:43:06 +01:00
Lennart Poettering
a617fd9047 json: add new dispatch flag JSON_ALLOW_EXTENSIONS
This is a subset of JSON_PERMISSIVE focussed on allowing parsing of
varlink replies that get extended, i.e. gain new fields, without
allowing more than that (i.e. without allowing missing fields, or bad
field types or such).
2024-01-05 12:43:06 +01:00
Lennart Poettering
8ef31e1f13
Merge pull request #29692 from H5117/fix_pkcs11_uri
cryptenroll: change class in provided PKCS#11 URI if necessary
2024-01-05 12:14:26 +01:00
Lennart Poettering
00096a3549 oomd: make use of new JSON_DISPATCH_ENUM_DEFINE() macro 2024-01-05 12:08:37 +01:00
Lennart Poettering
19f3282929 user-record: port over to JSON_DISPATCH_ENUM_DEFINE() 2024-01-05 12:08:37 +01:00
Lennart Poettering
8618ff1368 test: add unit test for JSON_DISPATCH_ENUM_DEFINE() 2024-01-05 12:08:37 +01:00
Lennart Poettering
dda6629622 json: add macro for automatically defining a dispatcher for an enum 2024-01-05 12:08:37 +01:00
Lennart Poettering
8d042bc40a tpm2-util: more iovec'ification
Let's move more code to using struct iovec for passing around binary
chunks of data.

No real changes in behaviour, just refactoring.
2024-01-05 11:34:46 +01:00
Lennart Poettering
9d1c3e9413 test: add unit tests for the new iovec helpers 2024-01-05 11:34:46 +01:00
Lennart Poettering
dddc12f9eb iovec-util: add CONST_IOVEC_MAKE_STRING() 2024-01-05 11:10:22 +01:00