Commit Graph

48208 Commits

Author SHA1 Message Date
Greg Depoire--Ferrer 6597686865 seccomp: don't install filters for archs that can't use syscalls
When seccomp_restrict_archs is called, architectures that are blocked
are replaced by the SECCOMP_LOCAL_ARCH_BLOCKED marker so that they are
not disabled again and filters are not installed for them.

This can make some service that use SystemCallArchitecture= and
SystemCallFilter= start faster.
2020-12-10 16:13:02 +01:00
Vito Caputo 104fc4be11 mmap-cache: bind prot(ection) to MMapFileDescriptor
There are no mmap_cache_get() users that actually deviate prot
from the JournalFile's f->prot.

So there's no point in making this a separate parameter to
mmap_cache_get(), nor is there any need to store it in
JournalFile's f->prot.

Instead just pass it to mmap_cache_add_fd() at MMapFileDescriptor
creation, storing it in there for the mmap() callers, which
already receive MMapFileDescriptor *.

For functions receiving both an MMapFileDescriptor * and prot,
the prot argument has been simply removed and call sites updated.

Formalizing this fd:prot binding at the public API also enables
discarding the prot check in window_matches(), which is a hot
function on long window lists, so a minor CPU efficiency gain
should be had there as seen with the past removal of the fd
check.  Unnoticable for uncached journals, but maybe a little
runtime improvement when cached in specific circumstances.

window_matches_fd() has also been simplified to treat the
MMapFileDescrptor * as equivalent to its fd and prot.
2020-12-10 13:03:31 +01:00
Lennart Poettering cca2da15c8 three spdx header fixes 2020-12-10 13:03:11 +01:00
Lennart Poettering 8620022f28
Merge pull request #17851 from yuwata/network-address-compare-func
network: revert previous changes to address_compare_func()
2020-12-10 10:43:47 +01:00
Vito Caputo 073f50a099 mmap-cache: separate context and window list cache hit accounting
Account and log these statistics separately since their overheads
are potentially quite different when the window lists are large.

There should probably be a histogram of window list traversal
counts too.
2020-12-10 10:23:01 +01:00
Zbigniew Jędrzejewski-Szmek 6bfbfce795 networkd-test: add final newlines in generated files, use .format() 2020-12-10 14:31:39 +09:00
Takashi Iwai 5926e592fa udev: Fix sound.target dependency
The recent bug report indicated a race at device creation and the
sound.target dependencies, and the cause turned out to be the condition
of the sound.target trigger.  Currently it's set for "card*", but this
is actually the parent object; i.e. the sound.target is triggered before
the sound devices are created.

For assuring the whole sound device creations beforehand, we need to use
"controlC*" instead of "card*"; as already described in
78-sound-card.rules, this is guaranteed to be the last device, and can
be used as a synchronization point.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1179363
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-10 14:29:50 +09:00
Yu Watanabe 44cc6bfef0
Merge pull request #17877 from yuwata/missing-syscall-sort
missing: sort architectures in missing_syscall.h
2020-12-10 12:42:35 +09:00
Lennart Poettering 19d43808bd
Merge pull request #17869 from DaanDeMeyer/mkosi-gdb
mkosi: Add gdb to final images
2020-12-09 21:09:59 +01:00
Lennart Poettering 733558adef
Merge pull request #17884 from poettering/test-dlopen
tests: add test that dlopen()s our weak shared library deps once
2020-12-09 21:09:33 +01:00
Franck Bui 4e1db59274 udev: link_update() should fail if the entry in symlink dir couldn't have been created
Follow-up for 30f6dce62c
2020-12-09 21:08:53 +01:00
Lennart Poettering 5e3effb1f3 virt: drop /proc/1/sched hack
On really old kernels (< 4.14+) a bug in /proc/1/sched handling in the
kernel could be used to determine whether we are running in a PID
namespace. This hasn't worked for a long time, and there's little point
in making things work on old kernels we can't make work on current
kernels, hence let's drop that old cruft.

See: #8153
2020-12-09 21:07:46 +01:00
Daan De Meyer c6ab308767 mkosi: Add strace to final images
Useful for debugging purposes.
2020-12-09 17:34:45 +00:00
Daan De Meyer ae4f44a94e mkosi: Add gdb to final images
Let's add a debugger to the mkosi images so we can debug coredumps
from inside mkosi qemu VMs (and hopefully in the future from
mkosi systemd-nspawn containers as well).
2020-12-09 17:30:41 +00:00
Lennart Poettering 1c36b8bf53 log: add helper set sets log level in all realms
Prompted-by: #17903
2020-12-09 18:26:17 +01:00
Lennart Poettering eef34a1d8f man: document that automount units are privileged
Fixes: #17886
2020-12-09 18:25:32 +01:00
Luca Boccassi 0727a75a3b
Merge pull request #17911 from yuwata/log-cli-program-use-journal
log: open journal when cli program run in a service unit
2020-12-09 14:30:32 +00:00
Luca Boccassi 141d3a14d4
Merge pull request #17882 from poettering/logind-async-close
logind: fix closing of button input devices
2020-12-09 14:27:03 +00:00
Daan De Meyer ecd3c86b60 Silence cgroups v1 read-only filesystem warning
Avoid warning messages when booting systemd-nspawn containers and using
hybrid or legacy cgroups. systemd-nspawn mounts the cgroups v1 controller
tree as read-only so these errors are expected and not problematic.
Partially fixes #17862.

Test plan:

- Before: `mkosi --default .mkosi/mkosi.fedora boot`

```
‣ Processing default...
Spawning container image on /home/daan/projects/systemd/image.raw.
Press ^] three times within 1s to kill container.
systemd 247 running in system mode. (+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
Detected virtualization systemd-nspawn.
Detected architecture x86-64.

Welcome to Fedora 33 (Thirty Three)!

Queued start job for default target Graphical Interface.
-.slice: Failed to migrate controller cgroups from , ignoring: Read-only file system
system.slice: Failed to delete controller cgroups /system.slice, ignoring: Read-only file system
[  OK  ] Created slice system-getty.slice.
[  OK  ] Created slice system-modprobe.slice.
user.slice: Failed to delete controller cgroups /user.slice, ignoring: Read-only file system
[  OK  ] Created slice User and Session Slice.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Reached target Slices.
[  OK  ] Reached target Swap.
[  OK  ] Listening on Process Core Dump Socket.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket.
[  OK  ] Listening on User Database Manager Socket.
dev-hugepages.mount: Failed to delete controller cgroups /dev-hugepages.mount, ignoring: Read-only file system
         Mounting Huge Pages File System...
sys-fs-fuse-connections.mount: Failed to delete controller cgroups /sys-fs-fuse-connections.mount, ignoring: Read-only file system
         Mounting FUSE Control File System...
         Starting Journal Service...
         Starting Remount Root and Kernel File Systems...
system.slice: Failed to delete controller cgroups /system.slice, ignoring: Read-only file system
```

After: `mkosi --default .mkosi/mkosi.fedora boot`

```
‣ Processing default...
Spawning container image on /home/daan/projects/systemd/mkosi.output/image.raw.
Press ^] three times within 1s to kill container.
systemd 247 running in system mode. (+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
Detected virtualization systemd-nspawn.
Detected architecture x86-64.

Welcome to Fedora 33 (Thirty Three)!

Queued start job for default target Graphical Interface.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Created slice system-modprobe.slice.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Reached target Slices.
[  OK  ] Reached target Swap.
[  OK  ] Listening on Process Core Dump Socket.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket.
[  OK  ] Listening on User Database Manager Socket.
         Mounting Huge Pages File System...
         Mounting FUSE Control File System...
         Starting Journal Service...
         Starting Remount Root and Kernel File Systems...
[  OK  ] Mounted Huge Pages File System.
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Finished Remount Root and Kernel File Systems.
         Starting Create Static Device Nodes in /dev...
[  OK  ] Finished Create Static Device Nodes in /dev.
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Restore /run/initramfs on shutdown...
[  OK  ] Finished Restore /run/initramfs on shutdown.
[  OK  ] Started Journal Service.
         Starting Flush Journal to Persistent Storage...
[  OK  ] Finished Flush Journal to Persistent Storage.
         Starting Create Volatile Files and Directories...
[  OK  ] Finished Create Volatile Files and Directories.
         Starting Network Name Resolution...
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Finished Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting Home Area Manager...
         Starting User Login Management...
         Starting Permit User Sessions...
[  OK  ] Finished Permit User Sessions.
[  OK  ] Started Console Getty.
[  OK  ] Reached target Login Prompts.
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Home Area Manager.
[  OK  ] Started User Login Management.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Finished Update UTMP about System Runlevel Changes.
[  OK  ] Started Network Name Resolution.
[  OK  ] Reached target Host and Network Name Lookups.

Fedora 33 (Thirty Three) (built from systemd tree)
Kernel 5.9.11-arch2-1 on an x86_64 (console)
```
2020-12-09 12:37:16 +00:00
Luca Boccassi a6c7811f0d meson: specify correct libqrencode version in meson dep 2020-12-09 13:34:53 +01:00
Luca Boccassi b7fca1b059 test: pull in weak deps into tests
(Pulled from @bluca's comment here:
https://github.com/systemd/systemd/pull/17884#issuecomment-740005624 and
turned into a commit by @poettering)
2020-12-09 13:34:49 +01:00
Lennart Poettering 68fdc72cfe test: add test that dlopen()'s all our weak library deps once
This test should ensure we notice if distros update shared libraries
that broke so name, and we still use the old soname.

(In contrast to what the commit summary says, this currently doesn#t
cover really all such deps, specifically xkbcommon and PCRE are missing,
since they currently aren't loaded from src/shared/. This is stuff to
fix later)
2020-12-09 13:34:40 +01:00
Lennart Poettering ad914843c6 qrcode-util: make dlopen() logic more like the other cases
Let's add a dlopen_qrencode() function that does the actual dlopen()
stuff and caches the result.

This is useful so that we later can automatically test for all dlopen
hookups to work correctly.
2020-12-09 13:34:27 +01:00
Michael Marley 61927b9f11 manager: Fix HW watchdog when systemd starts before driver loaded
When manager_{set|override}_watchdog is called, set the watchdog timeout
regardless of whether the hardware watchdog was successfully initialized.  If
the watchdog was requested but could not be initialized, then instead of
pinging it, attempt to initialize it again.  This ensures that the hardware
watchdog is initialized even if the kernel module for it isn't loaded when
systemd starts (which is quite likely, unless it is compiled in).

This builds on work by @danc86 in https://github.com/systemd/systemd/pull/17460,
but fixes the issue of not updating the watchdog timeout with the actual value
from the hardware.

Fixes https://github.com/systemd/systemd/issues/17838

Co-authored-by: Dan Callaghan <djc@djc.id.au>
Co-authored-by: Michael Marley <michael@michaelmarley.com>
2020-12-09 11:47:22 +00:00
Lennart Poettering f2835dd4a6 logind: use free_and_strdup() where appropriate 2020-12-09 10:09:11 +01:00
Lennart Poettering c74d5fe25d logind: fix closing of button input devices
This is a fix of #17751. Specifically:

1. Sort #include headers again

2. Remove tabs, as per coding style

3. Don't install fds in half-initialized objects

4. Use asynchronous_close() everywhere

That all said:

Quit frankly, I am not convinced we should do all this at all. If
close()ing of these input devices is really that slow, then this should
probably be fixed in the kernel, not worked around in userspace like
this.
2020-12-09 10:08:51 +01:00
Lennart Poettering 1d9aa4d572 async: add trivial cleanup wrapper for asynchronous_close() 2020-12-09 10:07:52 +01:00
Yu Watanabe 13ee939784 log: open journal when cli program run in a service unit
Previously, cli programs like networkctl always use console for logging.
2020-12-09 14:44:02 +09:00
Yu Watanabe db987463fe log: make show_color variable tristate
Should not change any behavior.
2020-12-09 14:44:02 +09:00
Yu Watanabe 5941112e7e log: merge conditions to reduce indentation 2020-12-09 14:44:02 +09:00
Yu Watanabe 9e36b885b8 unit: make systemd-networkd.service support reload command 2020-12-09 12:55:51 +09:00
Yu Watanabe 84f9a68060 mount-util: fix typo 2020-12-09 12:55:14 +09:00
Pavel Hrdina 35e7a62ca3 cgroup: Also set blkio.bfq.weight
Commit [1] added a workaround when unified cgroups are used but missed
legacy cgroups where there is the same issue.

[1] <2dbc45aea7>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2020-12-08 18:15:26 +00:00
Zbigniew Jędrzejewski-Szmek a6e5ad8925
Merge pull request #17871 from yuwata/sd-device-issue-17772
sd-device: keep escaped strings in DEVLINK= property
2020-12-08 10:14:43 +01:00
Daan De Meyer ee2812da8f mkosi: Enable --qemu-headless option for all distros
--qemu-headless configures the generated image and mkosi's qemu
command to connect to the VM via the serial port. This allows
spawning a qemu VM within the user's terminal instead of spawning
a graphical GTK GUI. --qemu-headless sets TERM, COLUMNS and LINES
in serial-getty@ttyS0.service in the container which makes the
terminal in the VM behave almost equivalent to the one on the host.

This change makes testing changes to systemd using mkosi + QEMU a
lot easier compared to before as commands can be executed in the VM
from the comfort of one's terminal compared to the Linux console
available when running via the GTK GUI.
2020-12-08 10:03:25 +01:00
l4gfcm fc5dcf9697
hwdb: add funcional keys for MSI Modern series (tested on Modern 14) (#17880) 2020-12-08 09:57:17 +01:00
Yu Watanabe 78bc702503 man: synthetize(d) -> synthesize(d) 2020-12-08 09:24:11 +01:00
Yu Watanabe 105bfc9e72 missing: update warning messages 2020-12-08 15:35:57 +09:00
Yu Watanabe 6451baba82 missing: add missing syscalls for ia64, m68k, sparc, arc, and tilegx
These are not tested, but several syscalls are defined for these
architectures. Let's add syscalls comprehensively.
2020-12-08 15:32:25 +09:00
Yu Watanabe ae32a94efe missing: drop redundant condition 2020-12-08 14:54:20 +09:00
Yu Watanabe 86b8637435 missing: support 32bit powerpc 2020-12-08 14:51:58 +09:00
Yu Watanabe b8bcd4c69f missing: sort architectures in missing_syscall.h 2020-12-08 14:50:23 +09:00
Yu Watanabe b432080dc8 network: warn when NDISC and DHCPv6 provide the same address
With some router, the address in NDISC generated with EUI-64 conflicts
with an address provided by DHCPv6.

Prompted by #17831.
2020-12-08 13:36:19 +09:00
Yu Watanabe 450fa34bd0 network: fix SIGABRT related to unreachable route with DHCP6
After #17834, unreachable routes generated through DHCP6 are managed by
Manager. But they are referrenced by the DHCP6 uplink. So, the routes
managed by Manager must be freed after all Link objects are freed.

Follow-up for 575f14eef0.

Fixes SIGABRT reproted in #17831.
2020-12-08 12:41:07 +09:00
Yu Watanabe c5a0aeb33a network: use address_get() in address_exists()
And rename address_exists() to link_has_ipv6_address().
2020-12-08 12:41:07 +09:00
Yu Watanabe 1d30fc5cb6 network: revert previous changes to address_compare_func()
This partially reverts fe841414ef and
2a236f9fc0.

For IPv4, kernel compares the local address, prefix, and prefixlen.
For IPv6, kernel compares only the local address.
Let's follow the kernel's comparison way.

Fixes #17831.
2020-12-08 12:41:07 +09:00
Yu Watanabe e6f8828715 test: add tests for device_new_from_nulstr() 2020-12-08 12:35:51 +09:00
Yu Watanabe 31063db0b4 sd-device: keep escaped strings in DEVLINK= property
This fixes a bug introduced by 87a4d416e5.

Fixes #17772.
2020-12-08 12:35:47 +09:00
Yu Watanabe 6f3ac0d517 sd-device: use set_strjoin()
This slightly changes TAGS= and CURRENT_TAGS= properties:

Before
E: TAGS=:aaa:bbb:

After
E: TAGS=aaa:bbb
2020-12-08 12:28:58 +09:00
Yu Watanabe 4dbce71787 set: introduce set_strjoin() 2020-12-08 12:28:54 +09:00