Lennart Poettering [Tue, 10 Nov 2020 13:48:13 +0000 (14:48 +0100)]
resolved: gracefully handle with packets with too large RR count
Apparently, there are plenty routers in place that report an incorrect
RR count in the packets: they declare more RRs than are actually
included.
Let's accept these responses, but let's downgrade them to baseline, i.e.
let's suppress OPT in this case: if they don't even get the RR count
right, let's operate on the absolute baseline, and not bother with
anything fancier such as EDNS.
Prompted-by: https://github.com/systemd/systemd/issues/12841#issuecomment-724063973
Fixes: #3980
Most likely fixes: #12841
(cherry picked from commit
18674159ebbf622a9e6e5a45cc36b38f74dae315)
(cherry picked from commit
fdfffdaf20a18a50c9a6d858359cf4af6d2f4c8b)
Zbigniew Jędrzejewski-Szmek [Fri, 29 Jan 2021 15:21:08 +0000 (16:21 +0100)]
resolved: use reference counting for DnsQueryCandidate objects
Follow-up for
4ea8b443de. The logic that manages DnsQueryCandidate is rather
complicated: a calls to dns_query_complete() that wants to destroy a
DnsQueryCandidate can be nested inside a deep chain of calls. Using reference
counts seems like the simplest approach.
DnsSearchDomain already uses reference counting.
This patch effectively brings dns_query_candidate_go() to the state before
4ea8b443de, but wraps the iteration over DnsQueryCandidate.transactions in
dns_query_candidate_ref+dns_query_candidate_unref.
(cherry picked from commit
0e0fd08fc832b8f42e567d722d388eba086da5ff)
(cherry picked from commit
ab9f7e1a51005f12d3bac83b86716d9d33048eb7)
Zbigniew Jędrzejewski-Szmek [Fri, 29 Jan 2021 15:18:12 +0000 (16:18 +0100)]
resolved: minor cleanups
(cherry picked from commit
c805014a350da7c32eb2bdb408a9fa643c191dee)
(cherry picked from commit
91ba2eac4b6b463026b3a93e5a139923e8f2cfe4)
Zbigniew Jędrzejewski-Szmek [Sun, 17 Jan 2021 18:51:28 +0000 (19:51 +0100)]
resolved: fix use-after-free with queries hitting the cache
When dns_transaction_complete() manages to resolve a query, it invalidates the
query candidate object. It shall not be accessed afterwards.
We have the following chain of calls:
dns_query_candidate_go → dns_transaction_go → dns_transaction_prepare → dns_cache_lookup (success: 1)
→ dns_transaction_complete
After returning back to dns_query_candidate_go(), we'd attempt to continue
iteration over the list of transactions attached to the query candidate,
accessing already freed (and overwritten) memory:
(gdb) bt
0 0x00007f637297cf47 in hashmap_iterate_entry (i=0x7ffe7e15cc90, h=0x706f746b73656465) at ../src/basic/hashmap.c:703
1 _hashmap_iterate (h=0x706f746b73656465, i=i@entry=0x7ffe7e15cc90, value=value@entry=0x7ffe7e15cc88,
key=key@entry=0x0) at ../src/basic/hashmap.c:712
2 0x00007f637297d01b in set_iterate (s=<optimized out>, i=i@entry=0x7ffe7e15cc90, value=value@entry=0x7ffe7e15cc88)
at ../src/basic/hashmap.c:733
hence we crash
3 0x0000557bc99eb80f in dns_query_candidate_go (c=c@entry=0x557bcaf86890) at ../src/resolve/resolved-dns-query.c:139
...but c is not valid here in the second iteration of the loop
4 0x0000557bc99eb720 in dns_query_candidate_notify (c=0x557bcaf86890) at ../src/resolve/resolved-dns-query.c:271
c was valid here at entry...
5 0x0000557bc99efe28 in dns_transaction_complete (t=0x557bcac072f0, state=<optimized out>)
at ../src/resolve/resolved-dns-transaction.c:350
t is a valid transaction (11481 in the backtrace below)
6 0x0000557bc99f1efb in dns_transaction_process_reply (t=0x557bcac072f0, p=<optimized out>)
at ../src/resolve/resolved-dns-transaction.c:1171
7 0x0000557bc99f2d41 in on_dns_packet (s=<optimized out>, fd=<optimized out>, revents=<optimized out>,
userdata=0x557bcac072f0) at ../src/resolve/resolved-dns-transaction.c:1223
8 0x00007f6372a25217 in source_dispatch (s=s@entry=0x557bcb162c50) at ../src/libsystemd/sd-event/sd-event.c:3181
9 0x00007f6372a254fd in sd_event_dispatch (e=0x557bcb15b050) at ../src/libsystemd/sd-event/sd-event.c:3620
10 0x00007f6372a267c8 in sd_event_run (e=e@entry=0x557bcb15b050, timeout=timeout@entry=
18446744073709551615)
at ../src/libsystemd/sd-event/sd-event.c:3678
11 0x00007f6372a269ef in sd_event_loop (e=0x557bcb15b050) at ../src/libsystemd/sd-event/sd-event.c:3700
12 0x0000557bc99ddc14 in run (argc=<optimized out>, argv=<optimized out>) at ../src/resolve/resolved.c:92
13 0x0000557bc99d260a in main (argc=<optimized out>, argv=<optimized out>) at ../src/resolve/resolved.c:99
xxx.name.net systemd-resolved[31705]: Got message type=method_call sender=:1.3644 destination=org.freedesktop.resolve1 path=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=ResolveHostname cookie=2 reply_cookie=0 signature=isit error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: idn2_lookup_u8: xxx → xxx
xxx.name.net systemd-resolved[31705]: Looking up RR for xxx IN A.
xxx.name.net systemd-resolved[31705]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=AddMatch cookie=1102 reply_cookie=0 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetNameOwner cookie=1103 reply_cookie=0 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.3324 path=n/a interface=n/a member=n/a cookie=
4294967295 reply_cookie=1103 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Cache miss for xxx.name.net IN A
xxx.name.net systemd-resolved[31705]: Transaction 11481 for <xxx.name.net IN A> scope dns on enp42s0/*.
xxx.name.net systemd-resolved[31705]: Using feature level UDP for transaction 11481.
xxx.name.net systemd-resolved[31705]: Using DNS server 192.168.1.1 for transaction 11481.
xxx.name.net systemd-resolved[31705]: Sending query packet with id 11481 of size 35.
xxx.name.net systemd-resolved[31705]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.3324 path=n/a interface=n/a member=n/a cookie=
4294967295 reply_cookie=1102 signature= error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Match type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.3644' successfully installed.
xxx.name.net systemd-resolved[31705]: Processing incoming packet on transaction 11481 (rcode=NXDOMAIN).
xxx.name.net systemd-resolved[31705]: Not caching negative entry without a SOA record: xxx.name.net IN A
xxx.name.net systemd-resolved[31705]: Transaction 11481 for <xxx.name.net IN A> on scope dns on enp42s0/* now complete with <rcode-failure> from network (unsigned).
xxx.name.net systemd-resolved[31705]: Positive cache hit for xxx.lan IN A
xxx.name.net systemd-resolved[31705]: Transaction 64364 for <xxx.lan IN A> on scope dns on enp42s0/* now complete with <success> from cache (unsigned).
xxx.name.net systemd-resolved[31705]: Sent message type=method_return sender=n/a destination=:1.3644 path=n/a interface=n/a member=n/a cookie=1104 reply_cookie=2 signature=a(iiay)st error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RemoveMatch cookie=1105 reply_cookie=0 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Freeing transaction 64364.
xxx.name.net systemd[1]: systemd-resolved.service: Main process exited, code=dumped, status=11/SEGV
xxx.name.net systemd[1]: systemd-resolved.service: Failed with result 'core-dump'.
Fixes #16168, https://bugzilla.redhat.com/show_bug.cgi?id=
1895937.
(cherry picked from commit
4ea8b443de8be0f7a932f325dfafa1ee2a843795)
(cherry picked from commit
64317106aed94a6fb758ab6b08ba490873fc5227)
Lennart Poettering [Thu, 17 Dec 2020 15:19:09 +0000 (16:19 +0100)]
test: fix fd_is_mount_point() check
So the currentl and only fd_is_mount_point() check is actually entirely
bogus: it passes "/" as filename argument, but that's not actually a
a valid filename, but an absolute path.
fd_is_mount_point() is written in a way tha the fd refers to a directory
and the specified path is a file directly below it that shall be
checked. The test call actually violated that rule, but still expected
success.
Let's fix this, and check for this explicitly, and refuse it.
Let's extend the test and move it to test-mountpoint-util.c where the
rest of the tests for related calls are placed.
Replaces: #18004
Fixes: #17950
(cherry picked from commit
95231c7215c3ff14c491eb1d2a93312a8fe0c4f6)
(cherry picked from commit
551dd873b0bdfb9e7e47431b2933c8b910228f0c)
Lennart Poettering [Tue, 19 Jan 2021 20:34:20 +0000 (21:34 +0100)]
tree-wide: ignore messages with too long control data
Apparently SELinux inserts control data into AF_UNIX datagrams where we
don't expect it, thus miscalculating the control data. This looks like
something to fix in SELinux, but we still should handle this gracefully
and just drop the offending datagram and continue.
recvmsg_safe() actually already drops the datagram, it's just a matter
of actually ignoring EXFULL (which it generates if control data is too
large) in the right places.
This does this wherever an AF_UNIX/SOCK_DGRAM socket is used with
recvmsg_safe() that is not just internal communication.
Fixes: #17795
Follow-up for:
3691bcf3c5eebdcca5b4f1c51c745441c57a6cd1
(cherry picked from commit
741bfd7f4e60fdc07ecaadbd93f1196dbee657ca)
(cherry picked from commit
b7e0ac754eba3c91b76dc7b92802716144b569b8)
Zbigniew Jędrzejewski-Szmek [Fri, 15 Jan 2021 09:31:00 +0000 (10:31 +0100)]
rpm: expose $systemd_util_dir also as rpm macro
This variable (a.k.a. rootlibexecdir), was exposed through the .pc file, but
not as rpm macro.
The .pc file must be located in the package that provides libraries, which
pulls in a lot of dependencies. In Fedora, the macros are split out to a
separate package so that other packages which need to refer to some systemd
path but don't otherwise require it, can only pull in the (much smaller and
dependency-less) macros package. zram-generator uses the path to specify the
location of systemd-makefs, so by using the rpm macro we'll be able to use
a much smaller buildroot.
(cherry picked from commit
3bc66bfa0136e370a8f7b06c3b69a52f5636ef82)
(cherry picked from commit
490b9ae9dd786e0924cab59d578bb3d69a174079)
Yu Watanabe [Mon, 11 Jan 2021 14:36:42 +0000 (23:36 +0900)]
wifi-util: do not ignore wifi iftype when SSID is not set
Previously, if an interface does not have SSID, e.g. run in mesh-point
type, then the wifi iftype obtained by the netlink call was ignored.
Fixes #18059.
(cherry picked from commit
a66a402da471f6230ab8674fd2c1df6d918773b5)
(cherry picked from commit
fc4eae72f8dd34a334b2707614d9c07974d4d604)
Yu Watanabe [Mon, 11 Jan 2021 14:26:54 +0000 (23:26 +0900)]
wifi-util: cleanup header inclusion
(cherry picked from commit
a5330078158cbd5070e42fd3f91ecb570e210359)
(cherry picked from commit
3885103672047e52c22c8d338baec8598208ca4a)
igo95862 [Mon, 11 Jan 2021 13:04:33 +0000 (16:04 +0300)]
docs: `mesonconf` is not a valid command, `meson configure` is
Meson documentation for `meson configure`
https://mesonbuild.com/Commands.html#configure
(cherry picked from commit
5adfb06d5582adf09421d189b5e2fc6b93fa23e8)
(cherry picked from commit
b81e441b617f77c67d9023fdc803c3ab94345db6)
Luca Boccassi [Sun, 10 Jan 2021 15:36:31 +0000 (15:36 +0000)]
bpf: do not use structured initialization for bpf_attr
It looks like zero'ing the struct is not enough, and with some level
of optimizations there is still non-zero padding left over.
Switch to member-by-member initialization. Also convert all remaining
bpf_attr variables in other files.
(cherry picked from commit
9ca600e2bfacc52a65c89f3485723b2c27394e55)
(cherry picked from commit
95ee2c6b481b7a1f953cb720c35df568b7a6cb70)
Lennart Poettering [Sat, 9 Jan 2021 15:32:55 +0000 (16:32 +0100)]
test-xattr-util: don't insist that /usr supports xattrs
(apparently overlayfs has issues with xattrs, hence don't require that
/usr supports xattrs)
(cherry picked from commit
84319c5c07e7283f31930c799dfd948d251d9b73)
(cherry picked from commit
3dcf950663f906db8a9baa465bd2ac384e832a46)
Luca Boccassi [Fri, 8 Jan 2021 23:47:03 +0000 (23:47 +0000)]
bpf: zero bpf_attr before initialization
When building with Clang and using structured initialization, the
bpf_attr union is not zero-padded, so the kernel misdetects it as
an unsupported extension.
zero it until Clang's behaviour matches GCC. Do not skip the test
on Github Actions anymore.
(cherry picked from commit
28abf5ad3483a417d3d4de561533d282493a7f2a)
(cherry picked from commit
94bb28590b21f37bcd9b831029af05a8a78f49ef)
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jan 2021 11:34:28 +0000 (12:34 +0100)]
shell-completion: fix systemctl set/unset/import-environment
unset-environment is completed with variable names in the environment block.
set-environment the same, but suffixed with "=".
import-environment is completed with variable names in the client environment.
(cherry picked from commit
341992081b6ece1adba270e239f96c9840884885)
(cherry picked from commit
6db2ae66185d8feffe5a19841cff64835afae136)
Lennart Poettering [Wed, 6 Jan 2021 17:05:56 +0000 (18:05 +0100)]
stat-util: don't try to open path on path_is_temporary_fs()
I mean, the old code at least used O_PATH, but still, we shouldn't
allocate/close an fd if we don't have to.
(cherry picked from commit
15308e5083391f6a1b9ce25c5b7323f37544eab8)
(cherry picked from commit
a2f0da2de006c74bca64b3ce5b023e99bcca4498)
Luca Boccassi [Tue, 5 Jan 2021 13:44:26 +0000 (13:44 +0000)]
systemctl: have is-enabled return success for aliases when calling into pid1 too
commit
15d7ab87c4e5917f5788f1f8dce327a1e272bea3 introduced the
change to add an 'alias' state, but it was wired to systemctl
only when running in 'client-side' mode. Return success as
expected and documented also when running in 'server-mode'.
Fixes https://github.com/systemd/systemd/issues/18134
(cherry picked from commit
bf3b428f73eb51f4abb64a80ea5be346b9eeb2fe)
(cherry picked from commit
7c63e5ed58fc5d0cf2653e614fee2765b495085a)
Yu Watanabe [Tue, 29 Dec 2020 16:48:35 +0000 (01:48 +0900)]
resolve: field size in dns resource record may be zero
(cherry picked from commit
b652cccab9ed4091ec347f6e924be131105279e9)
(cherry picked from commit
310fd03e0721eea0e01c090eebb445b5929c85f2)
Yu Watanabe [Tue, 29 Dec 2020 16:44:04 +0000 (01:44 +0900)]
siphash: introduce siphash24_compress_safe()
(cherry picked from commit
0b71a7e01d8d04a3668c349e2320c42c786f2382)
(cherry picked from commit
9401ed294dd491c10fb7e8b4e9097c86d02227ad)
Dmitry Borodaenko [Wed, 23 Dec 2020 01:54:04 +0000 (17:54 -0800)]
man/systemd-nspawn: document hashing machine name for uid base
Explicitly document the behavior introduced in #7437: when picking a new
UID shift base with "-U", a hash of the machine name will be tried
before falling back to fully random UID base candidates.
(cherry picked from commit
68709a636c838e0754b49caa6ff2d4168e3c99c8)
(cherry picked from commit
4032a1358897ecaf4e485399b03c6186fb2c90e9)
Yu Watanabe [Mon, 21 Dec 2020 07:33:20 +0000 (16:33 +0900)]
journal-importer: ignore invalid field at one more place
Fixes oss-fuzz#28817.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28817
(cherry picked from commit
8786d4bbe43b5f6493982bcb5211e010f99deb57)
(cherry picked from commit
cefb123e8ab65772a2a609081ca34ac6ea1267d6)
Luca BRUNO [Mon, 21 Dec 2020 09:55:04 +0000 (09:55 +0000)]
man/localtime: document default timezone
This explicitly documents the default `UTC` timezone which is used
by systemd and (other softwares) when `/etc/localtime` is not present.
Ref: https://github.com/systemd/systemd/blob/v247/src/basic/time-util.c#L1460-L1469
(cherry picked from commit
3d909037e3bb86bb14ceef98325b2759b938a4b3)
(cherry picked from commit
a580023f1da331bd454ea72cad146215b255e0d0)
Florian Klink [Sun, 20 Dec 2020 17:24:05 +0000 (18:24 +0100)]
man/systemd.netdev: clarify the wireguard AllowedIPs= setting
`AllowedIPs=` only affects "routing inside the network interface
itself", as in, which wireguard peer packets with a specific destination
address are sent to, and what source addresses are accepted from which
peer.
To cause packets to be sent via wireguard in first place, a route via
that interface needs to be added - either in the `[Routes]` section on
the `.network` matching the wireguard interface, or outside of networkd.
This is a common cause of misunderstanding, because tools like wg-quick
also add routes to the interface. However, those tools are meant as a
"extremely simple script for easily bringing up a WireGuard interface,
suitable for a few common use cases (from their manpage).
Networkd also should support other usecases - like setting AllowedIPs to
0.0.0.0/0 and ::/0 and having a dynamic routing protocol setting more
specific routes (or the user manually setting them).
Reported-In: https://github.com/systemd/systemd/issues/14176
(cherry picked from commit
c6b90e5c5e54e98b6aed38677f77d8491f2e49c8)
(cherry picked from commit
14475e0e793be33bfad371c6d3545c7448f78730)
Yu Watanabe [Tue, 15 Dec 2020 19:50:39 +0000 (04:50 +0900)]
logs-show: refuse data which contain invalid fields
(cherry picked from commit
805d67c565d57e0915162164f7e5e3026a29a2c5)
(cherry picked from commit
2a76d510d9c50dd8f4bd21194cf3f457760aea52)
Yu Watanabe [Tue, 15 Dec 2020 19:44:31 +0000 (04:44 +0900)]
journal: refuse data which contain invalid fields
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25353.
(cherry picked from commit
f2bd032044ca3cd4b454dd0ba86719effcf34dc0)
(cherry picked from commit
2c53886b4f6d987aca180e725064e59bbdaec714)
Yu Watanabe [Tue, 15 Dec 2020 19:36:14 +0000 (04:36 +0900)]
journal: move journal_field_valid() to journal_file.c
(cherry picked from commit
adce225a104d0b7503aa7322db15d1c6dd8b8093)
(cherry picked from commit
b7f69284f1eb21c51cb659a96685cffc6c472ffd)
Christian Ehrhardt [Tue, 15 Dec 2020 11:05:14 +0000 (12:05 +0100)]
test: use modern qemu numa arguments
Upgrading to qemu 5.2 breaks TEST-36-NUMAPOLICY like:
qemu-system-x86_64: total memory for NUMA nodes (0x0) should
equal RAM size (0x20000000)
Use the new (as in >=2014) form of memdev in test 36:
-object memory-backend-ram,id=mem0,size=512M -numa node,memdev=mem0,nodeid=0
Since some target systems are as old as qemu 1.5.3 (CentOS7) but the new
kind to specify was added in qemu 2.1 this needs to add version parsing and
add the argument only when qemu is >=5.2.
Fixes #17986.
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
(cherry picked from commit
43b49470d1f2808555c07f64cd0a1529b7ddd559)
(cherry picked from commit
b7171ae4bdb5c827c1ab0c97934b75f3169af8bb)
Lennart Poettering [Mon, 14 Dec 2020 15:36:00 +0000 (16:36 +0100)]
bus-util: improve logging when we can't connect to the bus
Previously, we'd already have explicit logging for the case where
$XDG_RUNTIME_DIR is not set. Let's also add some explicit logging for
the EPERM/ACCESS case. Let's also in both cases suggest the
--machine=<user>@.host syntax.
And while we are at it, let's remove side-effects from the macro.
By checking for both the EPERM/EACCES case and the $XDG_RUNTIME_DIR case
we will now catch both the cases where people use "su" to issue a
"systemctl --user" operation, and those where they (more correctly, but
still not good enough) call "su -".
Fixes: #17901
(cherry picked from commit
1ecb46724cae151606bc825f0e39f14d4dfe1a0e)
(cherry picked from commit
36bc4a18fd8117cab0d4ff02eac89579a86cd399)
Lennart Poettering [Mon, 14 Dec 2020 12:16:39 +0000 (13:16 +0100)]
sd-bus: make credential acquisition more graceful
So far when asked for augmented bus credentials and the process was
already gone we'd fail fatally. Let's make this graceful instead, and
never allow augmenting fail due to PID having vanished — unless the
augmenting is the explicit and only purpose of the requested operation.
This should be safe as clients have to explicitly query the acquired
creds anyway and handle if they couldn't be acquired. Moreover we
already handle permission problems gracefully, thus clients must be
ready to deal with missing creds.
This is useful to make selinux authorization work for short-lived client
proceses. PReviously we'd augment creds to have more info to log about
(the selinux decision would not be based on augmented data however,
because that'd be unsafe), and would fail if we couldn't get it. Now,
we'll try to acquire the data, but if we cannot acquire it, we'll still
do the selinux check, except that logging will be more limited.
(cherry picked from commit
f8ecc2c00df7bd810557f3056ec12f6a0730812d)
(cherry picked from commit
a1b1ef65a4371e8aec4b0df1326e4cb5de005e80)
Lennart Poettering [Mon, 14 Dec 2020 12:20:28 +0000 (13:20 +0100)]
sd-bus: 'ret' parameter to sd_bus_query_sender_creds() is not optional, check for it
(cherry picked from commit
1ca37419b13b836d7fb2b9815d5efb6dccc62134)
(cherry picked from commit
a62421591e3edb47fa2a85499e4d721eeff73c42)
Owen W. Taylor [Wed, 13 Jan 2021 13:34:21 +0000 (08:34 -0500)]
Fix nss-resolve to properly fallback in a Flatpak sandbox
For unknown reasons, sd-bus has trouble connecting to the filtered
D-Bus system proxy exported by Flatpak and the connection to the
bus is closed during authentication. Don't mistake this for a remote
error - that was causing a hard "not found" failure rather than a fallback.
See: https://bugzilla.redhat.com/show_bug.cgi?id=
1912131 for background.
Jonathan G. Underwood [Tue, 22 Dec 2020 20:04:52 +0000 (20:04 +0000)]
cryptsetup: add support for workqueue options
This commit adds support for disabling the read and write
workqueues with the new crypttab options no-read-workqueue
and no-write-workqueue. These correspond to the cryptsetup
options --perf-no_read_workqueue and --perf-no_write_workqueue
respectively.
(cherry picked from commit
227acf0009bde2cd7f8bc371615b05e84137847d)
Zbigniew Jędrzejewski-Szmek [Wed, 16 Dec 2020 14:56:44 +0000 (15:56 +0100)]
test-login: skip consistency checks when logind is not active
There are two ways in swich sd_login_* functions acquire data:
some are derived from the cgroup path, but others use the data serialized
by logind.
When the tests are executed under Fedora's mock, without systemd-spawn
but instead in a traditional chroot, test-login gets confused:
the "outside" cgroup path is visible, so sd_pid_get_unit() and
sd_pid_get_session() work, but sd_session_is_active() and other functions
that need logind data fail.
Such a buildroot setup is fairly bad, but it can be encountered in the wild, so
let's just skip the tests in that case.
/* Information printed is from the live system */
sd_pid_get_unit(0, …) → "session-237.scope"
sd_pid_get_user_unit(0, …) → "n/a"
sd_pid_get_slice(0, …) → "user-1000.slice"
sd_pid_get_session(0, …) → "237"
sd_pid_get_owner_uid(0, …) → 1000
sd_pid_get_cgroup(0, …) → "/user.slice/user-1000.slice/session-237.scope"
sd_uid_get_display(1000, …) → "(null)"
sd_uid_get_sessions(1000, …) → [0] ""
sd_uid_get_seats(1000, …) → [0] ""
Assertion 'r >= 0' failed at src/libsystemd/sd-login/test-login.c:104, function test_login(). Aborting.
(cherry picked from commit
ac5644635dba54ce5eb0ff394fc0bc772a984849)
(based on
4275f1c95e730ca9422463be29747ad4b6b1fb91)
Christian Göttsche [Tue, 1 Sep 2020 13:48:53 +0000 (15:48 +0200)]
selinux: create unit invocation links with default SELinux context
(cherry picked from commit
a3f5fd964bc9fcac82315f8c82d4ca575afdd1b7)
Yu Watanabe [Mon, 16 Nov 2020 07:25:43 +0000 (16:25 +0900)]
network: honor M or O flag in RA even if IPv6AcceptRA.DHCPv6Cleint=always
Follow-up for
ac24e418d9bc988ecf114c464701b35934948178.
The original motivation of the commit and RFE #15339 is to start dhcpv6
client in managed mode when neither M nor O flag is set in the RA.
But, previously, if the setting is set to "always", then the DHCPv6
client is always started in managed mode even if O flag is set in the
RA. Such the behavior breaks RFC 7084.
(cherry picked from commit
0e686feaff71465e3220f234871f66a39f0f57ad)
shenyangyang4 [Thu, 10 Dec 2020 11:44:31 +0000 (06:44 -0500)]
journalctl: don't skip the entries that have the same seqnum
These two judgement can't judge that two entries are repeating fully.
So i think seqnum is needed to make full judgement.
(cherry picked from commit
b17f651a17cd6ec0ceac7835f2f8607fbd9ddb95)
(cherry picked from commit
60fc09f5db900d622aa956fdc98283f149b4a8b2)
Lennart Poettering [Fri, 11 Dec 2020 11:04:11 +0000 (12:04 +0100)]
sd-bus: use SOCK_CLOEXEC on one more socket
(cherry picked from commit
68a3d9153883b90c99ea2aec20075146ce58beaa)
(cherry picked from commit
4657ed6f93c2e2edd47e65035edfea21fcaa26dd)
Ondrej Mosnacek [Mon, 14 Dec 2020 15:36:27 +0000 (16:36 +0100)]
resolved: create stub-resolv.conf symlink with correct security label
Use symlink_atomic_label() instead of symlink_atomic() as the symlink
may need a different label than the parent directory.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
(cherry picked from commit
7b87bece5ded3e8f068df8402901198c069ab5cf)
(cherry picked from commit
029331f56a1b6e4fb2823a56a108f741a576d7af)
Andrew Balmos [Fri, 11 Dec 2020 03:15:24 +0000 (22:15 -0500)]
efi: Only use arm flags if supported
Support gcc 8 on arm
(cherry picked from commit
361f41645cdf920d431e2d68dcfa3f98088c2e03)
(cherry picked from commit
cb17e9874fb881d0147d44b29163e35471cf00f6)
Yu Watanabe [Mon, 14 Dec 2020 16:13:32 +0000 (01:13 +0900)]
core: detect_container() may return negative errno
(cherry picked from commit
bcdb3b7d5076cf6ad17cb70df8db22d876880ada)
(cherry picked from commit
aca0b4339b3966836fcdcd9c488c45c183804dcc)
Khem Raj [Sun, 13 Dec 2020 00:15:57 +0000 (16:15 -0800)]
meson: Fix reallocarray check
reallocarray() is defined in stdlib.h, so that would be right header to
check for its presense.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit
5bb20fd3d33f7e866a0845f15c1ab5b595147f1e)
(cherry picked from commit
1d8cfe817861a0b0de2b561f6770e33d1242db63)
Luca Boccassi [Thu, 3 Dec 2020 16:17:43 +0000 (16:17 +0000)]
meson: check that cxx variable is set before using it
In some cases it is not defined. Eg in a yocto build:
src/systemd/meson.build:61:15: ERROR: Unknown variable cxx.
(cherry picked from commit
442bc2afee6c5f731c7b3e76ccab7301703a45a7)
(cherry picked from commit
dad90a476e667b9c570cf236c90b50ccae7e8817)
Takashi Iwai [Wed, 9 Dec 2020 09:56:51 +0000 (10:56 +0100)]
udev: Fix sound.target dependency
The recent bug report indicated a race at device creation and the
sound.target dependencies, and the cause turned out to be the condition
of the sound.target trigger. Currently it's set for "card*", but this
is actually the parent object; i.e. the sound.target is triggered before
the sound devices are created.
For assuring the whole sound device creations beforehand, we need to use
"controlC*" instead of "card*"; as already described in
78-sound-card.rules, this is guaranteed to be the last device, and can
be used as a synchronization point.
BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1179363
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit
5926e592fa5e6290b9f4588939945869adb5c55f)
Lennart Poettering [Wed, 9 Dec 2020 13:04:21 +0000 (14:04 +0100)]
man: document that automount units are privileged
Fixes: #17886
(cherry picked from commit
eef34a1d8fe5ca44bdab189b682642096c53e661)
Yu Watanabe [Tue, 8 Dec 2020 16:49:13 +0000 (01:49 +0900)]
log: open journal when cli program run in a service unit
Previously, cli programs like networkctl always use console for logging.
(cherry picked from commit
13ee93978479b80e980d8551c689a7087bf1817e)
Yu Watanabe [Tue, 8 Dec 2020 16:44:36 +0000 (01:44 +0900)]
log: make show_color variable tristate
Should not change any behavior.
(cherry picked from commit
db987463fe2df3e2999e1968709a32a674d8e78d)
Yu Watanabe [Tue, 8 Dec 2020 16:21:31 +0000 (01:21 +0900)]
log: merge conditions to reduce indentation
(cherry picked from commit
5941112e7e92d4afd8a6a6c21b7bfa91012b09f7)
Lennart Poettering [Mon, 7 Dec 2020 09:51:15 +0000 (10:51 +0100)]
logind: fix closing of button input devices
This is a fix of #17751. Specifically:
1. Sort #include headers again
2. Remove tabs, as per coding style
3. Don't install fds in half-initialized objects
4. Use asynchronous_close() everywhere
That all said:
Quit frankly, I am not convinced we should do all this at all. If
close()ing of these input devices is really that slow, then this should
probably be fixed in the kernel, not worked around in userspace like
this.
(cherry picked from commit
c74d5fe25d53263c143f0a9c2698d8bb483e398c)
nihilix-melix [Fri, 27 Nov 2020 10:21:22 +0000 (11:21 +0100)]
Update logind-button.c
(cherry picked from commit
eee582e7951fa8e328d1fcdfcff940254070ccba)
Lennart Poettering [Wed, 9 Dec 2020 09:07:12 +0000 (10:07 +0100)]
async: add trivial cleanup wrapper for asynchronous_close()
(cherry picked from commit
1d9aa4d572b661fd6500c55ab524141332f76230)
Pavel Hrdina [Wed, 25 Nov 2020 08:05:36 +0000 (09:05 +0100)]
cgroup: Also set blkio.bfq.weight
Commit [1] added a workaround when unified cgroups are used but missed
legacy cgroups where there is the same issue.
[1] <https://github.com/systemd/systemd/commit/
2dbc45aea747f25cc1c3848fded2ec0062f96bcf>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit
35e7a62ca32a30169a94693b831e53c832251984)
Lennart Poettering [Wed, 30 Sep 2020 14:19:12 +0000 (16:19 +0200)]
generator: use kmsg in system-level generators, journal otherwise
Fixes: #17129.
(cherry picked from commit
dee29aeb5909f4f5604012ced250488286b8d468)
https://github.com/systemd/systemd-stable/issues/76
Lennart Poettering [Wed, 30 Sep 2020 14:17:12 +0000 (16:17 +0200)]
log: normalize log target condition check
THis doesn't change the condition's logic at all, but is an attempt to
make things a bit more readable: instead of checking log_target !=
LOG_TARGET_AUTO let's actually list the targets where we want to
consider journal/syslog/kmsg, to make things a bit less confusing. After
all the message here is not to avoid them if LOG_TARGET_AUTO is set, but
to definitely do them in the other cases.
(cherry picked from commit
ef9bddb79984aa1b9d605d44b8c0890e8289bef1)
Lennart Poettering [Wed, 30 Sep 2020 14:06:53 +0000 (16:06 +0200)]
log: update comment
The logic was changed in
bc694c06e60505efeb09e5278a7b22cdfa23975e, let's
update the comment accordingly.
(cherry picked from commit
27ffec083140467a03f463a446c6d19dc5e437ab)
Daan De Meyer [Thu, 3 Dec 2020 23:08:21 +0000 (23:08 +0000)]
Don't assume /run/systemd exists when creating unit-root
When running tests in a mkosi container, /run/systemd might not
exist yet in the container which causes test-execute to fail.
Fixes #17842.
(cherry picked from commit
77f16dbd6d93f2b4a96984254cca25cab03479af)
Lennart Poettering [Tue, 10 Nov 2020 22:30:25 +0000 (23:30 +0100)]
resolved: beef up logic for suppressing "localhost" entry in /etc/hosts
Either suppress the entry entirely, or not at all. But do not suppress
the "localhost" names we recognize, leaving the ones we do not in place.
On Fedora, where "localhost4.localdomain4" is among those listed in
/etc/hosts for 127.0.0.1 we'd thus otherwise drop the "localhost" but
keep the "localhost4.localdomain4" and then on reverse lookups only
return that, which is highly confusing.
(cherry picked from commit
9ca875e80c38d5bd9898cab61a612ad16d527a5a)
Lennart Poettering [Fri, 6 Nov 2020 13:56:16 +0000 (14:56 +0100)]
resolved: use stat_inode_unmodified() to detect /etc/hosts changes
(cherry picked from commit
36d892b7e6753dfc67110b57c55864647a04c5cb)
Lennart Poettering [Wed, 11 Nov 2020 16:38:21 +0000 (17:38 +0100)]
resolved: never allow _gateway lookups to go to the network
Make them rather fail than go to the network.
Previously we'd filter them on LLMNR (explicitly) and MDNS (implicitly,
because it doesn't have .local suffix), but not on DNS.
In order to make _gateway truly reliable, let's not allow it to go to
DNS either, and keep it local.
This is particular relevant, as clients can now request lookups without
local RR synthesis, where we'd rather have NXDOMAIN returned for
_gateway than have it hit the network.
(cherry picked from commit
fbbc72189f7844df8500bb10a58988f70bf90c99)
Lennart Poettering [Thu, 12 Nov 2020 16:52:09 +0000 (17:52 +0100)]
resolved: lower SERVFAIL cache timeout from 30s to 10s
Apparently 30s is a bit too long for some cases, see #5552. But not
caching SERVFAIL at all also breaks stuff, see explanation in
201d99584ed7af8078bb243ce2587e5455074713.
Let's try to find some middle ground, by lowering the cache timeout to
10s. This should be ample for the problem
201d99584ed7af8078bb243ce2587e5455074713 attackes, but not as long as
half a miute, as #5552 complains.
Fixes: #5552
(cherry picked from commit
19bcef9dc3fde342f138394333ab04d7e44b7da2)
Lennart Poettering [Thu, 5 Nov 2020 17:22:38 +0000 (18:22 +0100)]
resolved: bind socket to interface during connect()
Apparently, IF_UNICAST_IF does not influence the routing decisions done
during connect(). But SO_BINDTODEVICE/SO_BINDTOINDEX does, which however
brings a lot of other semantics with it, we are not so interested in
(i.e. it doesn't not allow packets from any other iface to us, even if
routing otherwise allows it).
Hence, let's bind to the ifindex immediately before the connect() and
unbind right after again, so that we get the semantics we want, but not
the ones we don't.
Fixes: #11935
Replaces: #12004
(cherry picked from commit
d301c52383ca7cfa6b7cda87d7a4209c234a532c)
Lennart Poettering [Wed, 18 Nov 2020 09:25:27 +0000 (10:25 +0100)]
socket-util: add sockaddr_in_addr() helper
This extracts the IP address (as union in_addr_union) from a socket
address (i.e. a struct sockaddr).
(cherry picked from commit
3132597182c806e5193aebb0b67cdc0f73154a51)
Lennart Poettering [Wed, 11 Nov 2020 20:20:15 +0000 (21:20 +0100)]
resolved: insert large dgram size into EDNS0 only when in LARGE UDP mode
Specifically, in TLS-DO there's no reason to set the exotic dgram size.
(cherry picked from commit
0a489d3f5d2a6ef8667224d838044a520e98ab37)
Lennart Poettering [Mon, 9 Nov 2020 22:10:43 +0000 (23:10 +0100)]
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)
Christopher Obbard [Wed, 2 Dec 2020 14:20:39 +0000 (14:20 +0000)]
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)
Lennart Poettering [Tue, 17 Nov 2020 17:31:53 +0000 (18:31 +0100)]
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)
Yu Watanabe [Wed, 2 Dec 2020 09:05:06 +0000 (18:05 +0900)]
igo95862 [Fri, 27 Nov 2020 13:51:18 +0000 (16:51 +0300)]
man: Speicfy exact return values of sd_bus_message_enter_container
(cherry picked from commit
1edc1f1b626446a20db405d041cd70ed3d52c632)
Yu Watanabe [Thu, 26 Nov 2020 23:18:32 +0000 (08:18 +0900)]
network: fix return values
(cherry picked from commit
72f092815ada28431103d2145ffa61e1ae14aded)
Zbigniew Jędrzejewski-Szmek [Thu, 26 Nov 2020 10:23:54 +0000 (11:23 +0100)]
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)
Dan Streetman [Wed, 25 Nov 2020 20:22:24 +0000 (15:22 -0500)]
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)
Yu Watanabe [Wed, 25 Nov 2020 13:20:48 +0000 (22:20 +0900)]
man: slightly update the man page of sd_bus_message_read_basic()
Follow-up for
73a1d7d2433edd1872ec53db3e804009298ebb1d.
(cherry picked from commit
7a1fe27f81dace11a25a0573dc170d86d1f92023)
igo95862 [Wed, 25 Nov 2020 13:15:33 +0000 (16:15 +0300)]
man: Fixed an incomplete sentence
(cherry picked from commit
78c4f2f153b93fdb39654edb93a73b202a67dcfd)
igo95862 [Wed, 25 Nov 2020 12:53:52 +0000 (15:53 +0300)]
man: Specify that sd_bus_message_read_basic returns 0 if end of array had been reached.
(cherry picked from commit
73a1d7d2433edd1872ec53db3e804009298ebb1d)
Yu Watanabe [Tue, 17 Nov 2020 00:13:59 +0000 (09:13 +0900)]
core/mount: mount command may fail after adding the corresponding proc mountinfo entry
Hopefully fixes #17617.
(cherry picked from commit
2fa0bd7d57863dffda89190a70a83c51bd7d114a)
Lennart Poettering [Tue, 17 Nov 2020 17:35:08 +0000 (18:35 +0100)]
mkosi: make sure our mkosi files work with f33
(cherry picked from commit
e2c5e698c094165919af8d5f91896425c918c850)
Pavel Sapezhko [Wed, 18 Nov 2020 14:54:01 +0000 (17:54 +0300)]
man: clarify DefaultTasksMax doc
(cherry picked from commit
77f5277a7abf7d6b0a4bbf4ecf872da0b92335b5)
Yu Watanabe [Tue, 24 Nov 2020 09:47:37 +0000 (18:47 +0900)]
seccomp: also move munmap into @default syscall filter set
Follow-up for
5abede3247591248718026cb8be6cd231de7728b.
(cherry picked from commit
11b9105dfdbcea5dc9f4a5dd676ca494ab8b909e)
INSUN PYO [Thu, 19 Nov 2020 01:49:04 +0000 (10:49 +0900)]
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)
Etienne Doms [Fri, 20 Nov 2020 16:15:25 +0000 (17:15 +0100)]
curl-util: fix callback prototype
CURLMOPT_SOCKETFUNCTION callback is an easy handle, not a multi.
(cherry picked from commit
5b639090d0b4a49d77ba58bebe180b2a6f8da322)
Yu Watanabe [Fri, 20 Nov 2020 16:51:03 +0000 (01:51 +0900)]
curl-util: fix type CURL -> CURLM
(cherry picked from commit
2d052a0a48cc184ea3748c2e364c661985aa21d5)
Franck Bui [Fri, 20 Nov 2020 10:52:36 +0000 (11:52 +0100)]
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)
Yu Watanabe [Tue, 17 Nov 2020 01:50:12 +0000 (10:50 +0900)]
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)
Lennart Poettering [Thu, 19 Nov 2020 10:14:41 +0000 (11:14 +0100)]
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)
Franck Bui [Thu, 19 Nov 2020 08:17:19 +0000 (09:17 +0100)]
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)
Franck Bui [Thu, 19 Nov 2020 07:55:56 +0000 (08:55 +0100)]
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)
Yu Watanabe [Wed, 18 Nov 2020 07:43:58 +0000 (16:43 +0900)]
khash: fix structured initializer
Fixes #17646.
(cherry picked from commit
f56a9cbf9c20cd798258d3db302d51bf21458b38)
igo95862 [Wed, 18 Nov 2020 09:21:37 +0000 (12:21 +0300)]
man: Fix sd_bus_message_append_array_space function signature
(cherry picked from commit
0e577869f3fc287223d31cfed52921c4d3579ff2)
Yu Watanabe [Mon, 16 Nov 2020 15:51:14 +0000 (00:51 +0900)]
sd-device: drop unwanted newline in netlink message
(cherry picked from commit
b9cbb08e0a35070d57721cd5bf810659a0b80f5e)
Zbigniew Jędrzejewski-Szmek [Tue, 17 Nov 2020 10:46:50 +0000 (11:46 +0100)]
man: drop misplaced phrase
I think it was added in
6c2b9c8da1eb1bac7e8f170b913f63dbd13a16d7 as c&p.
(cherry picked from commit
de70ff66dc628062d4f04270988b92ba0aef2420)
igo95862 [Tue, 17 Nov 2020 09:47:28 +0000 (12:47 +0300)]
man: Add a paragraph to sd_bus_call explaning callback message lifetime
(cherry picked from commit
e6ce785d611702532ae71547e78fbb49eff3aded)
Yu Watanabe [Sat, 14 Nov 2020 20:13:55 +0000 (05:13 +0900)]
man: fix prototpe of sd_bus_message_peek_type()
Fixes #17609.
(cherry picked from commit
483abcc65bd5efe43b0cea453580bac45cd0f177)
Yu Watanabe [Sat, 14 Nov 2020 20:10:10 +0000 (05:10 +0900)]
man: add missing <para> tag, and drop redundant ">"
Fixes #17609.
(cherry picked from commit
e55c073161d469fb01ecd5bea3ff8845194e25d9)
igo95862 [Tue, 17 Nov 2020 07:54:19 +0000 (10:54 +0300)]
man: Separated paragraph about making sd_bus object reply async
(cherry picked from commit
2e4238a6d14223728dbfbb24830e644d31b04111)
Yu Watanabe [Fri, 13 Nov 2020 06:55:54 +0000 (15:55 +0900)]
meson: use "_" as separator in test names
Follow-up for
ca121e20c42219e3bc4e5cb63dcc96cc5eae2879.
Fixes #17568.
(cherry picked from commit
d448888924c1d4815cb97bcd5d94419812c053b9)
Yu Watanabe [Fri, 13 Nov 2020 05:58:49 +0000 (14:58 +0900)]
missing: define several syscall numbers for MIPS arch
Fixes #17591.
(cherry picked from commit
77419ba463999a25922146ac424348adc2fe23af)
Christof Efkemann [Sun, 15 Nov 2020 19:08:39 +0000 (20:08 +0100)]
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)
Etienne Doms [Thu, 12 Nov 2020 10:09:54 +0000 (11:09 +0100)]
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)
Yu Watanabe [Mon, 9 Nov 2020 21:10:16 +0000 (06:10 +0900)]
man: fix tag
(cherry picked from commit
af7ce3faf88f6bcd5c82a71412fa81e8ae34acbb)
Yu Watanabe [Mon, 9 Nov 2020 20:57:41 +0000 (05:57 +0900)]
man: mention that sd_bus_call() may return a negative errno mapped from D-Bus error reply
Closes #17556.
(cherry picked from commit
c660668ed9daf15358c522c09ba3932393bd5451)
Yu Watanabe [Mon, 9 Nov 2020 20:25:29 +0000 (05:25 +0900)]
man: add missing period
(cherry picked from commit
23243adf69ffed2630c778e021c3cf2e97a6b999)
Zbigniew Jędrzejewski-Szmek [Wed, 11 Nov 2020 13:37:07 +0000 (14:37 +0100)]
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)