Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe b917743d50 nspawn: update help message for user namespacing
Follow-up for 33eac552ab.
2022-06-27 10:31:41 +09:00
Yu Watanabe c3613ee51e udev: allow to execute longer command line
Fixes #23607.
2022-06-24 20:09:24 +09:00
Yu Watanabe 46355675f7 Merge pull request #23774 from yuwata/netlabel-nftset-follow-ups
network, core: revert NFTSet and NetLabel features
2022-06-23 01:33:19 +09:00
Yu Watanabe a32badc5a6 Revert "networkd: NetLabel integration"
This reverts PR #23269 and its follow-up commit. Especially,
2299b1cae3 (partially), and
3cf63830ac.

The PR was merged without final approval, and has several issues:
- The NetLabel for static addresses are not assigned, as labels are
  stored in the Address objects managed by Network, instead of Link.
- If NetLabel is specified for a static address, then the address
  section will be invalid and the address will not be configured,
- It should be implemented with Request object,
- There is no test about the feature.
2022-06-22 22:34:26 +09:00
Yu Watanabe b48ed70c79 Revert NFTSet feature
This reverts PR #22587 and its follow-up commit. More specifically,
2299b1cae3 (partially),
e176f855278d5098d3fecc5aa24ba702147d42e0,
ceb46a31a01b3d3d1d6095d857e29ea214a2776b, and
51bb9076ab8c050bebb64db5035852385accda35.

The PR was merged without final approval, and has several issues:
- OSS fuzz reported issues in the conf parser,
- It calls synchrnous netlink call, it should not be especially in PID1,
- The importance of NFTSet for CGroup and DynamicUser may be
  questionable, at least, there was no justification PID1 should support
  it.
- For networkd, it should be implemented with Request object,
- There is no test for the feature.

Fixes #23711.
Fixes #23717.
Fixes #23719.
Fixes #23720.
Fixes #23721.
Fixes #23759.
2022-06-22 22:23:58 +09:00
Yu Watanabe 82d7a151db core: close watchdog device if watchdog device is unspecified now
If a watchdog device was specified previously, and unspecified later and
PID1 is reloaded, then we need to close the device.
2022-06-22 16:23:36 +09:00
Yu Watanabe e83c4d178b core: drop unnecessary free
As reset_arguments() frees the string.

Follow-up for 919ea64f69.
2022-06-22 16:21:06 +09:00
Yu Watanabe e83cfbf972 locale: drop unnecessary allocation
Fixes a bug introduced by 3d36b5d7e7.

Fixes #23777.
2022-06-18 14:46:45 +01:00
Yu Watanabe 297cc64bfb Merge pull request #23771 from mrc0mmand/test-tweaks
A couple of test-output-related tweaks
2022-06-18 10:45:22 +09:00
Yu Watanabe cf906beaef test: add syscall filter tests for analyze security 2022-06-17 12:45:45 +09:00
Yu Watanabe 6d6a08547c seccomp-util: make @known include @obsolete
@known is generated from syscall-list.txt, which generated from kernel
headers. So, some syscalls in @obsolete may not be listed in
syscall-list.txt.
2022-06-17 12:40:43 +09:00
Yu Watanabe 5862e5561c analyze-security: always save syscall name
This reverts dd51e725df and fixes bugs
introduced by 1624114d74.

Previously,
- On online scan, the syscall filter was a string Hashmap, but it
  might contain syscall name with errno or error action. Hence, we need
  to drop the errno or error action in the string.
- On offline scan, the syscall filter was a Hashmap of syscall ID, so
  hashmap_contains() with syscall name did not work. We need to convert
  syscall IDs to syscall names.
- If hashmap_contains() in syscall_names_in_filter() is true, then
  the syscall is allowed when the list is an allow-list, and vice versa.
  Hence, the condition in syscall_names_in_filter() was errnously
  inverted by dd51e725df.

This makes syscalls are always stored with its name, instead of ID,
and also correct the condition.

Fixes #23663.
2022-06-17 12:37:56 +09:00
Yu Watanabe cb649d12bf set: introduce set_put_strndup()
Note, if `n != SIZE_MAX`, we cannot check the existence of the specified
string in the set without duplicating the string. And, set_consume() also
checks the existence of the string. Hence, it is not necessary to call
set_contains() if `n != SIZE_MAX`.
2022-06-17 12:28:36 +09:00
Yu Watanabe 1008d415e7 core/dbus-execute: drop unnecessary flag
The code block is called only when the list was empty, and the newly
requested list is allow-list. Hence, invert_flag is always zero here.
2022-06-17 12:26:50 +09:00
Yu Watanabe 8c93ebbdf0 core/dbus-execute: do not append denied syscalls in allow-list
Follow-up for 68acc1afbe.

Before the commit, SystemCallFilter bus property provides only allowed
syscalls if ExecContext.syscall_filter is an allow-list, and vice versa.

After the commit, if the list is allow-list, it contains allowed
syscalls with value `-1`, and denied syscalls with non-negative values.

To keep the backward compatibility, denied syscalls must be dropped in
SystemCallFilter bus property.
2022-06-17 12:19:39 +09:00
Yu Watanabe 75176c7914 Merge pull request #23741 from mrc0mmand/more-asan-tweaks
test: wrap certain uninstrumented binaries to make them work w/ ASan
2022-06-16 12:10:56 +09:00
Yu Watanabe 05ab439a62 nspawn: fix UID map string
We send/recv the set of payload uid, host uid, payload gid, host gid.
Hence, the index must be incremented with 4, instead of 2.

Fixes #23664.
2022-06-16 11:52:59 +09:00
Yu Watanabe 172cbcdc8b tree-wide: fix typo 2022-06-15 14:50:34 +09:00
Yu Watanabe eed6ee82df Merge pull request #23733 from sshedi/cid-1469711
homework: initialize we_detached
2022-06-15 12:03:24 +09:00
Yu Watanabe 4589c1d734 Merge pull request #23709 from yuwata/test-hostname-locale
test: import hostname and locale tests from debian/ubuntu test suite
2022-06-15 12:00:22 +09:00
Yu Watanabe 6243063824 test: use trap RETURN 2022-06-14 21:08:04 +09:00
Yu Watanabe 4627fb80bf test: move "do" at the end of line 2022-06-14 21:06:06 +09:00
Yu Watanabe 2f34ee3329 test: insert space in for loop 2022-06-14 21:05:10 +09:00
Yu Watanabe 47ba157cc0 test: import localed tests from debian/ubuntu test suite 2022-06-14 20:59:36 +09:00
Yu Watanabe 4ce68ea9b3 test: install C.UTF-8 and English locales 2022-06-14 20:59:36 +09:00
Yu Watanabe 1136175c7f test: install libxkbcommon and x11 keymaps 2022-06-14 20:59:36 +09:00
Yu Watanabe da0465dc95 test: introduce inst_recursive() helper function 2022-06-14 20:59:32 +09:00
Yu Watanabe 569c6fd1b7 test: add one more path to search keymaps
Now it also supports split-usr.
2022-06-14 20:56:23 +09:00
Yu Watanabe 2b1eb5f871 localectl: use Table to show status 2022-06-14 20:56:23 +09:00
Yu Watanabe 3e5203b3eb locale: rename keymap-util.[ch] -> localed-util.[ch]
As the file contains not only keymap related functions.
2022-06-14 20:56:23 +09:00
Yu Watanabe 3d36b5d7e7 locale-setup: merge locale handling in PID1 and localed 2022-06-14 20:56:23 +09:00
Yu Watanabe d2e96a4f87 locale-util: align locale entries 2022-06-14 20:56:23 +09:00
Yu Watanabe a2f7937747 locale-util: check if enumerated locales are valid 2022-06-14 20:56:23 +09:00
Yu Watanabe 065058e63b locale-util: fix memleak on failure 2022-06-14 20:56:23 +09:00
Yu Watanabe 39f4546199 test: import hostnamed tests from debian/ubuntu test suite 2022-06-14 20:56:18 +09:00
Yu Watanabe aab61a8c99 test: support debian/ubuntu specific timezone config file 2022-06-14 20:52:44 +09:00
Yu Watanabe 8ed2103306 test: drop unnecessary --no-pager option 2022-06-14 20:52:44 +09:00
Yu Watanabe d170b47535 test: introduce assert_not_in() helper function
This also silence assertions, and replace grep with bash's regular
expression match.
2022-06-14 20:52:38 +09:00
Yu Watanabe 9d55166018 Merge pull request #23714 from mrc0mmand/networkd-testsuite-tweaks
A couple of assorted tweaks for the systemd-networkd test suite
2022-06-12 13:16:30 +09:00
Yu Watanabe 0ffc372a1d shared/linux: update kernel headers to 5.19-rc1 2022-06-11 06:50:12 +09:00
Yu Watanabe 7d9a2c0aa6 basic/linux: update kernel headers to 5.19-rc1 2022-06-11 06:49:42 +09:00
Yu Watanabe 3c4ae50abe dns-domain: reduce indentation in dns_service_split() 2022-06-11 06:02:08 +09:00
Yu Watanabe ec4c01475e dns-domain: rename function arguments 2022-06-11 06:01:48 +09:00
Yu Watanabe 9db01ca5b0 dns-domain: make each label nul-terminated
dns_label_unescape() does not nul-terminate the buffer if it does not
have enough space. Hence, if a lable is enough long, then strjoin()
triggers buffer-overflow.

Fixes #23705.
2022-06-11 06:01:46 +09:00
Yu Watanabe 288bafa952 Merge pull request #23691 from medhefgo/efi-clang
efi: Add parse_number8/16
2022-06-11 05:01:24 +09:00
Yu Watanabe 3e808e0769 Merge pull request #23701 from medhefgo/boot-mem
boot: Use memcpy/memset provided by firmware
2022-06-11 04:29:27 +09:00
Yu Watanabe 67bca872ea Merge pull request #23688 from yuwata/boot-efi-string-efi_fnmatch-fix-over-flow
boot/efi-string: check the end of haystack before testing remaining pattern
2022-06-10 18:47:15 +09:00
Yu Watanabe 3284dd9159 test: exclude network interfaces
After https://github.com/systemd/systemd-centos-ci/pull/492 is merged,
the networkd test may be running when test-sd-device is invoked.
Let's exclude net subsystem.
2022-06-10 18:44:21 +09:00
Yu Watanabe 759ed0a253 test: import timedated test from debian/ubuntu test suite 2022-06-10 16:04:52 +09:00
Yu Watanabe 9c94ab0f6f test: import logind test from debian/ubuntu test suite 2022-06-10 15:44:10 +09:00
Yu Watanabe f9e090b16d test: always exclude devices named loop*
Not only block subsystem, but also misc has device named "loop*", and
the test always said that the following device is newly found:
---
/* test_sd_device_enumerator_filter_subsystem */
New device found: subsystem:misc syspath:/sys/devices/virtual/misc/loop-control
1 new devices are found in re-scan
---
2022-06-10 15:36:21 +09:00
Yu Watanabe 3d52219390 test: drop redundant IMAGE_NAME=
If it is not specified, then "default" will be used.
2022-06-10 12:31:14 +09:00
Yu Watanabe da5fb1877d boot/efi-string: check the end of haystack before testing remaining pattern
Fixes buffer-overflow reported at https://github.com/systemd/systemd/pull/23589#issuecomment-1151820341.
2022-06-10 12:05:38 +09:00
Yu Watanabe c07eb49aff devnode-acl: use set_put_strdup_full() and set_ensure_consume() 2022-06-10 10:47:25 +09:00
Yu Watanabe 47484dd955 dns-domain: simplify code a bit 2022-06-10 09:49:07 +09:00
Yu Watanabe 8d896617b4 dns-domain: use dns_name_concat()
`dns_name_normalize()` is an alias of `dns_name_concat()`.
For consistency with `dns_name_is_valid_ldh()`, let's use
`dns_name_concat()`.
2022-06-10 09:42:33 +09:00
Yu Watanabe 8bf796eeac Merge pull request #23589 from medhefgo/efi-clang
boot: Drop use of several gnu-efi functions
2022-06-10 08:54:48 +09:00
Yu Watanabe 74223cbe14 tree-wide: fix typo 2022-06-10 08:26:08 +09:00
Yu Watanabe 677ec2d609 Merge pull request #23348 from medhefgo/log-shutdown-blockers
shutdown: Log processes that block umount
2022-06-10 05:33:37 +09:00
Yu Watanabe 377157e6bd Merge pull request #23616 from keszybz/in-addr-to-string-formatting
Add macros that allocate a fixed buffer for in_addr_to_string(), in_addr_prefix+to_string()
2022-06-09 15:21:57 +09:00
Yu Watanabe adf59bffe5 Merge pull request #23675 from enr0n/udev-available-cleanup
Use udev_available() where appropriate
2022-06-09 12:12:01 +09:00
Yu Watanabe a71278840b test: add dlopen test for pam_systemd_home 2022-06-03 13:40:14 +01:00
Yu Watanabe 311f57a402 Merge pull request #23583 from yuwata/boot-efi-string-follow-ups
boot: follow-ups for efi-string functions
2022-06-03 10:23:24 +09:00
Yu Watanabe 0a11366280 login: fix typo
Follow-up for ea74f39c24.
2022-06-03 04:28:01 +09:00
Yu Watanabe 095e173a04 boot: use CMP() macro for safety 2022-06-03 04:20:46 +09:00
Yu Watanabe 42e785d096 boot: make several functions inline
Follow-ups for #23512.
2022-06-03 04:20:46 +09:00
Yu Watanabe a54e635d02 boot: fix typo 2022-06-03 04:20:46 +09:00
Yu Watanabe 93d13a7dff test: fix indentation 2022-06-02 14:14:22 +09:00
Yu Watanabe 3bccc736c6 test: add test for sha256 2022-06-02 14:14:22 +09:00
Yu Watanabe c7a5eabeba sha256: use memcpy() when result buffer is unaligned
Fixes #23578.
2022-06-02 14:14:22 +09:00
Yu Watanabe 9db25d01ef Merge pull request #23531 from yuwata/sd-bus-drop-version-2
sd-bus: drop version 2 format support
2022-06-01 14:51:44 +09:00
Yu Watanabe cd25e17001 Merge pull request #23512 from medhefgo/efi-clang
boot: Add string functions
2022-06-01 06:16:48 +09:00
Yu Watanabe 66dc5d82b5 test-network: call networkctl only when specified interface exists
Otherwise, this easily trigger another exception:
```
======================================================================
ERROR: test_erspan_tunnel_v0 (__main__.NetworkdNetDevTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test/test-network/systemd-networkd-tests.py", line 686, in wait_online
    check_output(*args, env=env)
  File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output
    return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip()
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/lib/systemd/systemd-networkd-wait-online', '--timeout=20s', '--interface=erspan99:routable', '--interface=erspan98:routable', '--interface=dummy98:degraded']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./test/test-network/systemd-networkd-tests.py", line 1808, in test_erspan_tunnel_v0
    self.wait_online(['erspan99:routable', 'erspan98:routable', 'dummy98:degraded'])
  File "./test/test-network/systemd-networkd-tests.py", line 689, in wait_online
    output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0], env=env)
  File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output
    return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip()
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/networkctl', '-n', '0', 'status', 'erspan99']' returned non-zero exit status 1.
```
2022-06-01 04:02:49 +09:00
Yu Watanabe 2f0260c1bb test-network: add tests for erspan version 0 and 2 2022-06-01 04:02:49 +09:00
Yu Watanabe 98406eda8a network/erspan: support erspan version 0 and 2
This also makes networkd accepts erspan index 0.

Closes #23570.
2022-06-01 04:02:48 +09:00
Yu Watanabe a452cfd77b sd-bus: drop constant argument for message_extend_fields() 2022-06-01 03:41:16 +09:00
Yu Watanabe 0dd4876815 sd-bus: drop D-Bus version 2 format support
It seems the format is used only by kdbus.
2022-06-01 03:41:15 +09:00
Yu Watanabe c0f664ca89 sd-bus: merge message_peek_fields() and buffer_peek() 2022-06-01 03:41:15 +09:00
Yu Watanabe 75c85c3b25 sd-bus: make several functions static
And drop 'bus_' prefix from them.
2022-06-01 03:41:15 +09:00
Yu Watanabe 590a738562 sd-bus: use UINT32_MAX 2022-06-01 03:41:15 +09:00
Yu Watanabe b7096bd690 sd-bus: drop unnecessary cast 2022-06-01 03:41:15 +09:00
Yu Watanabe 30da99bd30 sd-bus: drop redundant condition
By the previous commit, ALIGN8() is always equal to or greater than the
argument.
2022-06-01 03:41:15 +09:00
Yu Watanabe dc7be33266 sd-bus: use ALIGN8() 2022-06-01 03:41:15 +09:00
Yu Watanabe b4e7df4a47 boot: use ALIGN4() 2022-06-01 03:41:15 +09:00
Yu Watanabe 4c8d7caf1a macro: make ALIGN4() and ALIGN8() also return SIZE_MAX on overflow
This also drops unused ALIGN4_PTR(), ALIGN8_PTR(), and ALIGN_TO_PTR().
2022-06-01 03:40:20 +09:00
Yu Watanabe 394129f88b tree-wide: use ALIGN_PTR() 2022-06-01 03:12:33 +09:00
Yu Watanabe a0f0cf0a6b portable: fix command option in comment
Follow-up for edea370222.
2022-05-31 16:32:09 +02:00
Yu Watanabe 71891fb2de Merge pull request #23558 from msekletar/issue-20329-followup
Actually delay running of mount start jobs when /p/s/mountinfo is rate limited
2022-05-31 17:38:25 +09:00
Yu Watanabe 4282f39430 Merge pull request #23564 from yuwata/core-unit-add-dep
core: fix notification about unit dependency change
2022-05-31 14:07:34 +09:00
Yu Watanabe 9a18321058 Merge pull request #23560 from mrc0mmand/coccinelle
A couple of tweaks suggested by Coccinelle
2022-05-31 05:02:57 +09:00
Yu Watanabe a8c5a4c6c2 core: make unit_add_two_dependencies() or friends return 1 on changed
Follow-up for f971def3c2.
2022-05-31 01:53:11 +09:00
Yu Watanabe ac17080c04 core/unit: fix notification about unit dependency change
This also makes unit_add_dependency() return 1 only when a dependency
is added.
2022-05-31 01:53:11 +09:00
Yu Watanabe 35207b14cf Merge pull request #23562 from yuwata/fix-typo
Fix typo
2022-05-31 01:52:39 +09:00
Yu Watanabe 5473bc61af esp: fix typo
Follow-up for 13d7c841a2.
2022-05-31 01:17:34 +09:00
Yu Watanabe f79f6856a2 doc: fix typo
Follow-ups for #23504.
2022-05-31 01:16:04 +09:00
Yu Watanabe edea370222 portable: remove drop-in configs even if the main unit file does not exist
When we run `portablectl detach --enable --runtime`, then it triggers
`DisableUnitFilesWithFlags` DBus method and the main unit file is
removed, but its drop-ins are not. Hence, portable_detach() failed to
list existing portable units.

This makes the loop for listing portable units also accept drop-in
directories. So, all remaining drop-in directories are correctly
removed.

Before:
```
testsuite-29.sh[600]: + portablectl detach --now --runtime --enable /tmp/rootdir minimal-app0
portablectl[1391]: (Matching unit files with prefixes 'minimal-app0'.)
portablectl[1391]: Queued /org/freedesktop/systemd1/job/1812 to call StopUnit on portable service minimal-app0-foo.service.
portablectl[1391]: Removed "/run/systemd/system.attached/minimal-app0-foo.service".
portablectl[1391]: Queued /org/freedesktop/systemd1/job/1813 to call StopUnit on portable service minimal-app0.service.
portablectl[1391]: Removed "/run/systemd/system.attached/minimal-app0.service".
portablectl[1391]: Got result done/Success for job minimal-app0-foo.service
portablectl[1391]: Got result done/Success for job minimal-app0.service
portablectl[1391]: DetachImage failed: No unit files associated with '/tmp/rootdir' found attached to the system. Image not attached?
```

After:
```
testsuite-29.sh[508]: + portablectl detach --now --runtime --enable /tmp/rootdir minimal-app0
portablectl[1076]: (Matching unit files with prefixes 'minimal-app0'.)
portablectl[1076]: Queued /org/freedesktop/systemd1/job/1946 to call StopUnit on portable service minimal-app0-foo.service.
portablectl[1076]: Removed "/run/systemd/system.attached/minimal-app0-foo.service".
portablectl[1076]: Queued /org/freedesktop/systemd1/job/1947 to call StopUnit on portable service minimal-app0.service.
portablectl[1076]: Removed "/run/systemd/system.attached/minimal-app0.service".
portablectl[1076]: Removed /run/systemd/system.attached/minimal-app0.service.d/10-profile.conf.
portablectl[1076]: Removed /run/systemd/system.attached/minimal-app0.service.d/20-portable.conf.
portablectl[1076]: Removed /run/systemd/system.attached/minimal-app0.service.d.
portablectl[1076]: Removed /run/systemd/system.attached/minimal-app0-foo.service.d/10-profile.conf.
portablectl[1076]: Removed /run/systemd/system.attached/minimal-app0-foo.service.d/20-portable.conf.
portablectl[1076]: Removed /run/systemd/system.attached/minimal-app0-foo.service.d.
portablectl[1076]: Removed /run/portables/rootdir.
portablectl[1076]: Removed /run/systemd/system.attached.
```
2022-05-31 01:09:29 +09:00
Yu Watanabe 8288382049 Merge pull request #23354 from DaanDeMeyer/mount-implicit-device-dep-trace
core: Add trace logging to mount_add_device_dependencies()
2022-05-31 01:00:56 +09:00
Yu Watanabe 6a49fcdb3c portable: try to remove unit files even in a spurious state 2022-05-30 04:34:43 +09:00
Yu Watanabe 1b1e53d2a8 test: drop redundant log message 2022-05-30 04:17:54 +09:00
Yu Watanabe ba780ccd5f Merge pull request #23542 from medhefgo/attributes
meson: Document why -Wimplicit-fallthrough is not used with clang
2022-05-30 04:07:41 +09:00