Commit Graph

45425 Commits

Author SHA1 Message Date
Lennart Poettering 3f8ed9fd96 update TODO 2020-06-24 15:34:10 +02:00
Lennart Poettering 18d9cee002 man: document systemd.random-seed= 2020-06-24 15:33:48 +02:00
Lennart Poettering d247f232a8 core: add new systemd.random_seed= kernel command line option for seeding entropy pool
This is useful in test environments with entropy starved VMs.
2020-06-24 15:33:44 +02:00
Lennart Poettering 4dd055f907 random-util: add common helper random_write_entropy() for crediting entropy to the kernel's pool 2020-06-24 15:33:27 +02:00
Lennart Poettering 45250e66cc pid1: don't apply "systemd.clock_usec" kernel cmdline parameter outside of PID 1 2020-06-24 15:33:22 +02:00
Lennart Poettering 97f1c6af8c random-seed: use ERRNO_IS_NOT_SUPPORTED() where appropriate 2020-06-24 15:32:38 +02:00
Jay Burger a1ba8c5b71 feature to honor first shutdown request to completion
Create unit tests per established norm at position 52

check in_set first before getting unit
2020-06-24 09:42:01 +02:00
Lennart Poettering 7bf6babfa2
Merge pull request #16112 from poettering/nss-systemd-block-fix
rework nss-systemd recursion lock
2020-06-24 08:39:44 +02:00
Lennart Poettering bc8d57f290
Merge pull request #16223 from cgzones/user_selinux
Initialize SELinux in user instances
2020-06-24 08:39:13 +02:00
Christian Göttsche 3d9fbea43e selinux: update mac_selinux_free()
* Drop mac_selinux_use() condition from mac_selinux_free(): if the
  passed pointer holds memory we want to free it even if SELinux is
  disabled

* Drop NULL-check cause man:freecon(3) states that freecon(NULL) is a
  well-defined NOP

* Assert that on non-SELinux builds the passed pointer is always NULL,
  to avoid memory leaks
2020-06-24 08:38:34 +02:00
Gigadoc2 1cdc42f283
hwdb: add another Logitech G502 Hero variant (#16256)
The commit 67551ea already adds the G502 Hero mouse, but apparently
there are multiple variants with the same ID but different names.
2020-06-24 09:46:46 +10:00
Zbigniew Jędrzejewski-Szmek 0d0248c665
Merge pull request #16246 from benzea/benzea/xdg-autostart
Minor xdg-autostart changes
2020-06-23 21:13:07 +02:00
Zbigniew Jędrzejewski-Szmek 21856e3462
Merge pull request #16213 from yuwata/network-cleanup-link-state-file
network: cleanup link state file
2020-06-23 21:09:24 +02:00
Luca Boccassi 87d25bdead make-autosuspend-rules: restore compatibility with Python3 < 3.6
The f'...' format was introduced in Python 3.6 ( https://www.python.org/dev/peps/pep-0498/ )
and returns an error when systemd is built on a system with an older Python3 version:

<...>
  File /home/bluca/git/systemd/tools/make-autosuspend-rules.py, line 15
    print(f'pci:v{vendor:08X}d{device:08X}*')
                                           ^
SyntaxError: invalid syntax
[2/388] Generating version.h with a custom command.
ninja: build stopped: subcommand failed.
$ python3 --version
Python 3.5.6

Use an older format to keep backward compatibility.
2020-06-23 21:02:15 +02:00
Christian Göttsche a9ba0e328f Make failures of mac_selinux_init() fatal 2020-06-23 19:10:07 +02:00
Christian Göttsche a11bfc17dc Initialize SELinux in user instances
Call mac_selinux_init() to setup the label cache, so objects can be
created with default SELinux context.

Fixes: #8004
2020-06-23 19:10:03 +02:00
Lennart Poettering 037b0a47b0 userdb: replace recursion lock
Previously we'd used the existance of a specific AF_UNIX socket in the
abstract namespace as lock for disabling lookup recursions. (for
breaking out of the loop: userdb synthesized from nss → nss synthesized
from userdb → userdb synthesized from nss → …)

I did it like that because it promised to work the same both in static
and in dynmically linked environments and is accessible easily from any
programming language.

However, it has a weakness regarding reuse attacks: the socket is
securely hashed (siphash) from the thread ID in combination with the
AT_RANDOM secret. Thus it should not be guessable from an attacker in
advance. That's only true if a thread takes the lock only once and
keeps it forever. However, if a thread takes and releases it multiple
times an attacker might monitor that and quickly take the lock
after the first iteration for follow-up iterations.

It's not a big issue given that userdb (as the primary user for this)
never released the lock and we never made the concept a public
interface, and it was only included in one release so far, but it's
something that deserves fixing. (moreover it's a local DoS only, only
permitting to disable native userdb lookups)

With this rework the libnss_systemd.so.2 module will now export two
additional symbols. These symbols are not used by glibc, but can be used
by arbitrary programs: one can be used to disable nss-systemd, the other
to check if it is currently disabled.

The lock is per-thread. It's slightly less pretty, since it requires
people to manually link against C code via dlopen()/dlsym(), but it
should work safely without the aforementioned weakness.
2020-06-23 17:24:24 +02:00
Lennart Poettering 6e78726e20 nss-systemd: skip /etc/gshadow look-ups when we just need the GID of a group 2020-06-23 17:24:24 +02:00
Lennart Poettering 88d775b734 util: add dlfcn-util.h
This just adds a _cleanup_ helper call encapsulating dlclose().

This also means libsystemd-shared is linked against libdl now. I don't
think this is much of an issue, since libdl is part of glibc anyway, and
anything from exotic. It's not an optional part of the OS (think: NSS
requires dynamic linking), hence this pulls in no deps and is almost
certainly loaded into all process' memory anyway.

[zj: use DEFINE_TRIVIAL_CLEANUP_FUNC().]
2020-06-23 17:23:27 +02:00
Lennart Poettering 21385e639a man: replace perl bug tracker link that went away with link to paper
Fixes: #16245
2020-06-23 17:19:05 +02:00
Lennart Poettering 92d64d1444 man: s/PROGRAMM/PROGRAM/ 2020-06-23 17:13:26 +02:00
Zbigniew Jędrzejewski-Szmek 311a0e2ee6 Revert "cgroup: Allow empty assignments of Memory{Low,Min}="
This reverts commit 53aa85af24.
The reason is that that patch changes the dbus api to be different than
the types declared by introspection api.

Replaces #16122.
2020-06-23 16:54:23 +02:00
Susant Sahani 3d0c8750c5 networkctl: display DHCPv4 server address 2020-06-23 19:13:06 +09:00
Yu Watanabe fd1f3b3eed dhcp: fix entry name in parsing lease file 2020-06-23 19:13:06 +09:00
Yu Watanabe 46986251d6 network: drop duplicated information from link state file
Those entries are already in DHCP4 lease file, and not used anymore.
2020-06-23 19:13:05 +09:00
Yu Watanabe 5202be27ee sd-network: drop unused functions 2020-06-23 19:13:05 +09:00
Yu Watanabe 862e710820 networkctl: use lease file to get DHCPv4 client ID 2020-06-23 19:13:05 +09:00
Yu Watanabe d41fa6ee91 networkctl: use lease file to get DHCPv4 address 2020-06-23 19:13:05 +09:00
Yu Watanabe 35cab5f99d networkctl: load DHCPv4 lease file and use timezone data from the lease file 2020-06-23 19:13:05 +09:00
Yu Watanabe ef0daa1129 libsystemd-network: move prototypes of dhcp_lese_save/load() to network-internal.h 2020-06-23 19:13:05 +09:00
Dave Reisner cc479760b4 Revert "job: Don't mark as redundant if deps are relevant"
This reverts commit 097537f07a.

At least Fedora and Debian have already reverted this at the distro
level because it causes more problems than it solves. Arch is debating
reverting it as well [0] but would strongly prefer that this happens
upstream first. Fixes #15188.

[0] https://bugs.archlinux.org/task/66458
2020-06-23 11:42:45 +02:00
Benjamin Berg 9d9a9500cd xdg-autostart: Ignore all files with GNOME autostart phase
If an autostart file for GNOME has a phase specified, then this implies
it is a session service that needs to be started at a specific time.

We have no way of handling the ordering, and while it does make sense
to explicitly hide these services with X-systemd-skip, there is no point
in even trying to handle them.
2020-06-23 11:20:27 +02:00
Benjamin Berg 566cb7e23b xdg-autostart: Fix info message if Type= is not Application
The message was copy-pasted and not changed to correctly specify what
the problem was.
2020-06-23 11:04:44 +02:00
Luca Boccassi 0389f4fa81 core: add RootHash and RootVerity service parameters
Allow to explicitly pass root hash (explicitly or as a file) and verity
device/file as unit options. Take precedence over implicit checks.
2020-06-23 10:50:09 +02:00
Lennart Poettering 6fe01ced0e nspawn: mkdir selinux mount point once, but not twice
Since #15533 we didn't create the mount point for selinuxfs anymore.

Before it we created it twice because we mount selinuxfs twice: once the
superblock, and once we remount its bind mound read-only. The second
mkdir would mean we'd chown() the host version of selinuxfs (since
there's only one selinuxfs superblock kernel-wide).

The right time to create mount point point is once: before we mount the
selinuxfs. But not a second time for the remount.

Fixes: #16032
2020-06-23 10:17:36 +02:00
Zbigniew Jędrzejewski-Szmek 75ae672bb2
Merge pull request #16196 from mrc0mmand/travis-simplification
travis: use a matrix for similar jobs
2020-06-23 10:16:18 +02:00
Zbigniew Jędrzejewski-Szmek 5c9918aca0
Merge pull request #16216 from nabijaczleweli/make-a-fuss
man/sd-makefs: mention that mkswap can also be run and fix deadlink to btrfs-man5(5)
2020-06-23 10:12:47 +02:00
Lennart Poettering 65804d6aff selinux-util: tweak log_enforcing_errno() to return the errno passed in or 0 when in non-enforcing mode
Also, some other, minor modernizations.
2020-06-23 07:48:44 +02:00
Elisei Roca 9e1732924d
test-functions: read /usr/etc/nsswitch.conf if /etc/nsswitch.conf does not exist (#16195)
See this for more info why and since when this change is needed: https://build.opensuse.org/request/show/807179.
2020-06-23 07:42:15 +02:00
наб affa893da0
man/sd-makefs: link to btrfs.wiki.kernel.org for btrfs-man5, since the man-pages link is dead
This also adds a <citerefentry project="url"> type,
since the other btrfs manpages use man-pages/die-net and are alive,
and btrfs.w.k.o won't be used anywhere else
2020-06-22 23:12:13 +02:00
Zbigniew Jędrzejewski-Szmek 2edc494216
Merge pull request #16237 from keszybz/revert-message-type-check
Revert "bus-message: immediately reject messages with invalid type"
2020-06-22 22:46:13 +02:00
Lennart Poettering c2c193f79a
Merge pull request #16179 from keszybz/auto-suspend-hwdb
Convert autosuspend rules to hwdb
2020-06-22 17:38:42 +02:00
Zbigniew Jędrzejewski-Szmek b98f393d88 bus-message: add macro for calculation of offset from the page 2020-06-22 17:18:35 +02:00
Zbigniew Jędrzejewski-Szmek b17af3e503 bus-message: avoid dereferencing a NULL pointer
We'd try to map a zero-byte buffer from a NULL pointer, which is undefined behaviour.

src/systemd/src/libsystemd/sd-bus/bus-message.c:3161:60: runtime error: applying zero offset to null pointer
    #0 0x7f6ff064e691 in find_part /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3161:60
    #1 0x7f6ff0640788 in message_peek_body /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3283:16
    #2 0x7f6ff064e8db in enter_struct_or_dict_entry /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3967:21
    #3 0x7f6ff06444ac in bus_message_enter_struct /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:4009:13
    #4 0x7f6ff0641dde in sd_bus_message_enter_container /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:4136:21
    #5 0x7f6ff0619874 in sd_bus_message_dump /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-dump.c:178:29
    #6 0x4293d9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-bus-message.c:39:9
    #7 0x441986 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:558:15
    #8 0x44121e in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:470:3
    #9 0x443164 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:770:7
    #10 0x4434bc in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:799:3
    #11 0x42d2bc in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:846:6
    #12 0x42978a in main /src/libfuzzer/FuzzerMain.cpp:19:10
    #13 0x7f6fef13c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #14 0x407808 in _start (out/fuzz-bus-message+0x407808)
2020-06-22 17:09:49 +02:00
Zbigniew Jędrzejewski-Szmek a9c9f79ece Revert "bus-message: immediately reject messages with invalid type"
This reverts commit a2dd991d0f.
Creation of such messages is evidently useful, and at least sdbus-c++ test
suite depends on that.

Fixes #16193.
2020-06-22 16:54:15 +02:00
Zbigniew Jędrzejewski-Szmek 7b33ff7388 make-autosuspend-rules: remove one instance of "whitelist"
Let's be clear what we mean exactly. Also see https://lwn.net/Articles/823224/
for general justification.
2020-06-22 14:47:49 +02:00
Zbigniew Jędrzejewski-Szmek 88936ed6f9 rules: remove 61-autosuspend-manual.rules
It doesn't hurt, but there's no point in keeping it now. Any changes
can be added to 60-autosuspend.hwdb.
2020-06-22 14:45:20 +02:00
Zbigniew Jędrzejewski-Szmek 39d5b72e32 hwdb: enable autosuspend for Wacom Pen and EMV Smartcard Reader
Replaces #16113.
2020-06-22 14:45:20 +02:00
Zbigniew Jędrzejewski-Szmek aa549ff397 test: also verify the generated autosuspend hwdb file
Hint: meson test -C build parse-hwdb -v
2020-06-22 14:45:20 +02:00
Zbigniew Jędrzejewski-Szmek 79dc5d35dd tools: rewrite make-autosuspend-rules.py and add udev rules
Concatenating strings is not a very efficient approach. And in this case fully
unnecessary. We also need some rules to make use of those hwdb entries.

PCI needs to be 8 characters, not 4. And we need to use uppercase hexadecimal
for both. With udev rules this made no difference, but hwdb match is case
sensitive.

Fixes #16119.
2020-06-22 14:45:20 +02:00