1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-10 00:58:20 +03:00

46344 Commits

Author SHA1 Message Date
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
Lennart Poettering
7a023f34b2 resolved: handle RRs where we don't have a signer
If we encounter an RR that has no matching signature, then we don't know
whether it was expanded from a wildcard or not. We need to accept that
and not make the NSEC test fail, just skip over the RR.

(cherry picked from commit 2f4c2db20ae02d750a6995e0afbff7231cd3a6b7)
2020-12-08 18:08:31 +01:00
Lennart Poettering
eae55a16ff resolved: put size limit in DnsAnswer size to UINT16_MAX
The three answer sections can only carry up to UINT16_MAX entries, hence
put a hard upper limit on how far DnsAnswer can grow. The three count
fields in the DNS packet header are 16 bit only, hence the limit.

If code actually tries to add more than 64K RRs it will get ENOSPC with
this new checking.

And similar to DnsQuestion.

(cherry picked from commit 398c611833584632c6977e2f89746403108637c7)
2020-12-08 18:08:31 +01:00
Lennart Poettering
6f46699648 resolved: fix dumping of DnsAnswer objects
(cherry picked from commit 014e8cc131109e2a1995fcfe0550a77e6a9b42b2)
2020-12-08 18:08:31 +01:00
Lennart Poettering
b02f896e65 resolved: check return value of memdup() correctly for OOM
(cherry picked from commit a63a1252b501f6c8b5a011825372977710e88e72)
2020-12-08 18:08:31 +01:00
Lennart Poettering
e8c7f0e4c4 man: remove misplaced comma
(cherry picked from commit 8b2e362651ca7f921ae9cd46a851f31eb2a7c903)
2020-12-08 18:08:31 +01:00
Jonathan Lebon
31c2cc7583 units: unconditionally pull in remote-cryptsetup.target in the initramfs
[zjs: Replaces #17149.

I took half of the patch in
https://github.com/systemd/systemd/pull/17149#issuecomment-698399194,
hence I'm keeping Jonathan's authorship.

The original reasoning for 6c5496c492a8d74e54d22bf8824160cab1e63c10 was that we
enable remote-cryptsetup.target via presets, and since presets are not used for
the initrd, we need a different target. But since parts of the unit and target
tree are shared between the initramfs and the main system, we can't just create
a separate target for the initramfs. All the targets that depend on this one
would need to be split also. That condition is true for initrd-fs.target, but
not for sysinit.target.

So let's instead just uncoditionally pull in remote-cryptsetup.target in the
initramfs. It should normally be empty, so there should be no impact on boots
that don't have units in the target.

Jonathan's patch used initrd-root-fs.target, this version instead uses
initrd-root-device.target. initrd-root-device.target is ordered before
sysroot.mount, which means that the decrypted devices will be available earlier
too.]

(cherry picked from commit e921ebb57e0bc823ac167801cb5dd5f119f5d585)
2020-12-08 18:08:30 +01:00
Zbigniew Jędrzejewski-Szmek
141f3e4dd0 meson: simplify with_runlevels ternany op usage
(cherry picked from commit d5816b6138be788f3d3ea72359bb28dc239c3235)
2020-12-08 18:08:30 +01:00
Zbigniew Jędrzejewski-Szmek
59b8000e12 man: update fedora version
F33 was released today!

(cherry picked from commit d468c81e268adb2975faff2d8c8587b5640c15ae)
2020-12-08 18:08:30 +01:00
Zbigniew Jędrzejewski-Szmek
afa88d5789 man/machinectl: fix pull-raw example
We do not allow machine names with "_", so the command would fail as written.
Share the example with the systemd-nspawn page instead.

(cherry picked from commit 5fadff3352cfeb82844b6d475056bb18f2eba0dc)
2020-12-08 18:08:30 +01:00
Josh Brobst
23b682c4c4 man: correct xdg-autostart-generator path
(cherry picked from commit c690bd0bc6b2e07873cb289948ebd4dfa3a7e868)
2020-12-08 18:08:30 +01:00
Pat Coulthard
a10e01627a tmpfiles: Handle filesystems without ACL support in more cases.
(cherry picked from commit 3045c416e1cbbd8ab40577790522217fd1b9cb3b)
2020-12-08 18:08:30 +01:00
Elias Probst
96cfd30380 NEWS: fix typo (systemd-userdb > systemd-userdbd)
(cherry picked from commit a0223c308e869b51e4142c82f365ceb17b086adb)
2020-12-08 18:08:30 +01:00
Yu Watanabe
2b5615add9 Revert "sd-dhcp-client: use asynchronous_close()"
This effectively reverts the commit 22fc2420b2a7220addcee33c2fa17ada44d87f9c.

The function `asynchronous_close()` confuses valgrind. Before this commit,
valgrind may report the following:

```
HEAP SUMMARY:
    in use at exit: 384 bytes in 1 blocks
  total heap usage: 4,787 allocs, 4,786 frees, 1,379,191 bytes allocated

384 bytes in 1 blocks are possibly lost in loss record 1 of 1
   at 0x483CAE9: calloc (vg_replace_malloc.c:760)
   by 0x401456A: _dl_allocate_tls (in /usr/lib64/ld-2.31.so)
   by 0x4BD212E: pthread_create@@GLIBC_2.2.5 (in /usr/lib64/libpthread-2.31.so)
   by 0x499B662: asynchronous_job (async.c:47)
   by 0x499B7DC: asynchronous_close (async.c:102)
   by 0x4CFA8B: client_initialize (sd-dhcp-client.c:696)
   by 0x4CFC5E: client_stop (sd-dhcp-client.c:725)
   by 0x4D4589: sd_dhcp_client_stop (sd-dhcp-client.c:2134)
   by 0x493C2F: link_stop_clients (networkd-link.c:620)
   by 0x4126DB: manager_free (networkd-manager.c:867)
   by 0x40D193: manager_freep (networkd-manager.h:97)
   by 0x40DAFC: run (networkd.c:20)

LEAK SUMMARY:
   definitely lost: 0 bytes in 0 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 384 bytes in 1 blocks
   still reachable: 0 bytes in 0 blocks
        suppressed: 0 bytes in 0 blocks

For lists of detected and suppressed errors, rerun with: -s
ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```

(cherry picked from commit 5a8775bb39526696d01d0e2ffd64e9509644fff1)
2020-12-08 18:08:30 +01:00
Zbigniew Jędrzejewski-Szmek
9833a8b6bb man: document what variables are allowed
(cherry picked from commit 0dc9fd56a53ef833fdc5b9b81bc958e7c3dd41a4)
2020-12-08 18:08:30 +01:00
Zbigniew Jędrzejewski-Szmek
17ce34de33 resolvectl: wrap the extended status string too
(cherry picked from commit 7d1e1afe28d554b2bbf95966990f8e07c361647d)
2020-12-08 18:08:30 +01:00