Commit Graph

35258 Commits

Author SHA1 Message Date
Franck Bui
f16890f8d2 watchdog: passing 0 to watchdog_setup now closes the watchdog
Passing 0 meant "disable the watchdog although still kept it opened". However
this case didn't seem to be useful especially since PID1 closes the device if
it is passed the nul timeout.

Hence let's change the meaning of watchdog_setup(0) to match PID1's behavior
which allows to simplify the code a bit.

Hence this patch also drops enable_watchdog().
2021-10-13 08:58:30 +02:00
Franck Bui
c1a08a76ab watchdog: pass USEC_INFINITY to watchdog_setup() to reuse the programmed timeout value
This patch changes the meaning of USEC_INFINITY value for the watchdog
module.

Previously passing this value was a NOP. It now has a special meaning: it
requests the watchdog module to read the programmed timeout value and reuse it
for pinging the device.

This is mostly useful when the watchdog is started by the firmware and there's
no way to reconfigure the timeout with a different value
afterwards. "RuntimeWatchdogSec=infinity" in system.conf can now be used rather
than putting an arbitrary value that PID1 will fail to set (even if it still
felt back to the programmed timeout).

Please note that "infinity" is not supposed to restore the default value of the
firmware. If the value is changed after booting then "infinity" would simply
reuse the current programmed value. IOW it's a NOP unless the watchdog was
previously closed and in that case it will be reopened and the last programmed
value reused.
2021-10-13 08:51:15 +02:00
Franck Bui
ef1d5f3c5c watchdog: configuring a timeout value might not be supported by the HW
In that case we should hanlde this case more gracefully by reusing the
programmed value.

Fixes: #20683
2021-10-13 08:51:13 +02:00
Franck Bui
fcbf2c64f5 watchdog: minor optimization in watchdog_setup() 2021-10-13 08:50:08 +02:00
Franck Bui
85e5613cf3 watchdog: cleanup: create an helper for each ioctl
No functional changes.
2021-10-13 08:50:04 +02:00
Franck Bui
964ccab828 mount-util: fix fd_is_mount_point() when both the parent and directory are network fs
The second call to name_to_handle_at_loop() didn't check for the specific
errors that can happen when the parent dir is mounted by nfs and instead of
falling back like it's done for the child dir, fd_is_mount_point() failed in
this case.
2021-10-01 11:11:45 +02:00
Benjamin Berg
e975a94559 test: Add failing/non-failing syscall filter test setting architecture
This adds a high level test verifying that syscall filtering in
combination with a simple architecture filter for the "native"
architecture works fine.
2021-09-30 08:06:25 +09:00
Benjamin Berg
08bf703cc1 test: Check that "native" architecture is always filtered 2021-09-30 08:06:19 +09:00
Benjamin Berg
f833df3848 seccomp: Always install filters for native architecture
The commit 6597686865 ("seccomp: don't install filters for archs that
can't use syscalls") introduced a regression where filters may not be
installed for the "native" architecture. This means that setting
SystemCallArchitectures=native for a unit effectively disables the
SystemCallFilter= and SystemCallLog= options.

Conceptually, we have two filter stages:
 1. architecture used for syscall (SystemCallArchitectures=)
 2. syscall + architecture combination (SystemCallFilter=)

The above commit tried to optimize the filter generation by skipping the
second level filtering when it is not required.

However, systemd will never fully block the "native" architecture using
the first level filter. This makes the code a lot simpler, as systemd
can execve() the target binary using its own architecture. And, it
should be perfectly fine as the "native" architecture will always be the
one with the most restrictive seccomp filtering.

Said differently, the bug arises because (on x86_64):
 1. x86_64 is permitted by libseccomp already
 2. native != x86_64
 3. the loop wants to block x86_64 because the permitted set only
    contains "native" (i.e. "native" != "x86_64")
 4. x86_64 is marked as blocked in seccomp_local_archs

Thereby we have an inconsistency, where it is marked as blocked in the
seccomp_local_archs array but it is allowed by libseccomp. i.e. we will
skip generating filter stage 2 without having stage 1 in place.

The fix is simple, we just skip the native architecture when looping
seccomp_local_archs. This way the inconsistency cannot happen.
2021-09-30 08:04:59 +09:00
Yu Watanabe
200f77f933 Merge pull request #20876 from poettering/openssl3-creds
creds-util: switch to OpenSSL 3.0 APIs
2021-09-30 04:01:57 +09:00
Luca Boccassi
13b7d99dad headers: update bpf_insn.h to dual license
This header is copied from the kernel. It was relicensed from GPL-2.0-only
to GPL-2.0-only OR BSD-2-Clause, so update our SPDX tag accordingly.

For more details and ACKS from all copyright holders authorizing the
license change see:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=d75fe9cb1dd062684c9fb8a4581738170365dc06
2021-09-29 17:40:55 +01:00
Yu Watanabe
aebff2e7ce core/mount: add implicit unit dependencies even if when mount unit is generated from /proc/self/mountinfo
Hopefully fixes #20566.
2021-09-29 17:25:13 +02:00
Yu Watanabe
209abeac6d Merge pull request #20824 from yuwata/sd-dhcp6-client-cleanups
sd-dhcp6-client: several cleanups for parsing options
2021-09-30 00:08:16 +09:00
Yu Watanabe
ca6bc7ce0d Merge pull request #20226 from yuwata/network-introduce-source-and-status
network: introduce NetworkConfigSource and NetworkConfigState
2021-09-30 00:06:17 +09:00
Yu Watanabe
bfcc0fedd0 Merge pull request #20871 from mrc0mmand/udevadm-property-value
udev: teach udevadm --property=NAME and --value options
2021-09-30 00:05:02 +09:00
Yu Watanabe
504cfa6573 Merge pull request #20877 from yuwata/network-test-mode
network: do not update state files when running in test mode
2021-09-30 00:04:41 +09:00
Lennart Poettering
7f12adc300 openssl-util: use EVP API to get RSA bits 2021-09-29 15:04:19 +02:00
Lennart Poettering
18f568b8e6 creds-util: switch to OpenSSL 3.0 APIs
Let's switch from the low-level SHA256 APIs to EVP APIs. The former are
deprecated on OpenSSL 3.0, the latter are supported both by old
OpenSSL and by OpenSSL 3.0, hence are the better choice.

Fixes: #20775
2021-09-29 15:04:14 +02:00
Anita Zhang
14bb729534 basic/unit-file: don't filter out names starting with dot
Fixes #20859
Reverts 3796bdc55d
2021-09-29 14:42:13 +02:00
Lennart Poettering
e30a3ba16a core: drop "const" from NeedsDaemonReload unit dbus property
It's not "const", it can change any time if people change the fs, and we
don#t send out notifications for it. Hence don't claim it was const.
(Otherwise clients might cache it, but they should not)

Prompted-by: #20792
2021-09-29 14:37:07 +02:00
Lennart Poettering
bee07a3995 resolvconf-compat: make "-u" operation a NOP
According to the various man pages of "resolvconf" the -u switch is for:

"-u Just run the update scripts (if updating is enabled)."

"-u Force resolvconf to update all its subscribers. resolvconf does not
    update the subscribers when adding a resolv.conf that matches what
    it already has for that interface."

We have no "subscribers", we ourselves are the only "subscriber" we
support. Hence it's probably better to ignore such a request and make it
a NOP, then to fail.

Fixes: #20748
2021-09-29 14:36:47 +02:00
Yu Watanabe
faa2e64f9b network: do not configure anything when running in test mode 2021-09-29 20:50:37 +09:00
Yu Watanabe
4c78dc17e5 network: do not update state files when running in test mode
Fixes #20862.
2021-09-29 20:50:37 +09:00
Yu Watanabe
92fc611cac Merge pull request #20802 from yuwata/network-receive-nl80211-multicast-messages
network: receive nl80211 multicast messages
2021-09-29 20:49:38 +09:00
Frantisek Sumsal
6c1482b28d udev: teach udevadm --property=NAME and --value options
which allows limiting the properties listed by the `--query=property` option
(and optionally listing only the respective values).
2021-09-29 13:32:25 +02:00
Frantisek Sumsal
3c318caa6f basic: introduce test_strv_split_and_extend() 2021-09-29 13:32:22 +02:00
Frantisek Sumsal
bbc1bb0742 udev: sort the options alphabetically 2021-09-29 12:52:57 +02:00
Yu Watanabe
96f5f9ef9a network: receive genl multicast messages about wlan connections 2021-09-29 15:56:20 +09:00
Yu Watanabe
f12629ae38 network: move error handling of enumerating configs to caller side 2021-09-29 15:56:09 +09:00
Yu Watanabe
bdcd4ab2f1 network: make manager_enumerate_internal() take sd_netlink object
Preparation for dumping information through generic netlink.
2021-09-29 15:38:59 +09:00
Yu Watanabe
96243149bd network: split manager_new() into two part
Initialize dbus or netlink is not necessary for fuzzers.
2021-09-29 15:38:59 +09:00
Yu Watanabe
16653f9782 wifi-util: introduce nl80211_cmd_to_string() 2021-09-29 15:38:59 +09:00
Yu Watanabe
77f75f4fff network: rename wifi_iftype -> wlan_iftype 2021-09-29 15:38:59 +09:00
Yu Watanabe
abad436d4c wifi-util: move, rename, and expose wifi_iftype_to_string() 2021-09-29 15:38:59 +09:00
Yu Watanabe
8e310690b0 sd-netlink: add several attributes for nl80211 2021-09-29 15:38:59 +09:00
Yu Watanabe
f3e235ffb2 sd-netlink, wifi-util: fix attribute type of NL80211_ATTR_SSID 2021-09-29 15:38:59 +09:00
Yu Watanabe
ae2b86de43 wifi-util: add "ret_" prefix for arguments which store results 2021-09-29 15:38:59 +09:00
Yu Watanabe
a1d2ae065b sd-netlink: introduce sd_netlink_message_read_data_suffix0() 2021-09-29 15:38:59 +09:00
Yu Watanabe
84f7bd7698 sd-netlink: make sd_genl_message_new() or friends return -EOPNOTSUPP if a module is not supported by the kernel 2021-09-29 15:38:55 +09:00
Yu Watanabe
4d4d898a4b sd-netlink: also check multicast group to find suitable match callback 2021-09-29 15:36:42 +09:00
Yu Watanabe
ec44d3f407 sd-netlink: allow to set dump flag for genl or netfilter messages 2021-09-29 15:35:08 +09:00
Yu Watanabe
dbc35fe3aa sd-netlink: add type safe macro for sd_genl_add_match() 2021-09-29 15:33:50 +09:00
Yu Watanabe
52888279df sd-netlink: minor coding style fixes 2021-09-29 15:33:50 +09:00
Yu Watanabe
61dcd98232 basic/linux: update nl80211.h 2021-09-29 15:33:50 +09:00
Yu Watanabe
e210f027e0 sd-dhcp6-client: rename dhcp6_lease_set_dns() -> dhcp6_lease_add_dns()
As it is allowed that multiple DNS server options appear in the message.
2021-09-29 15:29:41 +09:00
Yu Watanabe
e693e96961 sd-dhcp6-client: do not merge NTP and SNTP options
Previously, SNTP option is ignored when it appears after NTP option(s),
but merged later NTP options when it appears first.
This makes split the NTP and SNTP addresses, and use SNTP addresses only
when no NTP option is provided.
2021-09-29 15:29:41 +09:00
Yu Watanabe
9c3d46bf8d sd-dhcp6-client: support multiple NTP server options
Also, it is allowed that the suboption appears multiple times, and each
suboption contains one NTP server.
2021-09-29 15:29:41 +09:00
Yu Watanabe
41b14f0329 sd-dhcp6-client: support multiple domains 2021-09-29 15:29:41 +09:00
Yu Watanabe
5cf67bb407 sd-dhcp6-client: make dhcp6_lease_free() accepts NULL 2021-09-29 15:29:40 +09:00
Yu Watanabe
edeee50b3d sd-dhcp6-client: drop domains_count and ntp_fqdn_count 2021-09-29 15:29:40 +09:00