]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agoshared/calendarspec: when mktime() moves us backwards, jump forward 19075/head
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.

4 years agotest-calendarspec: do not convert timezone "" to ":"
Zbigniew Jędrzejewski-Szmek [Mon, 22 Mar 2021 10:29:35 +0000 (11:29 +0100)] 
test-calendarspec: do not convert timezone "" to ":"

I *think* it doesn't actually make any difference, because ":" will be ignored.
437f48a471f51ac9dd2697ee3b848a71b4f101df added prefixing with ":", but didn't
take into account the fact that we also use "" with a different meaning than
NULL here. But let's restore the original behaviour of specifying the empty
string.

4 years agotest-calendarspec: print offending line in output
Zbigniew Jędrzejewski-Szmek [Mon, 22 Mar 2021 10:10:22 +0000 (11:10 +0100)] 
test-calendarspec: print offending line in output

The output is rather long at this makes it easier to jump to the right place.
Also use normal output routines and set_unset_env() to make things more
compact.

4 years agoshared/calendarspec: constify parameter and simplify assignments to variable
Zbigniew Jędrzejewski-Szmek [Mon, 22 Mar 2021 08:20:47 +0000 (09:20 +0100)] 
shared/calendarspec: constify parameter and simplify assignments to variable

The scope of start & stop is narrowed down, and they are assigned only once.
No functional change, but I think the code is easier to read this way.
Also add a comment to make the code easier to read.

4 years agoshared/calendarspec: abort calculation after 1000 iterations
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.

4 years agoUpdate resolvectl.xml
ulf-f [Thu, 11 Mar 2021 18:18:14 +0000 (19:18 +0100)] 
Update resolvectl.xml

fixed typo of filename

4 years agoRevert "sd-event: re-check new epoll events when a child event is queued"
Frantisek Sumsal [Thu, 11 Mar 2021 16:25:55 +0000 (17:25 +0100)] 
Revert "sd-event: re-check new epoll events when a child event is queued"

This reverts commit 84e998c112ff18bba786660bd6c1f96f62a77ffe.

Temporarily revert this commit, since it breaks CI.

4 years agoMerge pull request #18922 from yuwata/sd-event-fix-issue-18190
Lennart Poettering [Thu, 11 Mar 2021 15:36:38 +0000 (16:36 +0100)] 
Merge pull request #18922 from yuwata/sd-event-fix-issue-18190

sd-event: re-check new epoll events when a child event is queued

4 years agosd-event: re-check new epoll events when a child event is queued 18922/head
Yu Watanabe [Mon, 8 Mar 2021 06:39:53 +0000 (15:39 +0900)] 
sd-event: re-check new epoll events when a child event is queued

Previously, when a process outputs something and exit just after
epoll_wait() but before process_child(), then the IO event is ignored
even if the IO event has higher priority. See #18190.

This can be solved by checking epoll event again after process_child().

However, there exists a possibility that another process outputs and
exits just after process_child() but before the second epoll_wait().
When the IO event has lower priority than the child event, still IO
event is processed.

So, this makes new epoll events and child events are checked in a loop
until no new event is detected. To prevent an infinite loop, the number
of maximum trial is set to 10.

Fixes #18190.

4 years agotest: add log messages
Yu Watanabe [Thu, 11 Mar 2021 05:19:50 +0000 (14:19 +0900)] 
test: add log messages

4 years agoNEWS: update contributors list for v248-rc3 v248-rc3
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 11:54:36 +0000 (12:54 +0100)] 
NEWS: update contributors list for v248-rc3

4 years agoMerge pull request #18915 from keszybz/reexec-bug
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 13:46:16 +0000 (14:46 +0100)] 
Merge pull request #18915 from keszybz/reexec-bug

Fix crash during daemon-reexec with systemd-oomd running

4 years agoMerge pull request #18955 from keszybz/fstab-escaping
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 13:45:11 +0000 (14:45 +0100)] 
Merge pull request #18955 from keszybz/fstab-escaping

Fix handling of escaped characters in fstab

4 years agobasic/group-util: optimize alloca use
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 09:00:04 +0000 (10:00 +0100)] 
basic/group-util: optimize alloca use

Follow-up for 0fa7b50053.

4 years agodocs: more markup
Zbigniew Jędrzejewski-Szmek [Tue, 9 Mar 2021 17:41:21 +0000 (18:41 +0100)] 
docs: more markup

4 years agorepart: fix the loop dev support check
Frantisek Sumsal [Thu, 11 Mar 2021 11:49:00 +0000 (12:49 +0100)] 
repart: fix the loop dev support check

Since f17bdf8264e231fa31c769bff2475ef698487d0b the test-repart was
effectively disabled, since `/dev/loop-control` is a character special
file, whereas `-f` works only on regular files. Even though we could use
`-c` to check specifically for character special files, let's use `-e`
just in case.

4 years agoMerge pull request #18962 from poettering/dissect-fixes
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 13:42:17 +0000 (14:42 +0100)] 
Merge pull request #18962 from poettering/dissect-fixes

three image dissection fixes

4 years agoinstall: refactor find_symlinks() and don't search for symlinks recursively
Michal Sekletar [Tue, 9 Mar 2021 16:22:32 +0000 (17:22 +0100)] 
install: refactor find_symlinks() and don't search for symlinks recursively

After all we are only interested in symlinks either in top-level config
directory or in .wants and .requires sub-directories.

As a bonus this should speed up ListUnitFiles() roughly 3-4x on systems
with a lot of units that use drop-ins (e.g. SSH jump hosts with a lot of
user session scopes).

4 years agoman: shorten list of partition types a bit
Lennart Poettering [Thu, 11 Mar 2021 09:00:17 +0000 (10:00 +0100)] 
man: shorten list of partition types a bit

Tables with only one column aren't really tables, they are lists. And if
each cell only consists of a single word, they are probably better
written in a single line. Hence, shorten the man page a bit, and list
boot loader spec partition types in a simple sentence.

Also, drop "root-secondary" from the list. When dissecting images we'll
upgrade "root-secondary" to "root" if we mount it, and do so only if
"root" doesn't exist. Hence never mention "root-secondary" as we never
will mount a partition under that id.

4 years agodissect: fix trivial typo 18962/head
Lennart Poettering [Tue, 9 Mar 2021 21:01:41 +0000 (22:01 +0100)] 
dissect: fix trivial typo

4 years agodissect-image: fix volatile images
Lennart Poettering [Thu, 11 Mar 2021 10:44:03 +0000 (11:44 +0100)] 
dissect-image: fix volatile images

This makes sure nspawn's --volatile=yes switch works again: there we
have a read-only image that is overmounted by a tmpfs (with the
exception of /usr). This we need to mkdir all mount points even though
the image is read-only.

Hence, let's drop the optimizatio of avoiding mkdir() on images that are
read-only, it's wrong and misleading here, since the image itself might
be read-only but our mounts are not.

4 years agodissect-image: clean up meaning of DISSECT_IMAGE_MKDIR
Lennart Poettering [Tue, 9 Mar 2021 21:03:00 +0000 (22:03 +0100)] 
dissect-image: clean up meaning of DISSECT_IMAGE_MKDIR

Previously handling of DISSECT_IMAGE_MKDIR was pretty weird and broken:
it would control both if we create the top-level mount point when
mounting an image, and the inner mount points for images that consist of
multiple file systems. However, the latter is redundant, since
1f0f82f1311e4c52152b8e2b6f266258709c137d does this too, a few lines
further up – unconditionally!

Hence, let's make the meaning of DISSECT_IMAGE_MKDIR more strict: it
shall be only about the top-level mount point, not about the inner ones
(where we'll continue to create what is missing alwayway). Having a
separate flag for the top-level mount point is relevant, since the mount
point dir created by it will remain on the host fs – unlike the
directories we create inside the image, which will stay within the
image.

This slightly change of meaning is actually inline with what the flag is
actually used for and documented in systemd-dissect.

4 years agofstab-generator: get rid of fstab_extract_values() 18955/head
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 10:10:32 +0000 (11:10 +0100)] 
fstab-generator: get rid of fstab_extract_values()

This was a parallel implementation of option parsing that didn't
support escaping of separators. Let's port this over to the common code.

Fixes #18952.

4 years agoshared/fstab-util: teach fstab_filter_options() a mode where all values are returned
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 09:37:36 +0000 (10:37 +0100)] 
shared/fstab-util: teach fstab_filter_options() a mode where all values are returned

Apart from tests, the new argument isn't used anywhere, so there should be no
functional change. Note that the two arms of the big conditional are switched, so the
diff is artificially inflated. The actual code change is rather small. I dropped the
path which extracts ret_value manually, because it wasn't supporting unescaping of the
escape character properly.

4 years agoshared/fstab-util: pass through the escape character
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 15:53:38 +0000 (16:53 +0100)] 
shared/fstab-util: pass through the escape character

… when not used to escape the separator (,) or the escape character (\).
This mostly restores behaviour from before 0645b83a40d1c782f173c4d8440ab2fc82a75006,
but still allows "," to be escaped.

Partially fixes #18952.

4 years agobasic/extract-word: rename flag
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 14:39:47 +0000 (15:39 +0100)] 
basic/extract-word: rename flag

The flag enables "relaxed mode" for all kinds of unescaping, not just c-unescaping.

4 years agobasic/extract-word: allow escape character to be escaped
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 14:17:56 +0000 (15:17 +0100)] 
basic/extract-word: allow escape character to be escaped

With EXTRACT_UNESCAPE_SEPARATORS, backslash is used to escape the separator.
But it wasn't possible to insert the backslash itself. Let's allow this and
add test.

4 years agobasic/extract_word: try to explain what the various options do
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 13:23:23 +0000 (14:23 +0100)] 
basic/extract_word: try to explain what the various options do

A test for stripping of escaped backslashes without any flags was explicitly
added back in 4034a06ddb82ec9868cd52496fef2f5faa25575f. So it seems to be on
purpose, though I would say that this is at least surprising and hence deserves
a comment.

In test-extract-word, add tests for standalone EXTRACT_UNESCAPE_SEPARATORS.
Only behaviour combined with EXTRACT_CUNESCAPE was tested.

4 years agoshared/fstab-util: immediately drop empty options again
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 12:35:26 +0000 (13:35 +0100)] 
shared/fstab-util: immediately drop empty options again

In the conversion from strv_split() to strv_split_full() done in
7bb553bb98a57b4e03804f8192bdc5a534325582, EXTRACT_DONT_COALESCE_SEPARATORS was
added. I think this was just by mistake… We never look for "empty options", so
whether we immediately ignore the extra separator or store the empty string in
strv, should make no difference.

4 years agogenerators: warn but ignore failure to write timeouts
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 12:20:47 +0000 (13:20 +0100)] 
generators: warn but ignore failure to write timeouts

When we failed to split the options (because of disallowed quoting syntax, which
might be a bug in its own), we would silently fail. Instead, let's emit a warning.
Since we ignore the value if we cannot parse it anyway, let's ignore this error
too.

4 years agocoredumpctl: fflush() stdout before invoking gdb
Lennart Poettering [Wed, 10 Mar 2021 20:54:59 +0000 (21:54 +0100)] 
coredumpctl: fflush() stdout before invoking gdb

Fixes: #18936
4 years agoudev: add default group for sgx enclave access
Zbigniew Jędrzejewski-Szmek [Tue, 9 Mar 2021 18:06:18 +0000 (19:06 +0100)] 
udev: add default group for sgx enclave access

Closes #18669.

This creates a "well known" for sgx_enclave ownership. By doing this here we
avoid the risk that various projects making use of the device will provide
similar-but-slightly-incompatible installation instructions, in particular
using different group names.

ACLs are actually a better approach to grant access to users, but not in all
cases, so we want to provide a standard group anyway.

Mode is 0o660, not 0o666 because this is very new code and distributions are
likely to not want to give full access to all users. This might change in the
future, but being conservative is a good default in the beginning.

Rules for /dev/sgx_provision will be provided by libsg-ae-pce:
https://github.com/intel/linux-sgx/issues/678.

4 years agoupdate TODO
Lennart Poettering [Wed, 10 Mar 2021 21:36:20 +0000 (22:36 +0100)] 
update TODO

4 years agocoredump: omit coredump info when -q is used with the `debug` verb
Frantisek Sumsal [Wed, 10 Mar 2021 15:41:35 +0000 (16:41 +0100)] 
coredump: omit coredump info when -q is used with the `debug` verb

Skip printing the coredump info table when using the `debug` verb in
combination with the `-q/--quiet` option. Useful when trying to gather
coredump info non-interactively via scripted gdb commands.

Fixes: systemd/systemd#18935
4 years agofstab-generator: do not propagate error if we fail to canonicalize
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 10:49:02 +0000 (11:49 +0100)] 
fstab-generator: do not propagate error if we fail to canonicalize

r is used for the return value of the function, so we shouldn't
use it a non-fatal check.

4 years agotest: fix permissions of the ASan udev workaround
Frantisek Sumsal [Wed, 10 Mar 2021 11:30:04 +0000 (12:30 +0100)] 
test: fix permissions of the ASan udev workaround

otherwise udev complains about the file being world-writable:
systemd-udevd[228]: Configuration file /etc/udev/rules.d/00-set-LD_PRELOAD.rules is marked world-writable. Please remove world writability permission bits. Proceeding anyway.

Fixes: systemd/systemd-centos-ci#354
4 years agoRevert "udev: do not execute hwdb builtin import twice or thrice"
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.

4 years agotest: disable nss-systemd for TEST-22 under ASan
Frantisek Sumsal [Tue, 9 Mar 2021 21:20:39 +0000 (22:20 +0100)] 
test: disable nss-systemd for TEST-22 under ASan

When running TEST-22 under ASan, there's a chain of events which causes
`stat` to output an extraneous ASan error message, causing following
fail:

```
+ test -d /tmp/d/1
++ stat -c %U:%G:%a /tmp/d/1
==82==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
+ test = daemon:daemon:755
.//usr/lib/systemd/tests/testdata/units/testsuite-22.02.sh: line 24: test: =: unary operator expected
```

This is caused by `stat` calling nss which in Arch's configuration calls
the nss-systemd module, that pulls in libasan which causes the $LD_PRELOAD
error message, since `stat` is an uninstrumented binary.

The $LD_PRELOAD variable is explicitly unset for all testsuite-* services
since it causes various issues when calling uninstrumented libraries, so
setting it globally is not an option. Another option would be to set
$LD_PRELOAD for each `stat` call, but that would unnecessarily clutter
the test code.

4 years agoMerge pull request #18553 from Werkov/cgroup-user-instance-controllers
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 08:41:40 +0000 (09:41 +0100)] 
Merge pull request #18553 from Werkov/cgroup-user-instance-controllers

Make (user) instance aware of delegated cgroup controllers

4 years agoMerge pull request #18942 from keszybz/sd-netlink-prettification
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 08:18:06 +0000 (09:18 +0100)] 
Merge pull request #18942 from keszybz/sd-netlink-prettification

sd-nelink prettification

4 years agosocket-util: refuse ifnames with embedded '%' as invalid
Lennart Poettering [Tue, 9 Mar 2021 19:43:02 +0000 (20:43 +0100)] 
socket-util: refuse ifnames with embedded '%' as invalid

So Linux has this (insane — in my opinion) "feature" that if you name a
network interface "foo%d" then it will automatically look for the
interface starting with "foo…" with the lowest number that is not used
yet and allocates that.

We should never clash with this "magic" handling of ifnames, hence
refuse this, since otherwise we never know what the name is we end up
with.

We should probably switch things from a deny list to an allow list
sooner or later and be much stricter. Since the kernel directly enforces
only very few rules on the names, we'd need to do some research what is
safe and what is not first, though.

4 years agoupdate TODO
Lennart Poettering [Tue, 9 Mar 2021 22:20:53 +0000 (23:20 +0100)] 
update TODO

4 years agosd-netlink: shorten things a bit 18942/head
Zbigniew Jędrzejewski-Szmek [Tue, 9 Mar 2021 16:26:01 +0000 (17:26 +0100)] 
sd-netlink: shorten things a bit

4 years agosd-netlink: use setsockopt_int() also for NETLINK_ADD/DROP_MEMBERSHIP
Zbigniew Jędrzejewski-Szmek [Tue, 9 Mar 2021 16:24:57 +0000 (17:24 +0100)] 
sd-netlink: use setsockopt_int() also for NETLINK_ADD/DROP_MEMBERSHIP

We use 'unsigned' as the type, but netlink(7) says the type is 'int'.
It doesn't really matter, since they are both the same size. Let's use
our helper to shorten the code a bit.

4 years agosd-netlink: use structured initialization
Zbigniew Jędrzejewski-Szmek [Tue, 9 Mar 2021 16:13:20 +0000 (17:13 +0100)] 
sd-netlink: use structured initialization

The casts look somewhat ugly and type-unsafe, but they are equivalent
to what was there before (we initialized a variable from a void*).

4 years agofs-util: port symlink_idempotent() to path_extract_directory()
Lennart Poettering [Mon, 8 Mar 2021 19:41:34 +0000 (20:41 +0100)] 
fs-util: port symlink_idempotent() to path_extract_directory()

4 years agologind: add …WithFlags methods to policy
Zbigniew Jędrzejewski-Szmek [Tue, 9 Mar 2021 08:03:58 +0000 (09:03 +0100)] 
logind: add …WithFlags methods to policy

Without this, privilege escalation through polkit does not work, because all
methods fail with permission errors.

Forgotten in 8885fed4e3a52cf1bf105e42043203c485ed9d92.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1933335.

4 years agopo: Translated using Weblate (Korean)
simmon [Tue, 9 Mar 2021 12:01:45 +0000 (13:01 +0100)] 
po: Translated using Weblate (Korean)

Currently translated at 87.3% (165 of 189 strings)

Co-authored-by: simmon <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main

4 years agooomd: "downgrade" level of message 18915/head
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 08:21:25 +0000 (09:21 +0100)] 
oomd: "downgrade" level of message

PID1 already logs about the service being started, so this line isn't necessary
in normal use. Also, by the time it is emitted, the service has already
signalled readiness, so let's not say "starting" but "started".

4 years agovarlink: avoid using dangling ref in varlink_close_unref()
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 15:42:35 +0000 (16:42 +0100)] 
varlink: avoid using dangling ref in varlink_close_unref()

Fixes #18025, https://bugzilla.redhat.com/show_bug.cgi?id=1931034.

We drop the reference stored in Manager.managed_oom_varlink_request in two code paths:
vl_disconnect() which is installed as a disconnect callback, and in manager_varlink_done().
But we also make a disconnect from manager_varlink_done(). So we end up with the following
call stack:

(gdb) bt
 0  vl_disconnect (s=0x112c7b0, link=0xea0070, userdata=0xe9bcc0) at ../src/core/core-varlink.c:414
 1  0x00007f1366e9d5ac in varlink_detach_server (v=0xea0070) at ../src/shared/varlink.c:1210
 2  0x00007f1366e9d664 in varlink_close (v=0xea0070) at ../src/shared/varlink.c:1228
 3  0x00007f1366e9d6b5 in varlink_close_unref (v=0xea0070) at ../src/shared/varlink.c:1240
 4  0x0000000000524629 in manager_varlink_done (m=0xe9bcc0) at ../src/core/core-varlink.c:479
 5  0x000000000048ef7b in manager_free (m=0xe9bcc0) at ../src/core/manager.c:1357
 6  0x000000000042602c in main (argc=5, argv=0x7fff439c43d8) at ../src/core/main.c:2909

When we enter vl_disconnect(), m->managed_oom_varlink_request.n_ref==1.
When we exit from vl_discconect(), m->managed_oom_varlink_request==NULL. But
varlink_close_unref() has a copy of the pointer in *v. When we continue executing
varlink_close_unref(), this pointer is dangling, and the call to varlink_unref()
is done with an invalid pointer.

4 years agopid1: return varlink error on the right connection
Zbigniew Jędrzejewski-Szmek [Sat, 6 Mar 2021 18:06:08 +0000 (19:06 +0100)] 
pid1: return varlink error on the right connection

4 years agoMerge pull request #18930 from anitazha/oomdfixleak
Luca Boccassi [Tue, 9 Mar 2021 11:37:10 +0000 (11:37 +0000)] 
Merge pull request #18930 from anitazha/oomdfixleak

oomd: fix memory leak

4 years agooomd: wrap paths in oomd_insert_cgroup_context with empty_to_root 18930/head
Anita Zhang [Mon, 8 Mar 2021 18:21:37 +0000 (10:21 -0800)] 
oomd: wrap paths in oomd_insert_cgroup_context with empty_to_root

4 years agoMerge pull request #18932 from poettering/filename-max
Yu Watanabe [Tue, 9 Mar 2021 05:15:49 +0000 (14:15 +0900)] 
Merge pull request #18932 from poettering/filename-max

Drop use of FILENAME_MAX

4 years agotimedated: fix skipping of comments in config file
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

:(

4 years agoMerge pull request #18927 from poettering/dissect-alloca-fix
Luca Boccassi [Mon, 8 Mar 2021 22:42:55 +0000 (22:42 +0000)] 
Merge pull request #18927 from poettering/dissect-alloca-fix

dissect-image: don't mix two forms of stack allocation in one line

4 years agooomd: move TAKE_PTR to end of oomd_insert_cgroup_context()
Anita Zhang [Mon, 8 Mar 2021 18:35:31 +0000 (10:35 -0800)] 
oomd: move TAKE_PTR to end of oomd_insert_cgroup_context()

Fixes #18926

4 years agooomd: add unit test to repro #18926
Anita Zhang [Mon, 8 Mar 2021 18:51:12 +0000 (10:51 -0800)] 
oomd: add unit test to repro #18926

4 years agotest: output FILENAME_MAX vs. PATH_MAX sizes 18932/head
Lennart Poettering [Mon, 8 Mar 2021 21:45:03 +0000 (22:45 +0100)] 
test: output FILENAME_MAX vs. PATH_MAX sizes

Also, make sure our assumption that FILENAME_MAX == PATH_MAX holds.

4 years agomountpoint-util: replace our last use of FILENAME_MAX by PATH_MAX
Lennart Poettering [Mon, 8 Mar 2021 21:44:35 +0000 (22:44 +0100)] 
mountpoint-util: replace our last use of FILENAME_MAX by PATH_MAX

4 years agofs-util: replace use of FILENAME_MAX by PATH_MAX in readlinkat_malloc()
Lennart Poettering [Mon, 8 Mar 2021 21:43:50 +0000 (22:43 +0100)] 
fs-util: replace use of FILENAME_MAX by PATH_MAX in readlinkat_malloc()

While we are at it, let's also add an overflow check and do other
modernizations.

4 years agodocs: reference NAME_MAX where we talk about filenames
Lennart Poettering [Mon, 8 Mar 2021 21:43:41 +0000 (22:43 +0100)] 
docs: reference NAME_MAX where we talk about filenames

4 years agodocs: document not to use FILENAME_MAX in our codebase
Lennart Poettering [Mon, 8 Mar 2021 21:43:07 +0000 (22:43 +0100)] 
docs: document not to use FILENAME_MAX in our codebase

It's a weird thing. Let's explain why.

4 years agoefi-loader: make efi_loader_entry_name_valid() check a bit stricter
Lennart Poettering [Mon, 8 Mar 2021 21:27:05 +0000 (22:27 +0100)] 
efi-loader: make efi_loader_entry_name_valid() check a bit stricter

Previously we'd just check if the ID was no-empty an no longer than
FILENAME_MAX. The latter was probably a mistake, given the comment next
to it. Instead of fixing that to check for NAME_MAX let's instead  just
switch over to filename_is_valid() which odes a similar check, plus a
some minor additional checks. After all we do want that valid EFI boot
menu entry ids are usable as filenames.

4 years agobasic: tighten two filename length checks
Lennart Poettering [Mon, 8 Mar 2021 20:44:39 +0000 (21:44 +0100)] 
basic: tighten two filename length checks

This fixes two checks where we compare string sizes when validating with
FILENAME_MAX. In both cases the check apparently wants to check if the
name fits in a filename, but that's not actually what FILENAME_MAX can
be used for, as it — in contrast to what the name suggests — actually
encodes the maximum length of a path.

In both cases the stricter change doesn't actually change much, but the
use of FILENAME_MAX is still misleading and typically wrong.

4 years agoformat-table: simplify table_set_display_all() and keep it private
Lennart Poettering [Thu, 4 Mar 2021 19:50:34 +0000 (20:50 +0100)] 
format-table: simplify table_set_display_all() and keep it private

4 years agoMerge pull request #18918 from yuwata/man-no-new-priv-18914
Luca Boccassi [Mon, 8 Mar 2021 20:57:32 +0000 (20:57 +0000)] 
Merge pull request #18918 from yuwata/man-no-new-priv-18914

man: update documents about NoNewPrivileges=

4 years agodissect-image: don#t mix two forms of stack allocation in one expression 18927/head
Lennart Poettering [Mon, 8 Mar 2021 16:31:47 +0000 (17:31 +0100)] 
dissect-image: don#t mix two forms of stack allocation in one expression

It's not necessarily safe to do this, hence don't.

4 years agodissect-image: remove unnecessary parens
Lennart Poettering [Mon, 8 Mar 2021 16:31:35 +0000 (17:31 +0100)] 
dissect-image: remove unnecessary parens

4 years agoMerge pull request #18925 from keszybz/hwdb-news-syscalls-update
Lennart Poettering [Mon, 8 Mar 2021 16:01:40 +0000 (17:01 +0100)] 
Merge pull request #18925 from keszybz/hwdb-news-syscalls-update

Update of hwdb & news & syscalls for v248

4 years agoMerge pull request #18921 from yuwata/seccomp-syscallfilter-18916
Lennart Poettering [Mon, 8 Mar 2021 16:01:23 +0000 (17:01 +0100)] 
Merge pull request #18921 from yuwata/seccomp-syscallfilter-18916

seccomp: fix issue in system call filter with errno

4 years agoMerge pull request #18924 from keszybz/homed-inotify-crash
Lennart Poettering [Mon, 8 Mar 2021 14:12:30 +0000 (15:12 +0100)] 
Merge pull request #18924 from keszybz/homed-inotify-crash

Homed inotify crash

4 years agotest: fix the last subtest of TEST-50-DISSECT under sanitizers
Frantisek Sumsal [Mon, 8 Mar 2021 10:28:40 +0000 (11:28 +0100)] 
test: fix the last subtest of TEST-50-DISSECT under sanitizers

Follow-up to 9f6235e1b4490ce7abbd125ed975343de6bcb9cd.

4 years agohwdb: update for v248 18925/head
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 12:13:27 +0000 (13:13 +0100)] 
hwdb: update for v248

Seems to be additions and corrections as usual.
Includes an update of the chromiumos autosuspend rules.

4 years agoNEWS: add items since -rc2
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 12:12:10 +0000 (13:12 +0100)] 
NEWS: add items since -rc2

4 years agocore/execute: sort conditions to make them match documentation 18918/head
Yu Watanabe [Mon, 8 Mar 2021 01:37:43 +0000 (10:37 +0900)] 
core/execute: sort conditions to make them match documentation

4 years agoman: update document about NoNewPrivileges=
Yu Watanabe [Mon, 8 Mar 2021 01:36:49 +0000 (10:36 +0900)] 
man: update document about NoNewPrivileges=

Fixes #18914.

4 years agotest: add one more test for system call filter with errno 18921/head
Yu Watanabe [Mon, 8 Mar 2021 03:06:09 +0000 (12:06 +0900)] 
test: add one more test for system call filter with errno

4 years agoseccomp: do not ignore deny-listed syscalls with errno when list is allow-list
Yu Watanabe [Mon, 8 Mar 2021 03:00:32 +0000 (12:00 +0900)] 
seccomp: do not ignore deny-listed syscalls with errno when list is allow-list

Previously, if the hashmap is allow-list and a new deny-listed syscall
is added, seccomp_parse_syscall_filter() simply drop the new syscall
from hashmap even if error number is specified.

This makes 'allow-list' hashmap store two types of entries:
- allow-listed syscalls, which are stored with negative value (-1).
- deny-listed syscalls, which are stored with specified errno.

Fixes #18916.

4 years agoseccomp: use FLAGS_SET() macro
Yu Watanabe [Mon, 8 Mar 2021 02:58:58 +0000 (11:58 +0900)] 
seccomp: use FLAGS_SET() macro

4 years agocore,seccomp: refuse to specify errno for allow-listed syscalls
Yu Watanabe [Mon, 8 Mar 2021 02:57:59 +0000 (11:57 +0900)] 
core,seccomp: refuse to specify errno for allow-listed syscalls

4 years agocore: drop meaningless parse_syscall_and_errno() calls
Yu Watanabe [Mon, 8 Mar 2021 02:54:05 +0000 (11:54 +0900)] 
core: drop meaningless parse_syscall_and_errno() calls

parse_syscall_and_errno() does not check the validity of syscall name or
syscall group name, but it just split into syscall name and errno.
So, it is not necessary to call it for SystemCallLog=.

4 years agoseccomp: fix comment and change variable name
Yu Watanabe [Mon, 8 Mar 2021 02:10:54 +0000 (11:10 +0900)] 
seccomp: fix comment and change variable name

4 years agotest: parse_syscall_and_errno() accepts zero errno
Yu Watanabe [Mon, 8 Mar 2021 02:10:26 +0000 (11:10 +0900)] 
test: parse_syscall_and_errno() accepts zero errno

4 years agotest: move test_parse_syscall_and_errno() to test-seccomp.c
Yu Watanabe [Mon, 8 Mar 2021 02:09:37 +0000 (11:09 +0900)] 
test: move test_parse_syscall_and_errno() to test-seccomp.c

4 years agomissing-syscalls: do not generate trailing empty line
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 11:39:50 +0000 (12:39 +0100)] 
missing-syscalls: do not generate trailing empty line

The generated .h file was already like this, but what the generator generated
did not match. So we only need to update the generator.

4 years agosyscalls: update tables
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 11:31:46 +0000 (12:31 +0100)] 
syscalls: update tables

bfin_spinlock and cache_sync are dropped from the table, but didn't have
numbers assigned.

mount_setattr was added in v5.11-rc4-35-g2a1867219c.

4 years agohomed: unref the sd_event object after the sources 18924/head
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 10:52:09 +0000 (11:52 +0100)] 
homed: unref the sd_event object after the sources

Shouldn't make any difference, but let's first flush any pending messages, then
unref the reference-counted stuff, and only at the end do the direct free calls.

4 years agohomed: disable event sources before unreffing them
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.

4 years agohomed: wrap some very long lines
Zbigniew Jędrzejewski-Szmek [Mon, 8 Mar 2021 10:28:19 +0000 (11:28 +0100)] 
homed: wrap some very long lines

4 years agohwdb: 60-keyboard:: Update Dell Privacy Micmute Hotkey Map
Perry Yuan [Mon, 8 Mar 2021 02:50:49 +0000 (21:50 -0500)] 
hwdb: 60-keyboard:: Update Dell Privacy Micmute Hotkey Map

Dell new Privacy feature provide new hardware level privacy
protect for users
This patch remaps scancode 0x120001 to key code F20 micmute
The old matching string cannot cover some other Dell products
which have the privacy feature,expand the string to all the system
that can load the privacy driver,privacy driver already detect the
system if it can support this feature. So here we can safely just
map the micmute key to scancode 0x120001

Signed-off-by: Perry Yuan <perry_yuan@dell.com>
4 years agoMerge pull request #18908 from mrc0mmand/fix-packit
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 20:31:31 +0000 (21:31 +0100)] 
Merge pull request #18908 from mrc0mmand/fix-packit

ci: correctly drop patches with non four digit indexes

4 years agoMerge pull request #18911 from keszybz/coverity-inspired-fixes
Luca Boccassi [Sun, 7 Mar 2021 15:12:08 +0000 (15:12 +0000)] 
Merge pull request #18911 from keszybz/coverity-inspired-fixes

Coverity inspired fixes

4 years agoMerge pull request #18907 from mrc0mmand/test-dissect-sanitizers
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 11:46:15 +0000 (12:46 +0100)] 
Merge pull request #18907 from mrc0mmand/test-dissect-sanitizers

test: fix TEST-50-DISSECT under sanitizers

4 years agoTEST-15-DROPINS: improve check 18911/head
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 11:27:55 +0000 (12:27 +0100)] 
TEST-15-DROPINS: improve check

https://github.com/systemd/systemd/pull/18579#discussion_r588983813

4 years agobasic/namespae-util: avoid one allocation
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 11:22:28 +0000 (12:22 +0100)] 
basic/namespae-util: avoid one allocation

4 years agobasic/os-util: adjust indentation
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 11:15:42 +0000 (12:15 +0100)] 
basic/os-util: adjust indentation

4 years agojournal-remote: check return value from MHD_add_response_header
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 11:08:06 +0000 (12:08 +0100)] 
journal-remote: check return value from MHD_add_response_header

Sadly, the API does not allow us to distinguish oom from invalid settings.
If the call fails, let's assume oom happened.

Coverity CID#1444714.

4 years agocore: fix netns/ipcns socket confusion
Zbigniew Jędrzejewski-Szmek [Sun, 7 Mar 2021 10:52:40 +0000 (11:52 +0100)] 
core: fix netns/ipcns socket confusion

Fixup for a70581ffb5c13c91c76ff73ba6f5f3ff59c5a915. Coverity CID#1448383.

4 years agoci: revert back to --werror instead of -Dc_args=-Werror 18908/head
Frantisek Sumsal [Sat, 6 Mar 2021 22:17:01 +0000 (23:17 +0100)] 
ci: revert back to --werror instead of -Dc_args=-Werror

-Dc_args=/-Dcpp_args= don't play well with the RPM hardening macros
using $CFLAGS/$CPPFLAGS, since they're mutually exclusive.