1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-02 09:47:03 +03:00

46359 Commits

Author SHA1 Message Date
Lennart Poettering
6790521b59 dns-domain: try IDN2003 rules if IDN2008 doesn't work
This follows more closely what web browsers do, and makes sure emojis in
domains work.

Fixes: #14483
(cherry picked from commit d80e72ec602c2af2983842ad87e4443fce89d423)
2020-12-08 18:08:31 +01:00
Christopher Obbard
18453317ce virt: Properly detect nested UML inside another hypervisor
UML runs as a user-process so it can quite easily be ran inside of
another hypervisor, for instance inside a KVM instance. UML passes
through the CPUID from the host machine so in this case detect_vm
incorrectly identifies as running under KVM. So check we are running
a UML kernel first, before we check any other hypervisors.

Resolves: #17754

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
(cherry picked from commit c8037dbf05da586b6a210ac04f145d99f424971f)
2020-12-08 18:08:31 +01:00
Lennart Poettering
2e304fb3db resolved: properly check per-link NTA list
We need to check for parent domains too. We did this correctly for the
system-wide NTA list, but not for the per-link one. Let's fix that.

(cherry picked from commit 7e8a93b77c3c4d4df1e8c3177dc9553c94fac759)
2020-12-08 18:08:31 +01:00
Yu Watanabe
dcff070d70 meson: use '_' as separator in fuzz test names
Follow-up for d448888924c1d4815cb97bcd5d94419812c053b9 and ca121e20c42219e3bc4e5cb63dcc96cc5eae2879.

Fixes #17568.

(cherry picked from commit 0f82a2ab5c8d812791aca9686bdcc45f39c62431)
2020-12-08 18:08:31 +01:00
igo95862
faa88d9c39 man: Speicfy exact return values of sd_bus_message_enter_container
(cherry picked from commit 1edc1f1b626446a20db405d041cd70ed3d52c632)
2020-12-08 18:08:31 +01:00
Yu Watanabe
00cb8d665c network: fix return values
(cherry picked from commit 72f092815ada28431103d2145ffa61e1ae14aded)
2020-12-08 18:08:31 +01:00
Zbigniew Jędrzejewski-Szmek
6cea4fcc98 shared/seccomp-util: address family filtering is broken on ppc
This reverts the gist of da1921a5c396547261c8c7fcd94173346eb3b718 and
0d9fca76bb69e162265b2d25cb79f1890c0da31b (for ppc).

Quoting #17559:
> libseccomp 2.5 added socket syscall multiplexing on ppc64(el):
> https://github.com/seccomp/libseccomp/pull/229
>
> Like with i386, s390 and s390x this breaks socket argument filtering, so
> RestrictAddressFamilies doesn't work.
>
> This causes the unit test to fail:
> /* test_restrict_address_families */
> Operating on architecture: ppc
> Failed to install socket family rules for architecture ppc, skipping: Operation canceled
> Operating on architecture: ppc64
> Failed to add socket() rule for architecture ppc64, skipping: Invalid argument
> Operating on architecture: ppc64-le
> Failed to add socket() rule for architecture ppc64-le, skipping: Invalid argument
> Assertion 'fd < 0' failed at src/test/test-seccomp.c:424, function test_restrict_address_families(). Aborting.
>
> The socket filters can't be added so `socket(AF_UNIX, SOCK_DGRAM, 0);` still
> works, triggering the assertion.

Fixes #17559.

(cherry picked from commit d5923e38bc0e6cf9d7620ed5f1f8606fe7fe1168)
2020-12-08 18:08:31 +01:00
Dan Streetman
b5d7ba5fd4 test: use cap_last_cap() for max supported cap number, not capability_list_length()
This test assumes capability_list_length() is an invalid cap number,
but that isn't true if the running kernel supports more caps than we were
compiled with, which results in the test failing.

Instead use cap_last_cap() + 1.

If cap_last_cap() is 63, there are no more 'invalid' cap numbers to test with,
so the invalid cap number test part is skipped.

(cherry picked from commit ebc815cd1c647faa934a446ceea91ff4bc9dffa4)
2020-12-08 18:08:31 +01:00
Yu Watanabe
89fae89234 man: slightly update the man page of sd_bus_message_read_basic()
Follow-up for 73a1d7d2433edd1872ec53db3e804009298ebb1d.

(cherry picked from commit 7a1fe27f81dace11a25a0573dc170d86d1f92023)
2020-12-08 18:08:31 +01:00
igo95862
391de4434b man: Fixed an incomplete sentence
(cherry picked from commit 78c4f2f153b93fdb39654edb93a73b202a67dcfd)
2020-12-08 18:08:31 +01:00
igo95862
03429f6dab man: Specify that sd_bus_message_read_basic returns 0 if end of array had been reached.
(cherry picked from commit 73a1d7d2433edd1872ec53db3e804009298ebb1d)
2020-12-08 18:08:31 +01:00
Yu Watanabe
28ce943169 core/mount: mount command may fail after adding the corresponding proc mountinfo entry
Hopefully fixes #17617.

(cherry picked from commit 2fa0bd7d57863dffda89190a70a83c51bd7d114a)
2020-12-08 18:08:31 +01:00
Lennart Poettering
c3064038b4 mkosi: make sure our mkosi files work with f33
(cherry picked from commit e2c5e698c094165919af8d5f91896425c918c850)
2020-12-08 18:08:31 +01:00
Pavel Sapezhko
298477a1c9 man: clarify DefaultTasksMax doc
(cherry picked from commit 77f5277a7abf7d6b0a4bbf4ecf872da0b92335b5)
2020-12-08 18:08:31 +01:00
Yu Watanabe
4345b638a8 seccomp: also move munmap into @default syscall filter set
Follow-up for 5abede3247591248718026cb8be6cd231de7728b.

(cherry picked from commit 11b9105dfdbcea5dc9f4a5dd676ca494ab8b909e)
2020-12-08 18:08:31 +01:00
INSUN PYO
00d4c41428 sd-device-enumerator: do not return error when a device is removed
If /sys/class/OOO node is created and destroyed during booting (kernle driver initialization fails),
systemd-udev-trigger.service fails due to race condition.

***** race condition ***********************************************************************************
 1. kernel driver create /sys/class/OOO
 2. systemd-udev-trigger.service execues "/usr/bin/udevadm trigger --type=devices --action=add"

 3. device_enumerator_scan_devices() => enumerator_scan_devices_all() => enumerator_scan_dir("class") =>
    opendir("/sys/class") and iterate all subdirs ==> enumerator_scan_dir_and_add_devices("/sys/class/OOO")

 4. kernel driver fails and destroy /sys/class/OOO
 5. enumerator_scan_dir_and_add_devices("/sys/class/OOO") fails in opendir("/sys/class/OOO")

 6. "systemd-udev-trigger.service" fails
 7. udev coldplug fails and some device units not ready
 8. mount units asociated with device units fail
 9. local-fs.target fails
 10. enters emergency mode
********************************************************************************************************

***** status of systemd-udev-trigger.service unit ******************************************************
$ systemctl status systemd-udev-trigger.service
 systemd-udev-trigger.service - udev Coldplug all Devices
   Loaded: loaded (/usr/lib/systemd/system/systemd-udev-trigger.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-01-02 13:16:54 KST; 22min ago
     Docs: man:udev(7)
           man:systemd-udevd.service(8)
  Process: 2162 ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add (code=exited, status=0/SUCCESS)
  Process: 2554 ExecStart=/usr/bin/udevadm trigger --type=devices --action=add (code=exited, status=1/FAILURE)
  Main PID: 2554 (code=exited, status=1/FAILURE)

  Jan 02 13:16:54 localhost udevadm[2554]: Failed to scan devices: No such file or directory
  Jan 02 13:16:54 localhost systemd[1]: systemd-udev-trigger.service: Main process exited, code=exited, status=1/FAILURE
  Jan 02 13:16:54 localhost systemd[1]: systemd-udev-trigger.service: Failed with result 'exit-code'.
  Jan 02 13:16:54 localhost systemd[1]: Failed to start udev Coldplug all Devices.
*******************************************************************************************************

***** journal log with Environment=SYSTEMD_LOG_LEVEL=debug in systemd-udev-trigger.service  ***********
  Jan 01 21:57:20 localhost udevadm[2039]: sd-device-enumerator: Scanning /sys/bus
  Jan 01 21:57:20 localhost udevadm[2522]: sd-device-enumerator: Scan all dirs
  Jan 01 21:57:20 localhost udevadm[2522]: sd-device-enumerator: Scanning /sys/bus
  Jan 01 21:57:21 localhost udevadm[2522]: sd-device-enumerator: Scanning /sys/class
  Jan 01 21:57:21 localhost udevadm[2522]: sd-device-enumerator: Failed to scan /sys/class: No such file or directory
  Jan 01 21:57:21 localhost udevadm[2522]: Failed to scan devices: No such file or directory
*******************************************************************************************************

(cherry picked from commit cfb6197bc31eb6b2631dec7bf8d7a253e7891016)
2020-12-08 18:08:31 +01:00
Etienne Doms
02b25eaa92 curl-util: fix callback prototype
CURLMOPT_SOCKETFUNCTION callback is an easy handle, not a multi.

(cherry picked from commit 5b639090d0b4a49d77ba58bebe180b2a6f8da322)
2020-12-08 18:08:31 +01:00
Yu Watanabe
4d856f9472 curl-util: fix type CURL -> CURLM
(cherry picked from commit 2d052a0a48cc184ea3748c2e364c661985aa21d5)
2020-12-08 18:08:31 +01:00
Franck Bui
a05ed501bc units: restore sysfs conditions in sys-fs-fuse-connections.mount and sys-kernel-config.mount
Commit 42cc2855ba2fe4c6f5d incorrectly removed the condition on sysfs in both
sys-fs-fuse-connections.mount and sys-kernel-config.mount. However there are
still needed in case modprobe of one of these modules is intentionally skipped
(due to lack of privs for example).

This patch restores the 2 conditions which should be safe for the common case,
since all conditions are only checked after all deps ordered before are
complete.

Follow-up for 42cc2855ba2fe4c6f5dc863507a1c843611350a0.

(cherry picked from commit 07ccf434e77b17b20d773ce8b2637083cd4fdafc)
2020-12-08 18:08:31 +01:00
Yu Watanabe
904723f6d4 core/mount: mount_start() may be called during the state is MOUNT_MOUNTING_DONE
As, both MOUNT_MOUNTING and MOUNT_MOUNTING_DONE are mapped to
UNIT_ACTIVATING.

Fixes #17570.

(cherry picked from commit db39a62784e8f857a67cb4a83ade28a906f79679)
2020-12-08 18:08:31 +01:00
Lennart Poettering
811f7fb156 seccomp: move brk+mmap+mmap2 into @default syscall filter set
These three syscalls are internally used by libc's memory allocation
logic, i.e. ultimately back malloc(). Allocating a bit of memory is so
basic, it should just be in the default set.

This fixes a couple of issues with asan/msan and the seccomp tests: when
asan/msan is used some additional, large memory allocations take place
in the background, and unless mmap/mmap2/brk are allowlisted these will
fail, aborting the test prematurely.

(cherry picked from commit 5abede3247591248718026cb8be6cd231de7728b)
2020-12-08 18:08:31 +01:00
Franck Bui
e30dee2666 units: wait until some fs modules are entirely loaded before mounting their corresponding filesystem
udev requests to start the fs mount units when their respective module is
loaded. For that it monitors uevents of type "ADD" for the relevant fs modules.

However the uevent is sent by the kernel too early, ie before the init() of the
module is called hence before directories in /sys/fs/ are created.

This patch workarounds adds "Requires/After=modprobe@<fs-module>.service" to
the mount unit, which means that modprobe(8) will be called once the fs module
is announced to be loaded. This sounds pointless, but given that modprobe only
returns after the initialization of the module is complete, it should
workaround the issue.

As a side effect, the module will be automatically loaded if the mount unit is
started manually.

Fixes #17586.

(cherry picked from commit 42cc2855ba2fe4c6f5dc863507a1c843611350a0)
2020-12-08 18:08:31 +01:00
Franck Bui
24a04f9125 Revert "units: skip modprobe@.service if the unit appears to be already loaded"
This reverts commit 9cbf1e58f9629af5c6b56777ee73dc6320306d6d.

The presence of /sys/module/%I directory can't be used to assert that the load
of a given module is complete and therefore the call to modprobe(8) can be
skipped. Indeed this directory is created before the init() function of the
module is called.

Users of modprobe@.service needs to be sure that once this service returns the
module is fully operational.

(cherry picked from commit b3e32582f67c68896b6b05893b138a975fa26454)
2020-12-08 18:08:31 +01:00
Yu Watanabe
ac01fe2a3b khash: fix structured initializer
Fixes #17646.

(cherry picked from commit f56a9cbf9c20cd798258d3db302d51bf21458b38)
2020-12-08 18:08:31 +01:00
igo95862
85043d8caf man: Fix sd_bus_message_append_array_space function signature
(cherry picked from commit 0e577869f3fc287223d31cfed52921c4d3579ff2)
2020-12-08 18:08:31 +01:00
Yu Watanabe
d419f1b5ed sd-device: drop unwanted newline in netlink message
(cherry picked from commit b9cbb08e0a35070d57721cd5bf810659a0b80f5e)
2020-12-08 18:08:31 +01:00
Zbigniew Jędrzejewski-Szmek
5d89a32666 man: drop misplaced phrase
I think it was added in 6c2b9c8da1eb1bac7e8f170b913f63dbd13a16d7 as c&p.

(cherry picked from commit de70ff66dc628062d4f04270988b92ba0aef2420)
2020-12-08 18:08:31 +01:00
igo95862
2f5c994dde man: Add a paragraph to sd_bus_call explaning callback message lifetime
(cherry picked from commit e6ce785d611702532ae71547e78fbb49eff3aded)
2020-12-08 18:08:31 +01:00
Yu Watanabe
8992d8576b man: fix prototpe of sd_bus_message_peek_type()
Fixes #17609.

(cherry picked from commit 483abcc65bd5efe43b0cea453580bac45cd0f177)
2020-12-08 18:08:31 +01:00
Yu Watanabe
e90844ca8a man: add missing <para> tag, and drop redundant ">"
Fixes #17609.

(cherry picked from commit e55c073161d469fb01ecd5bea3ff8845194e25d9)
2020-12-08 18:08:31 +01:00
igo95862
e1ff0c8a5e man: Separated paragraph about making sd_bus object reply async
(cherry picked from commit 2e4238a6d14223728dbfbb24830e644d31b04111)
2020-12-08 18:08:31 +01:00
Yu Watanabe
0f428f71c5 meson: use "_" as separator in test names
Follow-up for ca121e20c42219e3bc4e5cb63dcc96cc5eae2879.

Fixes #17568.

(cherry picked from commit d448888924c1d4815cb97bcd5d94419812c053b9)
2020-12-08 18:08:31 +01:00
Yu Watanabe
3a7ff1964f missing: define several syscall numbers for MIPS arch
Fixes #17591.

(cherry picked from commit 77419ba463999a25922146ac424348adc2fe23af)
2020-12-08 18:08:31 +01:00
Christof Efkemann
00ee73348a networkd: fix default value of DHCPv6Client
The configuration of networkd has a DHCPv6Client setting in its
[IPv6AcceptRA] section, which, according to the man page, can be
a boolean, or the special value "always". The man page states
that "true" is the default.

The default value is implemented in src/network/networkd-network.c
by setting field ipv6_accept_ra_start_dhcp6_client of network to
true. However, this field is not a boolean, but an enum type
IPv6AcceptRAStartDHCP6Client (src/network/networkd-ndisc.h).

Setting ipv6_accept_ra_start_dhcp6_client to true effectively
corresponds to the enum value IPV6_ACCEPT_RA_START_DHCP6_CLIENT_ALWAYS,
resulting in the DHCPv6Client setting having the default value
"always".

This patch changes the initialisation to the correct enum value
IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES.

(cherry picked from commit cabe57119f07a9f86ab281f6260bbb006b89a854)
2020-12-08 18:08:31 +01:00
Etienne Doms
c5805e39c5 ratelimit: fix integer overflow
If StartLimitIntervalSec is huge, or more specifically, set to "infinity", we need to take care about overflows.

(cherry picked from commit e2357b1c8a87b610066b8b2a59517bcfb20b832e)
2020-12-08 18:08:31 +01:00
Yu Watanabe
821937ffc8 man: fix tag
(cherry picked from commit af7ce3faf88f6bcd5c82a71412fa81e8ae34acbb)
2020-12-08 18:08:31 +01:00
Yu Watanabe
cc1b93aef9 man: mention that sd_bus_call() may return a negative errno mapped from D-Bus error reply
Closes #17556.

(cherry picked from commit c660668ed9daf15358c522c09ba3932393bd5451)
2020-12-08 18:08:31 +01:00
Yu Watanabe
0e233e5987 man: add missing period
(cherry picked from commit 23243adf69ffed2630c778e021c3cf2e97a6b999)
2020-12-08 18:08:31 +01:00
Zbigniew Jędrzejewski-Szmek
6f6a38a1ea meson: use "_" as separator in test names
":" is prettier, but meson 0.56+ doesn't like it:
src/systemd/meson.build:73: DEPRECATION: ":" is not allowed in test name "cc-sd-bus.h:c", it has been replaced with "_"
src/systemd/meson.build:73: DEPRECATION: ":" is not allowed in test name "cc-sd-bus.h:c-ansi", it has been replaced with "_"
...

Fixes #17568.

(cherry picked from commit ca121e20c42219e3bc4e5cb63dcc96cc5eae2879)
2020-12-08 18:08:31 +01:00
Yu Watanabe
45ed35fdc0 ethtool: make ethtool_get_driver() return -ENODATA if ioctl succeeds but driver name is empty
Inspired by #17532.

(cherry picked from commit 861de64e6858bc92b154ad70d1cee41ae5b75835)
2020-12-08 18:08:31 +01:00
Yu Watanabe
6b9e8618e5 journal: refuse skip parameter for sd_journal_next_skip() larger than INT_MAX
Fixes #17502.

(cherry picked from commit 41d544a1c124a63f94b571e5ed924c4fb03193bb)
2020-12-08 18:08:31 +01:00
Yu Watanabe
bcd4d3ec35 core: add missing oom check
Fixes #17552.

(cherry picked from commit 72585a584d26eec4bb9ea6c30fc101f1e4f0d7f9)
2020-12-08 18:08:31 +01:00
Zbigniew Jędrzejewski-Szmek
6b33098224 udev: log when we fail to query ID_NET_DRIVER
Inspired by #17532.

(cherry picked from commit d61db498bf86fe64c66e30d15aafc020cc87d068)
2020-12-08 18:08:31 +01:00
Yu Watanabe
9f316bb61c network: make default router lifetime to 30min
Closes #17527.

(cherry picked from commit 71a5db49fd07864078348359200921d6d441f85a)
2020-12-08 18:08:31 +01:00
Yu Watanabe
f1679a86aa sd-bus: fix possible division by 0
Fixes #17541.

(cherry picked from commit 291bb0b01cae22c3c14882fd5a0ad557c92d9298)
2020-12-08 18:08:31 +01:00
Yu Watanabe
74d6c9ef37 home: fix copy-and-paste mistake
Fixes #17542.

(cherry picked from commit 755b35b1aa6eda16a2cf02be3e4aa44d08fc17a3)
2020-12-08 18:08:31 +01:00
Lennart Poettering
21dfb60184 resolved: slightly extend debug log output about outgoing messages
(cherry picked from commit 76f772298e3473f00eff7cb6dc294926a7d8cc4f)
2020-12-08 18:08:31 +01:00
Lennart Poettering
5ef4c55cdb resolved: don't resolve "local." via LLMNR
It's the mDNS top-level domain, hence don't consider it for LLMNR, ever.

Fixes: #16233
(cherry picked from commit 088648d081e9bc27f53c6471b91109569b29322f)
2020-12-08 18:08:31 +01:00
Lennart Poettering
0a57364e67 resolved: show all answer flags when dumping answer
(cherry picked from commit 5cdcac6cf6879826407433f2cfcf2b763f89d74a)
2020-12-08 18:08:31 +01:00
Lennart Poettering
30a35fa388 resolved: suppress misleading debug message about ignored resolv.conf line
(cherry picked from commit 02c205359b7dfcb4501cab564218f21d0a0523f8)
2020-12-08 18:08:31 +01:00