Commit Graph
50073 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 451ba55fec Revert "udev: do not execute hwdb builtin import twice or thrice"
This reverts commit 876c75fe87.

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.
2021-03-10 15:26:45 +01:00
Frantisek Sumsal 4b252eaa31 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.
2021-03-10 11:59:43 +01:00
Zbigniew Jędrzejewski-Szmek 749c4c8ed1 Merge pull request #18553 from Werkov/cgroup-user-instance-controllers
Make (user) instance aware of delegated cgroup controllers
2021-03-10 09:41:40 +01:00
Zbigniew Jędrzejewski-Szmek ffea01856f Merge pull request #18942 from keszybz/sd-netlink-prettification
sd-nelink prettification
2021-03-10 09:18:06 +01:00
Lennart Poettering e5f8ce13bb 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.
2021-03-10 11:11:52 +09:00
Lennart Poettering bef1e1a066 update TODO 2021-03-09 23:20:53 +01:00
Zbigniew Jędrzejewski-Szmek c7209bcfe1 sd-netlink: shorten things a bit 2021-03-09 17:26:24 +01:00
Zbigniew Jędrzejewski-Szmek 4fa024683c 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.
2021-03-09 17:26:24 +01:00
Zbigniew Jędrzejewski-Szmek 64a65bab59 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*).
2021-03-09 17:26:24 +01:00
Lennart Poettering 9813d8354c fs-util: port symlink_idempotent() to path_extract_directory() 2021-03-09 14:37:23 +00:00
Zbigniew Jędrzejewski-Szmek 9ca6d78061 logind: add …WithFlags methods to policy
Without this, privilege escalation through polkit does not work, because all
methods fail with permission errors.

Forgotten in 8885fed4e3.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1933335.
2021-03-09 14:37:08 +00:00
simmon e2dba58930 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
2021-03-09 14:14:33 +01:00
Luca Boccassi 1d2e9c48e5 Merge pull request #18930 from anitazha/oomdfixleak
oomd: fix memory leak
2021-03-09 11:37:10 +00:00
Anita Zhang 50c0578b61 oomd: wrap paths in oomd_insert_cgroup_context with empty_to_root 2021-03-09 09:23:22 +01:00
Yu Watanabe 2eaed57bd4 Merge pull request #18932 from poettering/filename-max
Drop use of FILENAME_MAX
2021-03-09 14:15:49 +09:00
Zbigniew Jędrzejewski-Szmek 03a81441b1 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

:(
2021-03-09 14:04:21 +09:00
Luca Boccassi a2aa51b740 Merge pull request #18927 from poettering/dissect-alloca-fix
dissect-image: don't mix two forms of stack allocation in one line
2021-03-08 22:42:55 +00:00
Anita Zhang 45da27fa05 oomd: move TAKE_PTR to end of oomd_insert_cgroup_context()
Fixes #18926
2021-03-08 14:37:15 -08:00
Anita Zhang 399d80ba8c oomd: add unit test to repro #18926 2021-03-08 14:36:24 -08:00
Lennart Poettering 698660620d test: output FILENAME_MAX vs. PATH_MAX sizes
Also, make sure our assumption that FILENAME_MAX == PATH_MAX holds.
2021-03-08 22:52:04 +01:00
Lennart Poettering 445714569d mountpoint-util: replace our last use of FILENAME_MAX by PATH_MAX 2021-03-08 22:47:55 +01:00
Lennart Poettering db22003233 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.
2021-03-08 22:47:51 +01:00
Lennart Poettering 932401fd61 docs: reference NAME_MAX where we talk about filenames 2021-03-08 22:47:48 +01:00
Lennart Poettering b775b1828d docs: document not to use FILENAME_MAX in our codebase
It's a weird thing. Let's explain why.
2021-03-08 22:47:44 +01:00
Lennart Poettering f470d234d3 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.
2021-03-08 22:47:41 +01:00
Lennart Poettering 8ca94009f8 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.
2021-03-08 22:47:14 +01:00
Lennart Poettering c27cb5113f format-table: simplify table_set_display_all() and keep it private 2021-03-08 21:33:35 +00:00
Luca Boccassi ae43f2341c Merge pull request #18918 from yuwata/man-no-new-priv-18914
man: update documents about NoNewPrivileges=
2021-03-08 20:57:32 +00:00
Lennart Poettering 794a579f29 dissect-image: don#t mix two forms of stack allocation in one expression
It's not necessarily safe to do this, hence don't.
2021-03-08 17:31:47 +01:00
Lennart Poettering 7533a33b0c dissect-image: remove unnecessary parens 2021-03-08 17:31:35 +01:00
Lennart Poettering 79d5f00ad1 Merge pull request #18925 from keszybz/hwdb-news-syscalls-update
Update of hwdb & news & syscalls for v248
2021-03-08 17:01:40 +01:00
Lennart Poettering b9dec21409 Merge pull request #18921 from yuwata/seccomp-syscallfilter-18916
seccomp: fix issue in system call filter with errno
2021-03-08 17:01:23 +01:00
Lennart Poettering 00248fc4f7 Merge pull request #18924 from keszybz/homed-inotify-crash
Homed inotify crash
2021-03-08 15:12:30 +01:00
Frantisek Sumsal c335b7c3f8 test: fix the last subtest of TEST-50-DISSECT under sanitizers
Follow-up to 9f6235e1b4.
2021-03-08 14:38:49 +01:00
Zbigniew Jędrzejewski-Szmek a3fbf67180 hwdb: update for v248
Seems to be additions and corrections as usual.
Includes an update of the chromiumos autosuspend rules.
2021-03-08 14:27:48 +01:00
Zbigniew Jędrzejewski-Szmek 33e68cce51 NEWS: add items since -rc2 2021-03-08 14:27:48 +01:00
Yu Watanabe 0538d2a811 core/execute: sort conditions to make them match documentation 2021-03-08 21:42:06 +09:00
Yu Watanabe 266d0bb9e0 man: update document about NoNewPrivileges=
Fixes #18914.
2021-03-08 21:42:06 +09:00
Yu Watanabe a62f651b32 test: add one more test for system call filter with errno 2021-03-08 21:28:42 +09:00
Yu Watanabe 68acc1afbe 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.
2021-03-08 21:28:42 +09:00
Yu Watanabe 9e29ee4072 seccomp: use FLAGS_SET() macro 2021-03-08 21:28:42 +09:00
Yu Watanabe 084a46d7c5 core,seccomp: refuse to specify errno for allow-listed syscalls 2021-03-08 21:28:38 +09:00
Yu Watanabe 696a13bab7 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=.
2021-03-08 21:26:13 +09:00
Yu Watanabe 1862b310c5 seccomp: fix comment and change variable name 2021-03-08 21:25:54 +09:00
Yu Watanabe 335171ca84 test: parse_syscall_and_errno() accepts zero errno 2021-03-08 21:22:24 +09:00
Yu Watanabe 17884f979a test: move test_parse_syscall_and_errno() to test-seccomp.c 2021-03-08 21:22:24 +09:00
Zbigniew Jędrzejewski-Szmek 1d73ffeae1 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.
2021-03-08 12:39:50 +01:00
Zbigniew Jędrzejewski-Szmek 36fd31f525 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.
2021-03-08 12:31:46 +01:00
Zbigniew Jędrzejewski-Szmek f76e564437 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.
2021-03-08 12:00:22 +01:00
Zbigniew Jędrzejewski-Szmek cf5366387b 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.
2021-03-08 11:59:09 +01:00