Jason Francis [Mon, 19 Apr 2021 16:13:03 +0000 (12:13 -0400)]
sd-login: correct prototype of sd_peer_get_cgroup
(cherry picked from commit
a8310e39e996b9b5f63d897879aecf8988261bdb)
(cherry picked from commit
fa7f835f79d4da8ee6d7403be43a0ba4d24b9fb2)
(cherry picked from commit
60d3eeef5e803997e1c9356d543d460a61f1b4dc)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 20:06:02 +0000 (22:06 +0200)]
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 15:10:36 +0000 (17:10 +0200)]
shared/module-util: fix errno value passed to log function
If r == 0, no harm done. But if r > 0, this would be interpreted as an
errno value, wrongly.
(cherry picked from commit
a2eb2267e44580446ecad37e7206e729cfd78155)
(cherry picked from commit
e70a773f85ceb64435de3d47c12b07c08605f591)
(cherry picked from commit
c6d3623e9e53cc4c1b3e05fa665d2c8791212b74)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 10:14:01 +0000 (06:14 -0400)]
partition, random-seed, logind: fix log messages with %m
We would print "...: Success", which is not too terrible, but not pretty
either.
(cherry picked from commit
111a3aae71fa019710216cc5b7aa95b7c8db0937)
(cherry picked from commit
c032a26df67903e0c65150b5cc68ade35aa47c03)
(cherry picked from commit
7b535fcda495ca8a73133526484340925d754bf6)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 09:54:17 +0000 (05:54 -0400)]
sd-device: improve log message and tweak style
We shouldn't say the attribute is missing right after ruling out ENOENT.
(cherry picked from commit
aca591ac55e5ee364905aec975388c5e30d0476c)
(cherry picked from commit
e31914aa17df889ae10f0964a8bbc8c00e0f045b)
(cherry picked from commit
645c85022ac6c035ccdd0590db687c5be1147e85)
Luca Boccassi [Wed, 14 Apr 2021 20:26:50 +0000 (21:26 +0100)]
test: use systemd-run --wait in TEST-44-LOG-NAMESPACE
The test appears to be occasionally failing. It uses systemd-run to echo
'hello world' into a namespaced journal and then uses journalctl to look for it,
but it doesn't wait.
In the failed runs it can't find it, but the automated journal dump shows
the message at the end.
Use --wait to avoid races.
(cherry picked from commit
cf9844ffabd7fd51f22e729692b79d55cd7bdd76)
(cherry picked from commit
2c17e13ae48b94a0fd02c7746d723b26a0f3dc65)
(cherry picked from commit
bed66a8d19566adf94386482fe5ee0216b66f848)
Zbigniew Jędrzejewski-Szmek [Wed, 14 Apr 2021 08:55:09 +0000 (04:55 -0400)]
libsystemd-network: fix dhcp option buffer confusion
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a306fd2ba454d3ee333d63df71aa3873.
(cherry picked from commit
828b603a791edd04a5c3603456aa8caca44ce67e)
(cherry picked from commit
cd1fc467f72e607bcd2464651b68f31bd2a8791a)
(cherry picked from commit
3def84156c37b9a873c29bb93afe5ddaa341c698)
Sevan Janiyan [Wed, 14 Apr 2021 23:01:53 +0000 (00:01 +0100)]
Yu Watanabe [Sun, 11 Apr 2021 12:25:16 +0000 (21:25 +0900)]
network: add missing default setting in networkd.conf
(cherry picked from commit
6bfadad9bb6eaf614da92eba0a9b6243e8645018)
(cherry picked from commit
ee24f9346630b6d59e88ef0989f943444e752569)
(cherry picked from commit
5d91d5a61a88d4b5a2b92d5f665a5dd5dd99d6bd)
gaoyi [Tue, 13 Apr 2021 10:59:46 +0000 (18:59 +0800)]
udev: delete useless codes
It seems no one will touch queue.bin
(cherry picked from commit
993eb00016a75cf085eed85cf626a6995e96ab3d)
(cherry picked from commit
a511010f380397e8bb08816288e31b1666dc11b9)
(cherry picked from commit
74ae332b68785b878b25facac43d166d1c85e575)
Francois Gervais [Mon, 12 Apr 2021 22:25:29 +0000 (18:25 -0400)]
load-fragment: parse specifiers in CPUAffinity= (#19281)
(cherry picked from commit
54cfe9a75f0e84d0604d39b87b1d919542336809)
(cherry picked from commit
bf3bd598136397b5371188bcdec0127e56a1db9a)
(cherry picked from commit
595b1cefbb71397ba08b770136e461022d774d1f)
Zbigniew Jędrzejewski-Szmek [Mon, 12 Apr 2021 12:03:32 +0000 (14:03 +0200)]
meson: do not fail if rsync is not installed with meson 0.57.2
https://github.com/mesonbuild/meson/issues/8641
Our CI started to fail. Even if the change is reverted in meson,
we need a quick workaround here.
(cherry picked from commit
7c5fd25119a495009ea62f79e5daec34cc464628)
(cherry picked from commit
f6435a07c1ca4b895573eba4a64dcf4bef3fb92b)
(cherry picked from commit
f4a1812f95d0c215ef3a9fec24e055bc976c41f1)
Julia Kartseva [Thu, 4 Feb 2021 06:15:27 +0000 (22:15 -0800)]
bpf-firewall: attach with BPF_F_ALLOW_MULTI if kernel supports
Reduced version of [0].
Use BPF_F_ALLOW_MULTI attach flag for bpf-firewall if kernel supports
it.
Aside from addressing security issue in [0] attaching with 'multi'
allows further attaching of cgroup egress, ingress hooks specified by
BPFProgram=.
[0] https://github.com/systemd/systemd/pull/17495/commits/
4e42210d40f96e185a55d43041dd6b962ea830dd
(cherry picked from commit
a442ccb4ebdbc3a9ff9d4504eb9724092149fd42)
(cherry picked from commit
0af3810d4b1c8bb4f0683758f47e042e8cb76972)
(cherry picked from commit
baff489b82bb33c1b13249993f940721fef7671e)
gaoyi [Mon, 12 Apr 2021 08:09:47 +0000 (16:09 +0800)]
man: fix discriptions for --exec-delay
There are two ambiguity in the original description:
1. It will delay all RUN instructions, include builtin.
2. It will delay before running RUN, not each of RUN{program} instructions.
(cherry picked from commit
45f5efdea7e5e94bd47fc24b9bd404c77b5771a0)
(cherry picked from commit
cb92f5601ad169e8f86a61319b73a8fd9e19950b)
(cherry picked from commit
58a56b6a14d5cc9b7ecdd397d7ab6b76170fad08)
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 20:35:19 +0000 (22:35 +0200)]
TEST-22-TMPFILES: add reproducer for bug with X
(cherry picked from commit
1672be86021b5ae8e80d095409a4fffcba7cbb75)
(cherry picked from commit
280b157fca7b44b19ec0067ebb88d2c16df1b6e1)
(cherry picked from commit
2fb262636cdf0440fd612ca2a4b6afad68bf655a)
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 16:26:15 +0000 (18:26 +0200)]
man: fix quickhelp listing in tmpfiles.d(5)
Unlike many other small/big letter combos, this one has the recursive
version attached to the lowercase letter.
(cherry picked from commit
3dd61ee5be0291380d341571e138713d2f89125a)
(cherry picked from commit
ba8032c414dcf7c627cee3e979654bc5e294def3)
(cherry picked from commit
ebe12d8493e2e8d292e8f7b8ac2b0987d1a815d6)
Masahiro Matsuya [Wed, 31 Mar 2021 02:44:24 +0000 (11:44 +0900)]
tmpfiles: use a entry in hashmap as ItemArray in read_config_file()
[zjs: squash commits and use size_t as appropriate.
Bug seems to have been introduced in
811a15877825da9e53f9a2a8603da34589af6bbb.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
1944468.]
(cherry picked from commit
bec890e3cd6dac249cb12ce9430fdb78b6cf546b)
(cherry picked from commit
b266eeb0aee24a0c5868c3a46066c0329b2d1141)
(cherry picked from commit
dbfb698668578da0b53812c6ee5b4d410b5dc546)
Luca Boccassi [Sat, 10 Apr 2021 19:13:02 +0000 (20:13 +0100)]
mkosi.arch: add rsync build dependency
Program rsync found: NO
man/meson.build:187:0: ERROR: Program 'rsync' not found
(cherry picked from commit
a7b7cab66df8c0a701bc6da3a309fa80c90a880b)
(cherry picked from commit
dca590b4b54b3f88919d78645e8c9a4febede850)
(cherry picked from commit
651e479e29c470663d8862344c0c4239d69a9d26)
Oleg Popov [Sat, 10 Apr 2021 14:21:25 +0000 (17:21 +0300)]
Extend characters set for PKCS11 URI
There are tokens with dots (and other symbols) in PKCS11 URI:
pkcs11:model=Rutoken%20ECP;manufacturer=Aktiv%20Co.;serial=3xxxxxxb;token=livelace
pkcs11:model=PRO;manufacturer=Aladdin%20R.D.;serial=
CC62FB25;token=val%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00;id=%33%32%31%30%33%61%36%37%36%65%32%34%35%62%32%31;type=private
(cherry picked from commit
b204bdd4ccae2c76422e7383bd51b664d7e2cfd3)
(cherry picked from commit
27eec0eb045b62b19657b7662dd10594362515a2)
(cherry picked from commit
9eb7e9808f565b727f2a12d02fb87e55534466b6)
Lennart Poettering [Sat, 10 Apr 2021 12:58:54 +0000 (14:58 +0200)]
resolved: add RFC 8375 "home.arpa" to list of default NTA
RFC 8375 introduced "home.arpa" as special TLD for home networks. Let's
hence add it to our default list of NTAs.
(cherry picked from commit
1065501406d6ca608444c3bd19db546e82009450)
(cherry picked from commit
8d55dcd0b89c21538ce388da559b0b4b87be7f20)
(cherry picked from commit
c616c2121465d38f894cc2c03b6ef2127d9aab56)
gaoyi [Tue, 6 Apr 2021 02:44:33 +0000 (10:44 +0800)]
gpt-auto-generator: don't generate systemd-cryptsetup@.service when --Dlibcryptsetup=false
(cherry picked from commit
5b1375035b617bbee8b22a997be527d1b7a392f8)
(cherry picked from commit
aa6b8490870d3a793becf41cc63479043a934a73)
(cherry picked from commit
a4b1e176b264f1dc67ef4422d065ae95ecb8c89e)
Lennart Poettering [Tue, 6 Apr 2021 09:45:47 +0000 (11:45 +0200)]
proc-cmdline: allow backslash escapes when parsing /proc/cmdline
So far when parsing /proc/cmdline we'd consider backslashes as
mechanisms for escaping whitepace or quotes. This changes things so that
they are retained as they are instead. The kernel itself doesn't allow such
escaping, and hence we shouldn't do so either (see lib/cmdline.c in the
kernel sources; it does support "" quotes btw).
This fix is useful to allow specifying backslash escapes in the "root="
cmdline option to be passed through to systemd-fstab-generator. Example:
root=/dev/disk/by-partlabel/Root\x20Partition
Previously we'd eat up the "\" so that we'd then look for a device
/dev/disk/by-partlabel/Rootx20Partition which never shows up.
(cherry picked from commit
d997861ea7dae633174cd80ab55552c020526b62)
(cherry picked from commit
0e6d3243ad3c5ae719c23e14b159c27344523583)
(cherry picked from commit
634c0e5e1034b58ef99bc8729db7c68219c947ab)
Sibo Dong [Sat, 3 Apr 2021 03:33:59 +0000 (23:33 -0400)]
bash-completion: localize words and cword variables
The words and cword variables are not localized in all Bash completion
scripts that call _init_completion.
cur, prev, words, and cword (and split if using the -s flag) are all
variables that should be localized in Bash completion scripts before
calling _init_completion (even if they don't otherwise appear in the
calling script). This is done for cur and prev, but not for words and
cword. Letting words and cword remain unlocalized may clobber variables
the user is using for other purposes, which is bad.
This issue can be resolved by declaring words and cword as local
variables.
Resolves #19188.
(cherry picked from commit
f34173a048061b3f7e551e9a7c04f00e5a106fac)
(cherry picked from commit
90aee910f6e6d54e78651ee8a9d95823b88b527d)
(cherry picked from commit
d62208c253daa55128adfa4f43886298bea28b01)
Frantisek Sumsal [Fri, 2 Apr 2021 16:07:26 +0000 (18:07 +0200)]
fuzzer: add a test case for #19178
(cherry picked from commit
080a602771ef51230a51f247b8b728d0483e2f28)
(cherry picked from commit
98365420f25a3b0fdc01937b767e0ef530d2dce7)
(cherry picked from commit
08f829762736f8d43a219ebd212ab9dd9b5a662b)
Carlo Teubner [Fri, 2 Apr 2021 08:03:02 +0000 (09:03 +0100)]
docs: use current spelling "macOS" not "OS X" etc.
(cherry picked from commit
6d3831cee58dcbdb7ea8a86ca621fec38f5b279b)
(cherry picked from commit
b819fff474661d6d43ee47b41031462f9c0a9af4)
(cherry picked from commit
5854761fc553855a0796d873ac1891d928c7ab45)
Joerg Behrmann [Tue, 30 Mar 2021 14:29:59 +0000 (16:29 +0200)]
systemd-notify: Fix return value of --booted
(cherry picked from commit
8ab34a49dbf75fd731973359a6f24c212682f479)
(cherry picked from commit
480fd82088ad6e44644c568fe37c5d945738a61b)
(cherry picked from commit
cf76ba7b6eb189fe4e5c7f57afc35e06a0179af3)
Zbigniew Jędrzejewski-Szmek [Wed, 31 Mar 2021 15:24:26 +0000 (17:24 +0200)]
Anita Zhang [Fri, 5 Mar 2021 04:00:05 +0000 (20:00 -0800)]
Anita Zhang [Fri, 5 Mar 2021 03:56:16 +0000 (19:56 -0800)]
shutdown: set always_reopen_console
Back in v232 systemd-shutdown would log to /dev/console. However after
the addition of always_reopen_console (v233) it would log to STDERR.
This caused some debugging issues as container systemd-shutdown logs
weren't being logged to console as the arg `--log-target=console` suggested.
Since it appears that always_reopen_console was intended for pid1, set
it in systemd-shutdown as well so logs will go to /dev/console.
(cherry picked from commit
f975f1cc748929942188ae1490cf8480f8a64877)
(cherry picked from commit
baa8bd89efa752633805c5b04b02d1dbde5ea0bb)
(cherry picked from commit
499bea62091f7b672f0e296ec67623a155e2a1d6)
Fangrui Song [Mon, 29 Mar 2021 06:35:06 +0000 (23:35 -0700)]
sd-bus: set retain attribute on BUS_ERROR_MAP_ELF_REGISTER
LLD 13 and GNU ld 2.37 support -z start-stop-gc which allows garbage
collection of C identifier name sections despite the __start_/__stop_
references. Simply set the retain attribute so that GCC 11 (if
configure-time binutils is 2.36 or newer)/Clang 13 will set the
SHF_GNU_RETAIN section attribute to prevent garbage collection.
Without the patch, there are linker errors like the following with -z
start-stop-gc.
```
ld: error: undefined symbol: __start_SYSTEMD_BUS_ERROR_MAP
>>> referenced by bus-error.c:93 (../src/libsystemd/sd-bus/bus-error.c:93)
>>> sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
```
(cherry picked from commit
945317a4b69d33752c9513bb8994fe8d5a786ea6)
(cherry picked from commit
a360526852eadb2f14f5d4632771c3719a1c4dcf)
Zbigniew Jędrzejewski-Szmek [Fri, 26 Mar 2021 12:07:55 +0000 (13:07 +0100)]
basic/log: fix log_trace()
log_trace() was always on. It's supposed to be opt-in.
(cherry picked from commit
e355fb6fb1c926d0ac109c35704b301e37172c4e)
(cherry picked from commit
1f2b3e1c07881b451b1c78ce299f6cc50f696973)
David Tardon [Fri, 26 Mar 2021 11:34:28 +0000 (12:34 +0100)]
use the right member to define property
(cherry picked from commit
cb6c4f37dc4ade1ed1dea461803ebdceab1e5941)
(cherry picked from commit
6256d6b4e7f9f9a96853be9a72745d72a70f591a)
Lennart Poettering [Wed, 24 Mar 2021 20:21:08 +0000 (21:21 +0100)]
resolved: upgrade log level to LOG_NOTICE if we switch to fallback server (or back)
This is inspired by a recent thread on fedora-devel: it's noteworthy
when we switch to the fallback servers, since it might (or might not)
indicate some configuration problem.
Fixes: #18788
(cherry picked from commit
9b564bbca5fcfb251b7990c8642c82846d09338b)
(cherry picked from commit
d6231fde7dd3a1a05da34c722cc66a87fb197660)
Lennart Poettering [Mon, 3 May 2021 18:06:15 +0000 (20:06 +0200)]
userdb: honour USERDB_AVOID_SHADOW flag also when iterating
(cherry picked from commit
7c67419117f19a85cf3e7e1513c072be2b767a74)
(cherry picked from commit
74fbb83ac2613930f9939f31c9633a97a28da4eb)
(cherry picked from commit
662d14c5af342edbfee5b0b8cf9dc892228a58b9)
Lennart Poettering [Fri, 30 Apr 2021 21:09:35 +0000 (23:09 +0200)]
Lennart Poettering [Fri, 30 Apr 2021 21:08:55 +0000 (23:08 +0200)]
userdb: remove unnecesary repeated if check
(cherry picked from commit
77fe7d15931cc17c933ae8778c4161112783dc79)
(cherry picked from commit
dd8454c17694e6857447f0dd8fb3ff4b409b3bdc)
(cherry picked from commit
be316678b32eecaf2f24cabf111015b20d07e111)
Lennart Poettering [Fri, 30 Apr 2021 21:08:21 +0000 (23:08 +0200)]
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 15:02:49 +0000 (17:02 +0200)]
sd-device: reject empty driver name
If ":" was the last char in the string, we would call access() on ".../drivers/", which
would pass. It probably doesn't matter, but let's reject this anyway.
(cherry picked from commit
52a89a5f08230439f07c043d59ded1270842137b)
(cherry picked from commit
92e5ba438d48a798807104d8aed4e480c58c6465)
(cherry picked from commit
19b1a0f24a781235393b30aff23127efa7a242d7)
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:57:39 +0000 (16:57 +0200)]
sd-device: use memdupa_suffix0() where appropriate
No functional change intended.
(cherry picked from commit
3e2d0c6ab2abc0ab85440580931b2462bb73cfda)
(cherry picked from commit
37eeb9c03f86227e94d8e1fa046ca0c0d2b6d237)
(cherry picked from commit
63c2aba7cec5e2ac72b23d7e5c51d6f91408fc10)
Yu Watanabe [Sun, 7 Mar 2021 06:24:15 +0000 (15:24 +0900)]
sd-device: minor optimization for sd_device_new_from_device_id()
(cherry picked from commit
ff7a8d2938b24cb7ca7b69900395ecf837a43a23)
(cherry picked from commit
d7ea7c486a0101dae06a9aca290bfafa46bc1fe2)
(cherry picked from commit
cce2133844e6287ce47bdeb529855521e2c2c588)
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:49:41 +0000 (16:49 +0200)]
sd-device: do no allocate strings of unknown length on the stack
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33881.
Not only we would duplicate unknown input on the stack, we would do it
over and over. So let's first check that the input has reasonable length,
but also allocate just one fixed size buffer.
(cherry picked from commit
e17c95af8e450caacde692875b30675cea75211f)
(cherry picked from commit
5172ef4a58bda5be18dcdbbe0abd2c6bb4f08743)
(cherry picked from commit
7e0f374aaca4d964c880d5966811ce2ecfdda94f)
наб [Fri, 16 Apr 2021 11:00:37 +0000 (13:00 +0200)]
meson: don't fail if latest tag's commit is signed
Today this is v248 with
938bdfc0fa737d86eb3ecc70506e11e5f740e0dc, which,
if you don't know about the github webflow key fails to configure with
meson.build:724:8: ERROR: String "gpg: Signature made Tue 30 Mar 2021 22:59:02 CEST\ngpg: using RSA key
4AEE18F83AFDEB23\ngpg: Can't check signature: No public key\n1617137942\n" cannot be converted to int
or, if you do, with
meson.build:724:8: ERROR: String 'gpg: Signature made Tue 30 Mar 2021 22:59:02 CEST\ngpg: using RSA key
4AEE18F83AFDEB23\ngpg: Good signature from "GitHub (web-flow commit signing) <noreply@github.com>" [unknown]\ngpg: WARNING: This key is not certified with a trusted signature!\ngpg: There is no indication that the signature belongs to the owner.\nPrimary key fingerprint: 5DE3 E050 9C47 EA3C F04A 42D3 4AEE 18F8 3AFD EB23\n1617137942\n' cannot be converted to int
(cherry picked from commit
2d945027244c02fab8d388353f034a2d82ca151b)
(cherry picked from commit
964a13d17be3426ecf539a5155e2cb8b4c16fb31)
(cherry picked from commit
c37bb626c8eac47ce8614ea0331a2f4f7a43cc76)
Yu Watanabe [Thu, 29 Apr 2021 22:00:45 +0000 (07:00 +0900)]
network: can: do not warn if link does not exist anymore
(cherry picked from commit
ed52cce33f588bbeb3d7f5d7f5e76a85cf6e4f89)
(cherry picked from commit
8b881617609e530b846faa27a32db070536fb0d4)
(cherry picked from commit
50ec6a9ec04da8c76afda2e458f9f3ea1df7727d)
Yu Watanabe [Thu, 29 Apr 2021 21:57:15 +0000 (06:57 +0900)]
network: drop duplicated link_up_can()
(cherry picked from commit
f282ce20aaa767f5395b065f2be587cdef3e5491)
(cherry picked from commit
179a92c9d8b2df688764095ce1d242de20ee72fa)
(cherry picked from commit
d1e06f70368ac4b08c2804f3ecfa7cb3ed874fac)
Yu Watanabe [Thu, 29 Apr 2021 19:00:02 +0000 (04:00 +0900)]
sd-bus: fix vtable named argument logic
Fixes #19468.
(cherry picked from commit
c068a17f6a18d3ebfabe88fc49e24a923d0bdd0a)
(cherry picked from commit
618b8bfa38873a45704753b882ada90c0f3492c5)
(cherry picked from commit
e6362ecc5e262f005a39eaff8d1d1fd0caab4a5e)
Steve Bonds [Thu, 25 Mar 2021 14:40:39 +0000 (07:40 -0700)]
Clarify that these values are in bytes
Similar to `ProcessSizeMax`. The defaults in percentages can be misunderstood to mean the values for these parameters will be in percentages.
(cherry picked from commit
88c2c8a0ba13de31061a22a352410c18ffacab9a)
(cherry picked from commit
a9ab73ca9f79d0830e71716359a9710fc165ccca)
(cherry picked from commit
b761e7e472b41fc82c591f79148af47381c0c6b4)
syyhao1994 [Fri, 30 Apr 2021 07:55:50 +0000 (15:55 +0800)]
man: importd also provides the option of import-fs for machinectl (#19477)
(cherry picked from commit
96ae72ce1ad41674078e45b197df35ad18041dc2)
(cherry picked from commit
59cde3bba171abfefd8bf25e4ed07d43700c5e84)
(cherry picked from commit
41e4a4f3df5966c9d36e511728dd7ca1c0e4261c)
Alexander Sverdlin [Sun, 18 Apr 2021 23:53:45 +0000 (01:53 +0200)]
systemd-coredump: Add conflict with shutdown.target
Otherwise a coredump started at the inconvinient moment can stop
shutdown.target leaving the system in a halfway-down state:
Pulling in shutdown.target/start from systemd-poweroff.service/start
Added job shutdown.target/start to transaction.
...
Keeping job shutdown.target/start because of systemd-poweroff.service/start
...
[ OK ] Stopped target Remote File Systems.
shutdown.target: starting held back, waiting for: systemd-networkd.socket
sysinit.target: stopping held back, waiting for: remount_tmp.service
systemd-coredump.socket: Incoming traffic
...
systemd-coredump@0-243-0.service: Trying to enqueue job systemd-coredump@0-243-0.service/start/replace
Added job systemd-coredump@0-243-0.service/start to transaction.
Pulling in systemd-journald.socket/start from systemd-coredump@0-243-0.service/start
Added job systemd-journald.socket/start to transaction.
Pulling in system.slice/start from systemd-journald.socket/start
Added job system.slice/start to transaction.
Pulling in -.slice/start from system.slice/start
Added job -.slice/start to transaction.
Pulling in system-systemd\x2dcoredump.slice/start from systemd-coredump@0-243-0.service/start
Added job system-systemd\x2dcoredump.slice/start to transaction.
Pulling in system.slice/start from system-systemd\x2dcoredump.slice/start
Pulling in shutdown.target/stop from system-systemd\x2dcoredump.slice/start
Added job shutdown.target/stop to transaction.
...
Keeping job systemd-poweroff.service/stop because of umount.target/stop
Keeping job shutdown.target/stop because of systemd-coredump@0-243-0.service/start
(cherry picked from commit
4e947bd04944e58df4103eee4cb8180b5008f143)
(cherry picked from commit
e11d3ec13c1ee7af65893e94d09d8b3b66cd99c9)
(cherry picked from commit
c8491deca6911eda63b9f06172d2c956762ba1b6)
Yu Watanabe [Wed, 28 Apr 2021 15:07:09 +0000 (00:07 +0900)]
network: dhcp4: downgrade log level when interface is removed
(cherry picked from commit
e558d4f47a9c01b007fc193cabcf0dea8370a5f1)
(cherry picked from commit
0881deb1951a55701cf6ea743132458459e3a650)
(cherry picked from commit
b91e1cde447d08b8a72102b08e23cfefdd62601f)
Yu Watanabe [Wed, 28 Apr 2021 13:17:39 +0000 (22:17 +0900)]
network: link: downgrade log level
The error is harmless, and will be ignored. Let's downgrade log level.
(cherry picked from commit
83e7c37b19bd36c78b235ac3047b758fcf82ad78)
(cherry picked from commit
1db3be80337b79e3b9afda9d50c61e6aed5aff28)
(cherry picked from commit
23f2ff3143317022f61a15397e6f2178d46126a2)
William A. Kennington III [Tue, 27 Apr 2021 08:25:58 +0000 (01:25 -0700)]
network: neighbor: Always add neighbors with replace
We were duplicating setting flags for the message and a combination of
NLM_F_APPEND and NLM_F_CREATE which does not make sense. We should have
been using NLM_F_REPLACE and NLM_F_CREATE since the kernel can
dynamically create neighbors prior to us adding an entry. Otherwise, we
can end up with cases where the message will time out after ~25s even
though the neighbor still gets added. This delays the rest of the setup
of the interface even though the error is ultimately ignored.
(cherry picked from commit
192a9d95ea3e058afd824d38a9cea16ad0a84a57)
(cherry picked from commit
cbbe6f78b7839bae605e0296f5d2ae2e3baa04a9)
Luca Boccassi [Tue, 13 Apr 2021 12:17:53 +0000 (13:17 +0100)]
rfkill: add some casts to silence -Werror=sign-compare
(cherry picked from commit
ab1aa6368a883bce88e3162fee2bea14aacedf23)
Fixes https://github.com/systemd/systemd-stable/issues/101.
(cherry picked from commit
074475abc1d6187de88b77dcc4fe0c4d2ab804f5)
(cherry picked from commit
a4cd7949c47f55aa972098e080b65084c9e60ff9)
Daan De Meyer [Fri, 12 Mar 2021 22:09:44 +0000 (22:09 +0000)]
boot: Move console declarations to missing_efi.h
These were added to eficonex.h in gnu-efi 3.0.13. Let's move them
to missing_efi.h behind an appropriate guard to fix the build with
recent versions of gnu-efi.
(cherry picked from commit
95ba433a5f34baf92921fb58051bc8241f908c0e)
(cherry picked from commit
48fff0a2af3f62acd446ebec8081b039b72caad8)
Zbigniew Jędrzejewski-Szmek [Tue, 30 Mar 2021 08:01:12 +0000 (10:01 +0200)]
selinux: do not crash if policy becomes unavailable after reload
https://bugzilla.redhat.com/show_bug.cgi?id=
1944171
Thread 1 (Thread 0x7fb5f0341b80 (LWP 1974)):
№0 selabel_lookup_common (rec=0x0, translating=0, key=0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service", type=40960) at label.c:167
'rec' is the handle that we passed.
№1 0x00007fb5f13ae87f in selabel_lookup_raw (rec=<optimized out>, con=con@entry=0x7fffef307380, key=key@entry=0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service", type=type@entry=40960) at label.c:256
lr = <optimized out>
'rec' is passed through as is to selabel_lookup_common().
№2 0x00007fb5f1561b2d in selinux_create_file_prepare_abspath (abspath=0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service", mode=40960) at ../src/basic/selinux-util.c:368
filecon = 0x0
r = <optimized out>
__PRETTY_FUNCTION__ = "selinux_create_file_prepare_abspath"
__func__ = "selinux_create_file_prepare_abspath"
№3 0x00007fb5f1561ec3 in mac_selinux_create_file_prepare (path=<optimized out>, mode=40960) at ../src/basic/selinux-util.c:431
r = 0
abspath = 0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service"
__PRETTY_FUNCTION__ = "mac_selinux_create_file_prepare"
We checked label_hnd != NULL, but then we apparently called
avc_netlink_check_nb(), which reset label_hnd. Yay for global state!
№4 0x00007fb5f1549950 in symlink_atomic_label (from=0x55f6169d8b50 "
69a8dcf7a7ac46b29306f2fddbed3edc", to=0x55f616ab8380 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service") at ../src/basic/label.c:55
r = <optimized out>
__PRETTY_FUNCTION__ = "symlink_atomic_label"
In the logs:
Mar 29 14:48:44 fedorapad.home systemd[1974]: selinux: avc: received policyload notice (seqno=2)
Mar 29 14:48:44 fedorapad.home systemd[1974]: Failed to initialize SELinux labeling handle: No such file or directory
Mar 29 14:48:44 fedorapad.home systemd[1974]: selinux: avc: received policyload notice (seqno=3)
Mar 29 14:48:44 fedorapad.home systemd[1974]: selinux: avc: received setenforce notice (enforcing=0)
Anita Zhang [Tue, 23 Mar 2021 07:49:28 +0000 (00:49 -0700)]
process-util: don't allocate max length to read /proc/PID/cmdline
Alternative title: Replace get_process_cmdline()'s fopen()/fread() with
read_full_virtual_file().
When RLIMIT_STACK is set to infinity:infinity, _SC_ARG_MAX will
return
4611686018427387903 (depending on the system, but definitely
something larger than most systems have). It's impractical to allocate this
in one go when most cmdlines are much shorter than that.
Instead use read_full_virtual_file() which seems to increase the buffer
depending on the size of the contents.
(cherry picked from commit
7b7a060e83d6c7de8705904d71978ba4664f0a65)
(cherry picked from commit
fca334fb072545e2db8a81a51f8d1ab343fb610f)
Lincoln Ramsay [Wed, 24 Mar 2021 07:37:25 +0000 (17:37 +1000)]
pid1: do not use generated strings as format strings (#19098)
The generated string may include %, which will confuse both the
xprintf call, and the VA_FORMAT_ADVANCE macro.
Pass the generated string as an argument to a "%s" format string
instead.
(cherry picked from commit
7325a2b2d15af09a9389723d6153050130c0bd36)
(cherry picked from commit
0d4ba1519552761baeb4b464fad8854b24497193)
hide [Tue, 23 Mar 2021 16:05:25 +0000 (01:05 +0900)]
network: fix ipv6 tunnel encapsulation limit (#19087)
The encapsulation limit of IPv6 tunnel can not be set to 4, which is the default value of the encapsulation limit.
(cherry picked from commit
6b1ed5e7e68fc5992a7bdabe4a05a7a3e1e1d898)
(cherry picked from commit
5678859dfd2eb1d018a0f5d468131367d152bbe2)
Lennart Poettering [Tue, 23 Mar 2021 13:04:59 +0000 (14:04 +0100)]
blockdev-util: actually specify an access mode on open()
Linux is pretty lenient here, but we should specify the access mode.
(cherry picked from commit
86b86107942e84de4eb22944251694c0ae21b3ee)
(cherry picked from commit
857533a523d058e9833a553f6ef192ff1ab33b15)
Zbigniew Jędrzejewski-Szmek [Wed, 24 Mar 2021 10:10:17 +0000 (11:10 +0100)]
Revert "resolved: gracefully handle with packets with too large RR count"
This reverts commit
fdfffdaf20a18a50c9a6d858359cf4af6d2f4c8b.
There are multiple reports that this breaks lookups for people, and reverting
this commit, even on the main branch (approx. v248-rc4), fixes the issue.
https://github.com/systemd/systemd/issues/18917#issuecomment-
799421587
https://bodhi.fedoraproject.org/updates/FEDORA-2021-
1c1a870ceb
(cherry picked from commit
7e88a9aef6e6385b0f5889bfc412e03540806085)
David Tardon [Fri, 19 Mar 2021 09:05:47 +0000 (10:05 +0100)]
man: document differences in clean exit status for Type=oneshot
See commit
1f0958f640b87175cd547c1e69084cfe54a22e9d .
(cherry picked from commit
f055cf77862bc580f3afbfaac161d1c060f39411)
(cherry picked from commit
c86f4f5f287258938d0c30354040c3b034b0c066)
Zbigniew Jędrzejewski-Szmek [Mon, 22 Mar 2021 11:51:47 +0000 (12:51 +0100)]
shared/calendarspec: when mktime() moves us backwards, jump forward
When trying to calculate the next firing of 'Sun *-*-* 01:00:00', we'd fall
into an infinite loop, because mktime() moves us "backwards":
Before this patch:
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
...
We rely on mktime() normalizing the time. The man page does not say that it'll
move the time forward, but our algorithm relies on this. So let's catch this
case explicitly.
With this patch:
$ TZ=Europe/Dublin faketime 2021-03-21 build/systemd-analyze calendar --iterations=5 'Sun *-*-* 01:00:00'
Normalized form: Sun *-*-* 01:00:00
Next elapse: Sun 2021-03-21 01:00:00 GMT
(in UTC): Sun 2021-03-21 01:00:00 UTC
From now: 59min left
Iter. #2: Sun 2021-04-04 01:00:00 IST
(in UTC): Sun 2021-04-04 00:00:00 UTC
From now: 1 weeks 6 days left <---- note the 2 week jump here
Iter. #3: Sun 2021-04-11 01:00:00 IST
(in UTC): Sun 2021-04-11 00:00:00 UTC
From now: 2 weeks 6 days left
Iter. #4: Sun 2021-04-18 01:00:00 IST
(in UTC): Sun 2021-04-18 00:00:00 UTC
From now: 3 weeks 6 days left
Iter. #5: Sun 2021-04-25 01:00:00 IST
(in UTC): Sun 2021-04-25 00:00:00 UTC
From now: 1 months 4 days left
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
1941335.
(cherry picked from commit
129cb6e249bef30dc33e08f98f0b27a6de976f6f)
(cherry picked from commit
e5cf86ff98a21b427e1439a001d8e6b81c07b19c)
Zbigniew Jędrzejewski-Szmek [Sun, 21 Mar 2021 19:59:32 +0000 (20:59 +0100)]
shared/calendarspec: abort calculation after 1000 iterations
We have a bug where we seem to enter an infinite loop when running in the
Europe/Dublin timezone. The timezone is "special" because it has negative SAVE
values. The handling of this should obviously be fixed, but let's use a
belt-and-suspenders approach, and gracefully fail if we fail to find an answer
within a specific number of attempts. The code in this function is rather
complex, and it's hard to rule out another bug in the future.
(cherry picked from commit
169615c9a8cdc54d748d4dfc8279be9b3c2bec44)
(cherry picked from commit
f14b80e09e225ccf7cfd8a85578b7e64c3fdebb9)
Lennart Poettering [Mon, 22 Mar 2021 17:27:36 +0000 (18:27 +0100)]
resolved: propagate correct error variable
(cherry picked from commit
4cba52cc7a2191d0b38e605801c60d8648bc67e2)
(cherry picked from commit
78415ea9f7de25fc883af980e91fbffadd5a38b5)
Sergey Bugaev [Mon, 22 Mar 2021 15:31:12 +0000 (18:31 +0300)]
log: protect errno in log_open()
Commit
0b1f3c768ce1bd1490a5e53f539976dcef8ca765 has introduced log_open()
calls after exec fails post-fork. However, the log_open() call itself could
change the value of errno, which, for me, manifested in:
$ coredumpctl gdb
...
Failed to invoke gdb: Success
Fix this by using PROTECT_ERRNO in log_open().
(cherry picked from commit
0e557eef37c9ebcc8f5c19fc6fc44b6fd617cc5d)
(cherry picked from commit
dabf9f2109e5b8cc26d9e0d9188deebff3edf8c2)
Yu Watanabe [Fri, 19 Mar 2021 13:16:22 +0000 (22:16 +0900)]
shell-completion: systemd-run: add missing options
Closes #19044.
(cherry picked from commit
c23bb96b388f371e44c4f1756801dec2b4e72307)
(cherry picked from commit
e60fe377e449f402b61237d6476cde6dadd2e03f)
I'm not sure if all options listed in this patch are already there in v246… But
at least --slice-inherit which was originally requested in #19044 is here.
Worst case, users will get completion to some options which are not there yet.
Antonio Terceiro [Sun, 21 Mar 2021 14:37:51 +0000 (11:37 -0300)]
logs-show: add missing newline in warning message
(cherry picked from commit
17e90001643d07a7353ba88417e12be2ff0fa042)
(cherry picked from commit
012d36ed985dc140b46208fff303a75ecf87d1d4)
Lennart Poettering [Fri, 19 Mar 2021 10:14:52 +0000 (11:14 +0100)]
blockdev-util: fix access to possibly invalidated dirent struct
Let's copy out the string we need from the dirent, there's no reason to
believe the dirent struct might live for longer than one loop iteration.
(cherry picked from commit
c68fc3514ddd53abd7ecfd22afb07aa0ad785c5c)
(cherry picked from commit
928ab001fb77fea95ee833fe27e1913f043587ff)
Lennart Poettering [Fri, 19 Mar 2021 09:36:48 +0000 (10:36 +0100)]
repart: make sure to grow partition table after growing backing loopback file
This fixes the --size= switch, i.e. where we grow a disk image: after
growing it we need to expand the partition table so that its idea of the
the medium size matches the new reality. Otherwise our disk size
calculations in the subsequent steps might still use the original
ungrown size.
(This used to work, I guess this was borked when libfdisk learnt the
concept of "minimized" partition tables)
(cherry picked from commit
f9b3afae96c72564cd4cd766555845f17e3c12a9)
(cherry picked from commit
b132bca9f6dc6ed4965c0ac48bac90e9fc443a9e)
Sam Lunt [Thu, 18 Mar 2021 19:50:30 +0000 (14:50 -0500)]
Wrong index in error message
(cherry picked from commit
6f50c94dfda7c5bd31b364a40038c3d68d1e56ab)
(cherry picked from commit
85e45e8722cd2732c4a26f535ddc6472dd1fb0a6)
Mike Gilbert [Tue, 9 Mar 2021 22:57:37 +0000 (17:57 -0500)]
cg_unified_cached: return ENOMEDIUM if we cannot find a known hierarchy
When the test suite is being run in a foreign environment,
/sys/fs/cgroup might not be set up in a way that we recognize.
Returning ENOMEDIUM causes the tests to be skipped in this case.
Bug: https://bugs.gentoo.org/771819
(cherry picked from commit
2156061fb33811aedb160d1b476793a5b845b143)
(cherry picked from commit
84ed68f5f0c393db3824dbbb2bc2118cf6e03722)
Lennart Poettering [Tue, 16 Mar 2021 15:09:47 +0000 (16:09 +0100)]
journald: restore syslog priority *with* facility bits for stream connections when restarting journald
Fixes: #19019
(cherry picked from commit
d977ef2542accd3e10a7540b3a8b6d1278cc0041)
(cherry picked from commit
b55a7dd551d332440615d5efb07d6620ba4ffb1d)
Yu Watanabe [Sat, 13 Mar 2021 10:56:30 +0000 (19:56 +0900)]
man: DNS/NTP servers received from DHCP server are concatenated with the statically configured ones
Prompted by #9473.
(cherry picked from commit
b63dae3168209a06cefe2b9916667b7754b7de34)
(cherry picked from commit
438777cc00ccf2c05f8a05fa02907aa7be547719)
Kevin Backhouse [Fri, 12 Mar 2021 17:00:56 +0000 (18:00 +0100)]
ask-password-api: fix error handling on invalid unicode character
The integer overflow happens when utf8_encoded_valid_unichar() returns an error
code. The error code is a negative number: -22. This overflows when it is
assigned to `z` (type `size_t`). This can cause an infinite loop if the value
of `q` is 22 or larger.
To reproduce the bug, you need to run `systemd-ask-password` and enter an
invalid unicode character, followed by a backspace character.
GHSL-2021-052
(cherry picked from commit
37ca78a35cd1b9f13e584ccf3d332413c7875e40)
(cherry picked from commit
069525e84a67375e27429cb490e8d28af78e673a)
Zbigniew Jędrzejewski-Szmek [Mon, 1 Mar 2021 22:10:06 +0000 (23:10 +0100)]
resolved: disable event sources before unreffing them
We generally operate on the assumption that a source is "gone" as soon
as we unref it. This is generally true because we have the only reference.
But if something else holds the reference, our unref doesn't really stop
the source and it could fire again.
In particular, on_query_timeout() is called with DnsQuery* as userdata, and
it calls dns_query_stop() which invalidates that pointer. If it was ever
called again, we'd be accessing already-freed memory.
I don't see what would hold the reference. sd-event takes a temporary reference,
but on the sd_event object, not on the individual sources. And our sources
are non-floating, so there is no reference from the sd_event object to the
sources.
For #18427.
(cherry picked from commit
97935302283729c9206b84f5e00b1aff0f78ad19)
(cherry picked from commit
78a43c33c8847ebbc2d3cf530ebe304924c58b32)
Frantisek Sumsal [Mon, 8 Feb 2021 10:26:26 +0000 (11:26 +0100)]
tree-wide: fix the string concatenation warning with clang-12
e.g.:
./src/shared/dissect-image.c:2218:39: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
"/usr/lib/os-release\0",
^
../src/shared/dissect-image.c:2217:39: note: place parentheses around the string literal to silence warning
[META_OS_RELEASE] = "/etc/os-release\0"
^
1 error generated.
See: https://reviews.llvm.org/D85545
(cherry picked from commit
8762049792024df1be9f0b219438220bb9ee547d)
(cherry picked from commit
6345ef607976ce0311d01a38ee30855f5416ff1f)
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 09:17:23 +0000 (10:17 +0100)]
Revert "udev: do not execute hwdb builtin import twice or thrice"
This reverts commit
876c75fe870846b09b54423a6b719d80bc879b27.
The patch seems to cause usb devices to get some attributes set from the parent
PCI device. 'hwdb' builtin has support for breaking iteration upwards on usb
devices. But when '--subsystem=foo' is specified, iteration is continued. I'm
sure it *could* be figured out, but it seems hard to get all the combinations
correct. So let's revert to functional status quo ante, even if does the lookup
more than once unnecessarily.
Fixes #18125.
(cherry picked from commit
451ba55fecd8b494add2001b3ca3c1915c8fd655)
(cherry picked from commit
f69a0fd38938b20e0b390f7876f8474daa66a100)
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 19:49:53 +0000 (20:49 +0100)]
timedated: fix skipping of comments in config file
Reading file '/usr/lib/systemd/ntp-units.d/80-systemd-timesync.list'
Failed to add NTP service "# This file is part of systemd.", ignoring: Invalid argument
Failed to add NTP service "# See systemd-timedated.service(8) for more information.", ignoring: Invalid argument
:(
(cherry picked from commit
03a81441b1a490f8fc2a19aeb9b23299657c380c)
(cherry picked from commit
279c24e155df495164b68905bfe6340b5de1c797)
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 10:37:17 +0000 (11:37 +0100)]
homed: disable event sources before unreffing them
C.f.
9793530228.
We'd crash when trying to access an already-deallocated object:
Thread no. 1 (7 frames)
#2 log_assert_failed_realm at ../src/basic/log.c:844
#3 event_inotify_data_drop at ../src/libsystemd/sd-event/sd-event.c:3035
#4 source_dispatch at ../src/libsystemd/sd-event/sd-event.c:3250
#5 sd_event_dispatch at ../src/libsystemd/sd-event/sd-event.c:3631
#6 sd_event_run at ../src/libsystemd/sd-event/sd-event.c:3689
#7 sd_event_loop at ../src/libsystemd/sd-event/sd-event.c:3711
#8 run at ../src/home/homed.c:47
The source in question is an inotify source, and the messages are:
systemd-homed[1340]: /home/ moved or renamed, recreating watch and rescanning.
systemd-homed[1340]: Assertion '*_head == _item' failed at src/libsystemd/sd-event/sd-event.c:3035, function event_inotify_data_drop(). Aborting.
on_home_inotify() got called, then manager_watch_home(), which unrefs the
existing inotify_event_source. I assume that the source gets dispatched again
because it was still in the pending queue.
I can't reproduce the issue (timing?), but this should
fix #17824, https://bugzilla.redhat.com/show_bug.cgi?id=
1899264.
(cherry picked from commit
cf5366387b24633284ee92285ea64a282270d591)
(cherry picked from commit
668554d9dbfa9f240dd18455a52c68f3f48bdb81)
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 10:28:19 +0000 (11:28 +0100)]
homed: wrap some very long lines
(cherry picked from commit
23d24b76f3df765fa6dbe7fe815bd4f8e76c9bb5)
(cherry picked from commit
2bfdf842f4a4b7faa5927d4eefeb46729ef6e696)
Yu Watanabe [Sat, 6 Mar 2021 15:05:03 +0000 (00:05 +0900)]
dissect: fix memleak
Fixes #18903.
(cherry picked from commit
f91861e49fea01c98ad0e1131b9141830c029f28)
(cherry picked from commit
dcb5d6f92990104c67dda409fc836c47c8be1e1f)
Zbigniew Jędrzejewski-Szmek [Fri, 5 Mar 2021 14:16:18 +0000 (15:16 +0100)]
sd-bus: fix memleak in failure path in bus_match_parse()
(cherry picked from commit
8df3f44c90a3e479b717e8cc4bb26c95ebbc5cb0)
(cherry picked from commit
3a383fed01e275b05955e6b2e2626363816cdd62)
Zbigniew Jędrzejewski-Szmek [Thu, 4 Mar 2021 20:19:02 +0000 (21:19 +0100)]
sd-bus: fix memstream buffer extraction
I'm getting the following error under valgrind:
==305970== Invalid free() / delete / delete[] / realloc()
==305970== at 0x483E9F1: free (vg_replace_malloc.c:538)
==305970== by 0x4012CD: mfree (alloc-util.h:48)
==305970== by 0x4012EF: freep (alloc-util.h:83)
==305970== by 0x4017F4: LLVMFuzzerTestOneInput (fuzz-bus-match.c:58)
==305970== by 0x401A58: main (fuzz-main.c:39)
==305970== Address 0x59972f0 is 0 bytes inside a block of size 8,192 free'd
==305970== at 0x483FCE4: realloc (vg_replace_malloc.c:834)
==305970== by 0x4C986F7: _IO_mem_finish (in /usr/lib64/libc-2.33.so)
==305970== by 0x4C8F5E0: fclose@@GLIBC_2.2.5 (in /usr/lib64/libc-2.33.so)
==305970== by 0x49D2CDB: fclose_nointr (fd-util.c:108)
==305970== by 0x49D2D3D: safe_fclose (fd-util.c:124)
==305970== by 0x4A4BCCC: fclosep (fd-util.h:41)
==305970== by 0x4A4E00F: bus_match_to_string (bus-match.c:859)
==305970== by 0x4016C2: LLVMFuzzerTestOneInput (fuzz-bus-match.c:58)
==305970== by 0x401A58: main (fuzz-main.c:39)
==305970== Block was alloc'd at
==305970== at 0x483FAE5: calloc (vg_replace_malloc.c:760)
==305970== by 0x4C98787: open_memstream (in /usr/lib64/libc-2.33.so)
==305970== by 0x49D56D6: open_memstream_unlocked (fileio.c:97)
==305970== by 0x4A4DEC5: bus_match_to_string (bus-match.c:859)
==305970== by 0x4016C2: LLVMFuzzerTestOneInput (fuzz-bus-match.c:58)
==305970== by 0x401A58: main (fuzz-main.c:39)
==305970==
So the fclose() which is called from _cleanup_fclose_ clearly reallocates the
buffer (maybe to save memory?). open_memstream(3) says:
The locations referred to by these pointers are updated each time the
stream is flushed (fflush(3)) and when the stream is closed (fclose(3)).
This seems to mean that we should close the stream first before grabbing the
buffer pointer.
(cherry picked from commit
5963e6f43c4f33d5255ef0fb887cdf382bd51c9e)
(cherry picked from commit
f8fd75183bcf9cd6b55c3f8e752863d0083ed772)
caoxia [Thu, 28 Jan 2021 12:50:08 +0000 (20:50 +0800)]
trans_time sec is int32,it will overflow if local system time is later than 2038.
(cherry picked from commit
370d3c31b4637d1b2faeec555da3283e49a6744f)
(cherry picked from commit
02e9679cceeaa8f2fd7a9f2370f222be969ea1da)
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 23:36:24 +0000 (00:36 +0100)]
core: fix mtime calculation of dropin files
Nominally, the bug was in unit_load_dropin(), which just took the last mtime
instead of calculating the maximum. But instead of adding code to wrap the
loop, this patch goes in the other direction.
All (correct) callers of config_parse() followed a very similar pattern to
calculate the maximum mtime. So let's simplify things by making config_parse()
assume that mtime is initialized and update it to the maximum. This makes all
the callers that care about mtime simpler and also fixes the issue in
unit_load_dropin().
config_parse_many_nulstr() and config_parse_many() are different, because it
makes sense to call them just once, and current ret_mtime behaviour make sense.
Fixes #17730, https://bugzilla.redhat.com/show_bug.cgi?id=
1933137.
(cherry picked from commit
da46a1bc3cd28ac36114002c216196dae004b05c)
(cherry picked from commit
b29181eaa50a0fd9cefc4bcfbd0e6949038b65c9)
Martin Wilck [Thu, 25 Feb 2021 16:09:03 +0000 (17:09 +0100)]
sd-device: don't use BPF filtering for kernel monitors
BPF filtering accesses fields in the netlink header that are
only filled in by libudev, never by the kernel. Therefore adding
BPF filters for kernel monitors is pointless. Even false filtering
of kernel events might be possible; at least it's hard to prove that
it can't occur.
(cherry picked from commit
d8ce385fe3e5be91b6f414415e10f8897e41d942)
(cherry picked from commit
8f67d7ba3af72b1b3750530c123702246f35987f)
Lennart Poettering [Thu, 25 Feb 2021 14:04:25 +0000 (15:04 +0100)]
udev: when btrfs.ko is not available consider btrfs filesystems not ready
Let's add a special tweak to the btrfs builtin: if /dev/btrfs-control is
not there, let's consider all btrfs file systems as SYSTEMD_READY=0.
This is useful in initrds, where btrfs.ko might be missing. After the
initrd → host transition we can then retigger the device and undo the
SYSTEMD_READY=0 marking.
(cherry picked from commit
97e535c7248cc0457395e2d62b6e7d6c342a0bd2)
(cherry picked from commit
3f94149a9bdf7267453f614aa85f1735913d91a2)
Lennart Poettering [Wed, 24 Feb 2021 16:49:32 +0000 (17:49 +0100)]
cgroup: don't generate BPF firewall unsupported warning on wrong unit
Let's generate the warning on a unit that actually needs the BPF
firewall, and not confusingly already for a sibling of one.
(cherry picked from commit
a437c5e4da666d16f15649461ce45e0e6d735148)
(cherry picked from commit
6349fb59858618bf9b92e4abb77dc4027b2fd35f)
Yu Watanabe [Wed, 24 Feb 2021 04:16:15 +0000 (13:16 +0900)]
timedate: do not ignore fix_system argument in SetLocalRTC method
Fixes #18391.
(cherry picked from commit
2be6c4758e3c27a3f502735881a355e5bfae97b0)
(cherry picked from commit
9b9627b8bc276ea1c1b388dbebec4b907726a86a)
Lennart Poettering [Tue, 23 Feb 2021 14:02:33 +0000 (15:02 +0100)]
bootspec: assume that the root dir is at the top of its file system
Fixes: #17746
(cherry picked from commit
eceb61112c8ece03adfb4fcbc83e357875ca0ceb)
(cherry picked from commit
5c978c4371cbd2550f742b9f72be655020300c9d)
Lennart Poettering [Tue, 23 Feb 2021 13:16:08 +0000 (14:16 +0100)]
efi stub: accept it if our loaded image has no FilePath field set
The firmware spec doesn't really say whether FilePath of the LoadedImage
protocol may be NULL or not. So far we assumed it to be non-NULL, but
apparently the FreeBSD UEFI chainloader sets it to NULL. Handle this
gracefully.
(Noticed and tracked down by Alexander Schreiber)
Fixes: #18733
(cherry picked from commit
685097b9cadf92d21dfa857c3a7ddc1ba115088e)
(cherry picked from commit
151c62b5bcb7124ec43fbd7e21872974e1d9e500)
Lennart Poettering [Mon, 22 Feb 2021 16:38:02 +0000 (17:38 +0100)]
cryptsetup: unescape ID_PART_ENTRY_NAME udev property before using it
Fixes: #18729
(cherry picked from commit
fadd34dd5af9a26edf2906b237ac212169d39f0c)
(cherry picked from commit
01459676644e7d358176963d58a6f8022eaf1ff5)
Zbigniew Jędrzejewski-Szmek [Fri, 19 Feb 2021 18:02:38 +0000 (19:02 +0100)]
sysctl.d: silence warning if net.core.default_qdisc cannot be set
Kernels can be compiled without the attribute. It's fine if this is not
set, so silence the warning.
(cherry picked from commit
fa98c99ea7f7c5bec3962fa52f4d3496a9777024)
(cherry picked from commit
46c271feee9d660e79f93ae8ffc29955ebd8c61f)
Zbigniew Jędrzejewski-Szmek [Fri, 19 Feb 2021 08:50:09 +0000 (09:50 +0100)]
xdg-autostart-generator: ignore DBusActivatable=true
See https://wiki.gnome.org/HowDoI/DBusApplicationLaunching and
https://wiki.gnome.org/Initiatives/GnomeGoals/DBusActivatable for a description
of this key:
> Instead of the typical UNIX-style fork()/exec() approach to process creation,
> launching an application is done by sending a D-Bus message to the well-known
> name of that application, causing a D-Bus activation.
>
> Starting processes with D-Bus activation ensures that each application gets
> started in its own pristine environment, as a direct descendent of the
> session -- not in the environment of whatever its parent happened to be. This
> is important for ensuring the app ends up in the correct cgroup, for example.
So this motivation is not important for us: we launch stuff ourselves better.
This fixes warnings during boot:
systemd-xdg-autostart-generator[2274]: /etc/xdg/autostart/org.freedesktop.problems.applet.desktop:92: Unknown key name 'DBusActivatable' in section 'Desktop Entry', ignoring.
(cherry picked from commit
36290e0b97ba032cbd71723f2255917924eadc05)
(cherry picked from commit
8e444ad2e2b9c1940bf54dceb2ac74c909abd286)
Zbigniew Jędrzejewski-Szmek [Fri, 19 Feb 2021 08:47:32 +0000 (09:47 +0100)]
xdg-autostart-generator: reindent
(cherry picked from commit
9f11f565556410f9484db9e4991f6c04eeafffc7)
(cherry picked from commit
8479eb96c1d6c3039acb4e986cb59ef283aa67e9)
Zbigniew Jędrzejewski-Szmek [Thu, 18 Feb 2021 09:48:08 +0000 (10:48 +0100)]
rfkill: use short writes and accept long reads
I'm seeing the following with kernel-core-5.10.16-200.fc33.x86_64:
$ sudo SYSTEMD_LOG_LEVEL=debug build/systemd-rfkill
Reading struct rfkill_event: got 8 bytes.
A new rfkill device has been added with index 0 and type bluetooth.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
rfkill0: Operating on rfkill device 'tpacpi_bluetooth_sw'.
Writing struct rfkill_event successful (8 of 9 bytes).
Loaded state '0' from /var/lib/systemd/rfkill/platform-thinkpad_acpi:bluetooth.
Reading struct rfkill_event: got 8 bytes.
A new rfkill device has been added with index 1 and type wwan.
rfkill1: Operating on rfkill device 'tpacpi_wwan_sw'.
Writing struct rfkill_event successful (8 of 9 bytes).
Loaded state '0' from /var/lib/systemd/rfkill/platform-thinkpad_acpi:wwan.
Reading struct rfkill_event: got 8 bytes.
A new rfkill device has been added with index 2 and type bluetooth.
rfkill2: Operating on rfkill device 'hci0'.
Writing struct rfkill_event successful (8 of 9 bytes).
Loaded state '0' from /var/lib/systemd/rfkill/pci-0000:00:14.0-usb-0:7:1.0:bluetooth.
Reading struct rfkill_event: got 8 bytes.
A new rfkill device has been added with index 3 and type wlan.
rfkill3: Operating on rfkill device 'phy0'.
Writing struct rfkill_event successful (8 of 9 bytes).
Loaded state '0' from /var/lib/systemd/rfkill/pci-0000:04:00.0:wlan.
All events read and idle, exiting.
We were expecting a read of exactly RFKILL_EVENT_SIZE_V1==8 bytes. But the
structure has 9 after [1].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=
14486c82612a177cb910980c70ba900827ca0894
For some reason the kernel does not accept the full structure size, but cuts
the write short after 8 bytes:
static ssize_t rfkill_fop_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
{
struct rfkill_event ev;
/* we don't need the 'hard' variable but accept it */
if (count < RFKILL_EVENT_SIZE_V1 - 1)
return -EINVAL;
/*
* Copy as much data as we can accept into our 'ev' buffer,
* but tell userspace how much we've copied so it can determine
* our API version even in a write() call, if it cares.
*/
count = min(count, sizeof(ev));
if (copy_from_user(&ev, buf, count))
return -EFAULT;
... so it should accept the full size. I'm not sure what is going on here.
But we don't care about the extra fields, so let's accept a write as long as
it's at least RFKILL_EVENT_SIZE_V1.
Fixes #18677.
(cherry picked from commit
a71c09685021cbcecb7566a00342421f635cc002)
(cherry picked from commit
310c58b1db09ed20bbb284f8b7f5fac5a169f16f)
Zbigniew Jędrzejewski-Szmek [Thu, 18 Feb 2021 09:40:16 +0000 (10:40 +0100)]
rfkill: improve error logging
If we get something of unexpected size, log the sizes. Also, don't log twice.
(cherry picked from commit
6c7afdeab010025c80508effd2b0039bc5181b82)
(cherry picked from commit
c0e60c3079efa8d1d24ab83966b30da90d3d2ae0)
Lennart Poettering [Wed, 17 Feb 2021 22:11:42 +0000 (23:11 +0100)]
journald: when we fail to add a new entry to a journal, return the seqno
Fixes: #18005
(cherry picked from commit
0eaee8281d4699903b8b2cce18c836d4a144aee3)
(cherry picked from commit
06cd0295b94a23ed879697752d85339f815a7788)
Richard Laager [Thu, 18 Feb 2021 07:11:53 +0000 (01:11 -0600)]
Remove outdated disable_ipv6 docs
This was changed in commit
482efedc081b0c4bf2e77a3dee6b979d9c9a5765,
which was released in v243, to only enable and never disable IPv6.
Signed-off-by: Richard Laager <rlaager@wiktel.com>
(cherry picked from commit
f542f3b2ed3cf3e71692d1736f3fdd0ebdc226ef)
(cherry picked from commit
807d6dd157e67648dfb7ad8f8ff85a0b0a3db829)
Vito Caputo [Sun, 29 Nov 2020 00:28:08 +0000 (16:28 -0800)]
journal-file: fix archiving offline journals
The existing set_offline() short-circuit erroneously included
when f->archive was true and header->state was STATE_OFFLINE.
This commit makes the short-circuit f->archive aware, so it will
only catch scenarios where there's not an offlining in progress
and the header state matches the target state of either archived
or offline.
Fixes https://github.com/systemd/systemd/issues/17770
(cherry picked from commit
bb1296b55a222cbab24d533006e730529009258c)
(cherry picked from commit
50e6c3b2e547aa29d1c5e160f9e5aa4dc9e07168)
Luca Boccassi [Mon, 18 Jan 2021 20:15:03 +0000 (20:15 +0000)]
stat-util: fix dir_is_empty_at without path
Use the right FD, and do a fd_reopen instead of a dup, since the
latter will still share the internal pointer which then gets
moved by FOREACH_DIRENT, affecting the caller's FD.
(cherry picked from commit
b8f762f2fe59c94323c95d2aadea68612dca2b04)
(cherry picked from commit
67e03400e881929ca0c940a4a51e76d3c68b6c29)