]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agoAdd support for conditions on the machines firmware
Uwe Kleine-König [Fri, 9 Oct 2020 10:13:00 +0000 (12:13 +0200)] 
Add support for conditions on the machines firmware

This allows to limit units to machines that run on a certain firmware
type. For device tree defined machines checking against the machine's
compatible is also possible.

4 years agonetwork: neighbor: Always add neighbors with replace
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.

4 years agosystem-conf: drop reference to ShutdownWatchdogUsec=
Franck Bui [Tue, 27 Apr 2021 08:59:24 +0000 (10:59 +0200)] 
system-conf: drop reference to ShutdownWatchdogUsec=

Commit 65224c1d0e50667a87c2c4f840c49d4918718f80 renamed ShutdownWatchdogUsec
into RebootWatchdogUsec but left a reference of ShutdownWatchdogUsec in
system.conf.

4 years agoMerge pull request #17655 from wat-ze-hex/bpf-build-rule
Zbigniew Jędrzejewski-Szmek [Tue, 27 Apr 2021 10:52:30 +0000 (12:52 +0200)] 
Merge pull request #17655 from wat-ze-hex/bpf-build-rule

Introduce SocketBind{Allow|Deny}= properties powered by source compiled BPF

4 years agosystemctl: hide some empty properties without --all
Frantisek Sumsal [Mon, 26 Apr 2021 20:03:19 +0000 (22:03 +0200)] 
systemctl: hide some empty properties without --all

Fixes: #19423
4 years agofuzz: add SocketBind{Allow|Deny}= directive 17655/head
Julia Kartseva [Fri, 12 Feb 2021 07:15:17 +0000 (23:15 -0800)] 
fuzz: add SocketBind{Allow|Deny}= directive

4 years agoreadme: update README with requirements for bpf
Julia Kartseva [Sat, 28 Nov 2020 01:54:02 +0000 (17:54 -0800)] 
readme: update README with requirements for bpf

4 years agoman: add SocketBind{Allow|Deny}= documentation
Julia Kartseva [Wed, 18 Nov 2020 08:32:14 +0000 (00:32 -0800)] 
man: add SocketBind{Allow|Deny}= documentation

4 years agosystemctl: show SocketBind{Allow|Deny} properties
Julia Kartseva [Tue, 20 Apr 2021 23:33:29 +0000 (16:33 -0700)] 
systemctl: show SocketBind{Allow|Deny} properties

4 years agodbus: add dbus-cgroup for SocketBind{Allow|Deny}=
Julia Kartseva [Wed, 18 Nov 2020 08:31:55 +0000 (00:31 -0800)] 
dbus: add dbus-cgroup for SocketBind{Allow|Deny}=

4 years agotests: add test program for SocketBind{Allow|Deny}=
Julia Kartseva [Mon, 16 Nov 2020 08:26:44 +0000 (00:26 -0800)] 
tests: add test program for SocketBind{Allow|Deny}=

Verify that service exited correctly if valid ports are passed to
SocketBind{Allow|Deny}=
Use `ncat` program starting a listening service binding to a specified
port, e.g.
"timeout --preserve-status -sSIGTERM 1s /bin/nc -l -p ${port} -vv"

4 years agoshared, bpf: add bpf link serialization
Julia Kartseva [Mon, 19 Apr 2021 20:27:07 +0000 (13:27 -0700)] 
shared, bpf: add bpf link serialization

core: serialize socket_bind bpf links

4 years agocore: add SocketBind{Allow|Deny} fragment parser
Julia Kartseva [Tue, 20 Apr 2021 07:09:51 +0000 (00:09 -0700)] 
core: add SocketBind{Allow|Deny} fragment parser

4 years agocore: add socket-bind cgroup mask harness
Julia Kartseva [Thu, 12 Nov 2020 22:05:15 +0000 (14:05 -0800)] 
core: add socket-bind cgroup mask harness

Standard cgroup harness for bpf feature.

4 years agocore, bpf: add socket-bind feature to unit
Julia Kartseva [Mon, 26 Apr 2021 02:10:40 +0000 (19:10 -0700)] 
core, bpf: add socket-bind feature to unit

Add supported and install unit interface for socket-bind feature.

supported verifies that
- unified cgroup hierarchy (cgroup v2) is used
- BPF_FRAMEWORK (libbpf + clang + llvm + bpftool) was available in
compile time
- kernel supports BPF_PROG_TYPE_CGROUP_SOCK_ADDR
- bpf programs can be loaded into kernel
- bpf link can be used

install:
- load bpf_object from bpf skeleton
- resize rules map to fit socket_bind_allow and socket_bind deny rules
from cgroup context
- populate cgroup-bpf maps with rules
- get bpf programs from bpf skeleton
- attach programs to unit cgroup using bpf link
- save bpf link in the unit

4 years agocgroup: add socket-bind to cgroup context
Julia Kartseva [Wed, 10 Mar 2021 19:44:07 +0000 (11:44 -0800)] 
cgroup: add socket-bind to cgroup context

4 years agoshared, bpf: add bpf link helpers
Julia Kartseva [Fri, 12 Feb 2021 03:38:36 +0000 (19:38 -0800)] 
shared, bpf: add bpf link helpers

add can_link_bpf_program and bpf_link_free helpers.

4 years agomeson, bpf: add build rule for socket-bind program
Julia Kartseva [Tue, 20 Apr 2021 06:30:08 +0000 (23:30 -0700)] 
meson, bpf: add build rule for socket-bind program

4 years agomeson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
Julia Kartseva [Sat, 14 Nov 2020 01:08:15 +0000 (17:08 -0800)] 
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options

* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.

For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.

If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.

libbpf dependency is dynamic followed by the common pattern in systemd.

meson, bpf: add build rule for socket_bind program

4 years agobpf: add build script for bpf programs
Julia Kartseva [Sat, 14 Nov 2020 01:02:50 +0000 (17:02 -0800)] 
bpf: add build script for bpf programs

Add a build script to compile bpf source code. A program in restricted
C is compiled into an object file. Object file is converted to BPF
skeleton [0] header file.
If build with custom meson build rule, the target header will reside in
build/ directory (not in source tree), e.g the path for socket_bind:
`build/src/core/bpf/socket_bind/socket-bind.skel.h`

Script runs the phases:
* clang to generate *.o from restricted C
* llvm-strip to remove useless DWARF info
* bpf skeleton generation with bpftool
These phases are logged to stderr for debug purposes.

To include BTF debug information, -g option is passed to clang.

[0] https://lwn.net/Articles/806911/

4 years agobpf: add socket-bind BPF program code sources
Julia Kartseva [Sat, 14 Nov 2020 01:40:17 +0000 (17:40 -0800)] 
bpf: add socket-bind BPF program code sources

Introduce BPF program compiled from BPF source code in
restricted C - socket-bind.
It addresses feature request [0].

The goal is to allow systemd services to bind(2) only to a predefined set
of ports. This prevents assigning socket address with unallowed port
to a socket and creating servers listening on that port.

This compliments firewalling feature presenting in systemd:
whereas cgroup/{egress|ingress} hooks act on packets, this doesn't
protect from untrusted service or payload hijacking an important port.

While ports in 0-1023 range are restricted to root only, 1024-65535
range is not protected by any mean.

Performance is another aspect of socket_bind feature since per-packet
cost can be eliminated for some port-based filtering policies.

The feature is implemented with cgroup/bind{4|6} hooks [1].
In contrast to the present systemd approach using raw bpf instructions,
this program is compiled from sources. Stretch goal is to
make bpf ecosystem in systemd more friendly for developer and to clear
path for more BPF programs.

[0] https://github.com/systemd/systemd/pull/13496#issuecomment-570573085
[1] https://www.spinics.net/lists/netdev/msg489054.html

4 years agoMerge pull request #19416 from mrc0mmand/test-id-detection
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 21:03:13 +0000 (23:03 +0200)] 
Merge pull request #19416 from mrc0mmand/test-id-detection

test: "detect" the test number automagically

4 years agotest: reorganize the TEST-52 a bit 19416/head
Frantisek Sumsal [Sun, 25 Apr 2021 18:57:27 +0000 (20:57 +0200)] 
test: reorganize the TEST-52 a bit

4 years agotest: add a couple of hooks for the check_result_*() functions
Frantisek Sumsal [Mon, 26 Apr 2021 17:22:42 +0000 (19:22 +0200)] 
test: add a couple of hooks for the check_result_*() functions

So we don't have to duplicate the whole functions if we need to inject
some test-specific checks.

4 years agotest: "detect" the test number automagically
Frantisek Sumsal [Mon, 26 Apr 2021 17:20:18 +0000 (19:20 +0200)] 
test: "detect" the test number automagically

Specifying the test number manually is tedious and prone to errors (as
recently proven). Since we have all the necessary data to work out the
test number, let's do it automagically.

4 years agoMerge pull request #19383 from keszybz/test58-fixes
Frantisek Sumsal [Mon, 26 Apr 2021 17:16:44 +0000 (19:16 +0200)] 
Merge pull request #19383 from keszybz/test58-fixes

Fixes for TEST-58-REPART and ExecStart deserialization logic

4 years agotest-unit-serialize: add a very basic test that command deserialization works 19383/head
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 10:37:09 +0000 (12:37 +0200)] 
test-unit-serialize: add a very basic test that command deserialization works

We should test both serialization and deserialization works properly.
But the serialization/deserialization code is deeply entwined with the
manager state, and I think quite a bit of refactoring will be required before
this is possible. But let's at least add this simple test for now.

4 years agoMerge pull request #19286 from yuwata/network-dhcp-routes-to-dns-19077
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 13:10:41 +0000 (15:10 +0200)] 
Merge pull request #19286 from yuwata/network-dhcp-routes-to-dns-19077

network: dhcp4: set gateway for route to dns server if it is not in the same network

4 years agonetwork: update comment and log message
Yu Watanabe [Mon, 26 Apr 2021 00:03:33 +0000 (09:03 +0900)] 
network: update comment and log message

After 4b30f2e135ee84041bb597edca7225858f4ef4fb, reading stable_secret
sysctl property fails with -ENOMEM, instead of -EIO.
This is due to read_full_virtual_file() uses read() as the backend while
read_one_line_file() uses fgetc(). And each functions return different
error on fails.

Anyway, the failure is harmless here. So, the log message and comment is
updated.

Closes one of the issues in #19410.

4 years agoMerge pull request #19421 from yuwata/fix-typo
Luca Boccassi [Mon, 26 Apr 2021 09:08:07 +0000 (10:08 +0100)] 
Merge pull request #19421 from yuwata/fix-typo

core, network: Fix typo

4 years agonetwork: add missing sections
Yu Watanabe [Sun, 25 Apr 2021 23:16:08 +0000 (08:16 +0900)] 
network: add missing sections

Follow-up for 4e26a5baa0045c8bbb899f0c72f07ac630692bd3.

Fixes one of issues in #19410.

4 years agocore/service: fix typo 19421/head
Yu Watanabe [Mon, 26 Apr 2021 00:20:24 +0000 (09:20 +0900)] 
core/service: fix typo

Follow-up for bbe19f68846bb3cd5fcf3e4f612268064df53b53.

4 years agonetwork: fix typo
Yu Watanabe [Mon, 26 Apr 2021 00:19:38 +0000 (09:19 +0900)] 
network: fix typo

Follow-up for 4b409e855b18c263b0526c826fdca16215a4cf2e.

4 years agoMerge pull request #19411 from poettering/homectl-fixes
Lennart Poettering [Sat, 24 Apr 2021 07:17:38 +0000 (09:17 +0200)] 
Merge pull request #19411 from poettering/homectl-fixes

homectl password caching fixes

4 years agohomectl: pick up cached/credential store/env var passwords *before* issuing first... 19411/head
Lennart Poettering [Fri, 23 Apr 2021 14:31:12 +0000 (16:31 +0200)] 
homectl: pick up cached/credential store/env var passwords *before* issuing first request

Previously, we'd generally attempt the operation first, without any
passwords, and only query for a password if that operation then fails
and asks for one. This is done to improve compatibility with
password-less authentication schemes, such as security tokens and
similar.

This patch modifies this slightly: if a password can be acquired cheaply
via the keyring password cache, the $CREDENTIALS_PATH credential store,
or the $PASSWORD/$PIN environment variables, acquire it *before* issuing
the first requested.

This should save us a pointless roundtrip, and should never hurt.

4 years agohomectl: don't use password cache if we operate on other user
Lennart Poettering [Fri, 23 Apr 2021 14:14:57 +0000 (16:14 +0200)] 
homectl: don't use password cache if we operate on other user

4 years agohomectl: don't use cached passwords when re-requesting password because wrong
Lennart Poettering [Fri, 23 Apr 2021 12:53:32 +0000 (14:53 +0200)] 
homectl: don't use cached passwords when re-requesting password because wrong

Asking repeatedly for a password is pointless if we always use the same
cached one. Let's thus disable cache use whenever we failed already
once.

4 years agotest: use systemd-run -P instead of -t in TEST-50
Lennart Poettering [Fri, 23 Apr 2021 15:17:26 +0000 (17:17 +0200)] 
test: use systemd-run -P instead of -t in TEST-50

We want to use the result in a shell pipeline hence use -P mode (pipe
mode) instead of -t mode (interactive tty mode) for systemd-run.

This shouldn't change much about the test, but is slightly more correct
(and quicker).

4 years agotests: use setfacl to give $SUDO_USER read permissions on artifacts
Zbigniew Jędrzejewski-Szmek [Tue, 20 Apr 2021 15:47:50 +0000 (17:47 +0200)] 
tests: use setfacl to give $SUDO_USER read permissions on artifacts

We have to invoke the tests as superuser, and not being able to read
the journal as the invoking user is annoying. I don't think there are
any security considerations here, since the invoking user can already
put arbitrary code in the Makefile and test scripts which get executed
with root privileges.

4 years agoMerge pull request #19156 from dtardon/enable-warn
Luca Boccassi [Fri, 23 Apr 2021 15:43:45 +0000 (16:43 +0100)] 
Merge pull request #19156 from dtardon/enable-warn

install: warn if WantedBy targets don't exist

4 years agofstab-generator: clean up mount point flags handling
Lennart Poettering [Wed, 7 Apr 2021 09:44:29 +0000 (11:44 +0200)] 
fstab-generator: clean up mount point flags handling

Let's rename MountpointsFlags → MountPointFlags. In most of our codebase
we name things mount_point/MountPoint rather than mountpoint/Mountpoint,
do so here too.

Also, prefix the enum values with "MOUNT_". The fact the enum values
weren#t prefixed was pretty unique in our codebase, and pretty
surprising. Let's fix that.

This is just refactoring, no actual change in behaviour

4 years agocore/service: also reject deserialized commands with no argv[0]
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 10:40:07 +0000 (12:40 +0200)] 
core/service: also reject deserialized commands with no argv[0]

I'm pretty sure that bad things would happen later on.

4 years agocore/service: fix deserialization of non-absolute commands
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 10:39:03 +0000 (12:39 +0200)] 
core/service: fix deserialization of non-absolute commands

We'd fail with:
Apr 23 10:58:26 systemd[1]: Deserializing state...
Apr 23 10:58:26 systemd[1]: testsuite-01.service: Failed to parse serialized command "ExecStart 0 sh "sh" "-e" "-x" "-c" "systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok"": Invalid argument
Apr 23 10:58:26 systemd[1]: testsuite-01.service: Reinstalled deserialized job testsuite-01.service/start as 209

This was missed in 5008da1ec1, and apparently nobody noticed until now :(

4 years agoTEST-58: exit immediately if systemd-repart is not available
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 21:37:57 +0000 (23:37 +0200)] 
TEST-58: exit immediately if systemd-repart is not available

Debian disables systemd-repart at config time.

4 years agoTEST-58: only run under qemu
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 14:26:18 +0000 (16:26 +0200)] 
TEST-58: only run under qemu

In a container, /dev/loop* will most likely be inaccessible.

4 years agotest: move the logic to support /skipped into shared logic
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 08:55:49 +0000 (10:55 +0200)] 
test: move the logic to support /skipped into shared logic

The logic to query test state was rather complex. I don't quite grok the point
of ret=$((ret+1))… But afaics, the precise result was always ignored by the
caller anyway.

4 years agovarious: print the image path when setting up of the loopback device fails
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 07:07:30 +0000 (09:07 +0200)] 
various: print the image path when setting up of the loopback device fails

4 years agocore: fix typos in comment
Zbigniew Jędrzejewski-Szmek [Tue, 20 Apr 2021 16:28:19 +0000 (18:28 +0200)] 
core: fix typos in comment

4 years agoTODO: add some items for repart
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 07:37:18 +0000 (09:37 +0200)] 
TODO: add some items for repart

4 years agoTEST-58: remove stale artifacts to not fail on repeated invocations
Zbigniew Jędrzejewski-Szmek [Tue, 20 Apr 2021 15:53:55 +0000 (17:53 +0200)] 
TEST-58: remove stale artifacts to not fail on repeated invocations

We would remove stuff only if successful, so repeated invocations would
trivially fail.

Also drop "-f", so that if we expect to remove something, it must be there.

4 years agotests: install mkfs.ext4, mkfs.vfat and modules into the test image
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 07:58:26 +0000 (09:58 +0200)] 
tests: install mkfs.ext4, mkfs.vfat and modules into the test image

This allows TEST-58-REPART to at least start. It fails later with with loopback
device errors.

4 years agoTEST-58: adjust whitespace and enable pipefail
Zbigniew Jędrzejewski-Szmek [Tue, 20 Apr 2021 15:07:41 +0000 (17:07 +0200)] 
TEST-58: adjust whitespace and enable pipefail

4 years agoTEST-58: execute the right test
Zbigniew Jędrzejewski-Szmek [Tue, 20 Apr 2021 14:10:25 +0000 (16:10 +0200)] 
TEST-58: execute the right test

4 years agotest: configure swap for TEST-55-OOMD
Frantisek Sumsal [Thu, 22 Apr 2021 14:26:25 +0000 (16:26 +0200)] 
test: configure swap for TEST-55-OOMD

oomd works way better with swap, so let's make the test less flaky by
configuring a swap device for it. This also allows us to drop the ugly
`cat`s from the load-generating script.

4 years agologind:add missing equal sign
jiangchuangang [Fri, 23 Apr 2021 07:55:52 +0000 (15:55 +0800)] 
logind:add missing equal sign

4 years agoMerge pull request #19124 from takaswie/topic/fw-audio-entries
Lennart Poettering [Fri, 23 Apr 2021 09:31:34 +0000 (11:31 +0200)] 
Merge pull request #19124 from takaswie/topic/fw-audio-entries

hwdb/rule: add database and rules for known audio  and music unit in IEEE 1394 bus

4 years agoAdd D-Bus property exposing Ctrl-Alt-Delete action (#19217)
Flos Lonicerae [Fri, 23 Apr 2021 07:57:14 +0000 (15:57 +0800)] 
Add D-Bus property exposing Ctrl-Alt-Delete action (#19217)

4 years agotest-install-root: add test for unknown WantedBy= target 19156/head
David Tardon [Wed, 31 Mar 2021 08:38:00 +0000 (10:38 +0200)] 
test-install-root: add test for unknown WantedBy= target

4 years agoinstall: warn if WantedBy targets don't exist
Jan Synacek [Wed, 3 Jun 2020 08:33:21 +0000 (10:33 +0200)] 
install: warn if WantedBy targets don't exist

Currently, if [Install] section contains WantedBy=target that doesn't exist,
systemd creates the symlinks anyway. That is just user-unfriendly.
Let's be nice and warn about installing non-existent targets.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1835351.

Replaces: #15834

4 years agotest-install-root: create referenced targets
David Tardon [Wed, 31 Mar 2021 08:08:31 +0000 (10:08 +0200)] 
test-install-root: create referenced targets

4 years agotest-network: update tests for DHCP routes 19286/head
Yu Watanabe [Mon, 12 Apr 2021 15:23:38 +0000 (00:23 +0900)] 
test-network: update tests for DHCP routes

This removes static-route option from the default dnsmasq command.

4 years agonetwork: dhcp4: ignore null dns address
Yu Watanabe [Tue, 13 Apr 2021 07:24:52 +0000 (16:24 +0900)] 
network: dhcp4: ignore null dns address

4 years agonetwork: dhcp4: set gateway for route to DNS server if it is not in the same network
Yu Watanabe [Sun, 11 Apr 2021 09:22:04 +0000 (18:22 +0900)] 
network: dhcp4: set gateway for route to DNS server if it is not in the same network

Fixes #19077.

4 years agonetwork: dhcp4: ignore gateway in static routes if destination is link-local or in...
Yu Watanabe [Mon, 12 Apr 2021 14:52:49 +0000 (23:52 +0900)] 
network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network

This also configures routes to gateways in static routes if the
destination is not in the same network.

4 years agonetwork: dhcp4: also set route MTU to prefix route and DNS routes
Yu Watanabe [Sun, 11 Apr 2021 10:12:27 +0000 (19:12 +0900)] 
network: dhcp4: also set route MTU to prefix route and DNS routes

4 years agoMerge pull request #19392 from yuwata/network-dhcp-split-link_set_dhcp_routes
Yu Watanabe [Thu, 22 Apr 2021 23:32:46 +0000 (08:32 +0900)] 
Merge pull request #19392 from yuwata/network-dhcp-split-link_set_dhcp_routes

network: split link_set_dhcp_routes() into smaller functions

4 years agoMerge pull request #19336 from pdmorrow/reloading_restart
Lennart Poettering [Thu, 22 Apr 2021 14:39:06 +0000 (16:39 +0200)] 
Merge pull request #19336 from pdmorrow/reloading_restart

core,test: services in reloading state should exit without waiting TimeoutStartSec

4 years agoMerge pull request #19346 from mihajlov/dhcp_broadcast_l3
Dimitri John Ledkov [Thu, 22 Apr 2021 13:22:50 +0000 (14:22 +0100)] 
Merge pull request #19346 from mihajlov/dhcp_broadcast_l3

network: enable DHCP broadcast flag if required by interface

4 years agoMerge pull request #19390 from poettering/repart-copy-fixes
Luca Boccassi [Thu, 22 Apr 2021 13:06:10 +0000 (14:06 +0100)] 
Merge pull request #19390 from poettering/repart-copy-fixes

repart: fix CopyFiles= corner case when copying into root dir of newly formatted fs

4 years agodissect: fix two minor typos in comments
Lennart Poettering [Thu, 22 Apr 2021 12:34:53 +0000 (14:34 +0200)] 
dissect: fix two minor typos in comments

4 years agoboot/efi: compile on riscv64
Emil Renner Berthing [Thu, 22 Apr 2021 07:33:51 +0000 (09:33 +0200)] 
boot/efi: compile on riscv64

This makes systemd-boot compile against the latest gnu-efi which
just added support for riscv64.

4 years agodissect-image: prefer PARTN= uevent property over "partition" sysfs attr
Lennart Poettering [Thu, 22 Apr 2021 09:31:14 +0000 (11:31 +0200)] 
dissect-image: prefer PARTN= uevent property over "partition" sysfs attr

The kernel will send us a PARTN= uevent proprty with partition add
events, let's use it instead of going for the "partition" sysfs attr.
It's less racy that way and there are reports the sysfs attr shows up
after the device, which makes it evern worse.

4 years agotest: add a test to cover restarting services in reloading state 19336/head
Peter Morrow [Tue, 13 Apr 2021 16:22:52 +0000 (17:22 +0100)] 
test: add a test to cover restarting services in reloading state

Cover the case where a service is recovered out of reloading state via
a restart Restart= configuration.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agocore: allow services stuck in reloading state to exit
Peter Morrow [Tue, 13 Apr 2021 16:20:42 +0000 (17:20 +0100)] 
core: allow services stuck in reloading state to exit

If a service is in reloading state but has exited do not delay
the final exit until the service reload timer expires. Instead allow
the service to exit immediately since we can't expect the service to
ever transition out of reloading state.

For example if a service sent RELOADING=1 but crashed before it could
send READY=1 then it should be restarted if the service had
Restart= configured.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agofix: point to the correct drop-ins subdirectory for confs
Jóhann B. Guðmundsson [Wed, 21 Apr 2021 21:09:29 +0000 (21:09 +0000)] 
fix: point to the correct drop-ins subdirectory for confs

4 years agogpt: we actually honour the ReadOnly= flag on XBOOTLDR partitions too
Lennart Poettering [Wed, 21 Apr 2021 15:38:21 +0000 (17:38 +0200)] 
gpt: we actually honour the ReadOnly= flag on XBOOTLDR partitions too

The partition type is defined in our Discoverable Partition Spec, and we
honour the flag for it, hence allow setting it too.

4 years agonetwork: dhcp4: simplify link_set_dns_routes() 19392/head
Yu Watanabe [Sun, 11 Apr 2021 23:48:29 +0000 (08:48 +0900)] 
network: dhcp4: simplify link_set_dns_routes()

4 years agonetwork: dhcp4: introduce link_set_dhcp_gateway() and link_set_dhcp_route_to_gateway()
Yu Watanabe [Sun, 11 Apr 2021 23:43:09 +0000 (08:43 +0900)] 
network: dhcp4: introduce link_set_dhcp_gateway() and link_set_dhcp_route_to_gateway()

4 years agonetwork: dhcp4: introduce link_set_dhcp_static_routes()
Yu Watanabe [Sun, 11 Apr 2021 23:22:24 +0000 (08:22 +0900)] 
network: dhcp4: introduce link_set_dhcp_static_routes()

4 years agonetwork: dhcp4: introduce link_set_dhcp_prefix_route()
Yu Watanabe [Sun, 11 Apr 2021 10:11:26 +0000 (19:11 +0900)] 
network: dhcp4: introduce link_set_dhcp_prefix_route()

4 years agorepart: don't try to extract directory of root dir when copying directories 19390/head
Lennart Poettering [Wed, 21 Apr 2021 21:23:07 +0000 (23:23 +0200)] 
repart: don't try to extract directory of root dir when copying directories

It's OK to specify the root dir as target directory when copying
directories. However, in that case path_extract_filename() is going to
fail, because the root dir simply has not filename.

Let's address that by moving the call further down into the loop, when
we made sure that the target dir doesn't exist yet (the root dir always
exists, hence this check is sufficient).

Moreover, in the branch for copying regular files, also move the calls
down, and generate friendly error messages in case people try to
overwrite dirs with regular files (and the root dir is just a special
case of a dir).

Altogether this makes CopyFiles=/some/place:/ work, i.e. copying some
dir on the host into the root dir of the newly created fs. Previously
this would fail with an error about the inability to extract a filename
from "/", needlessly.

4 years agorepart: don't use basename() when we called path_extract_filename() anyway already
Lennart Poettering [Wed, 21 Apr 2021 21:22:26 +0000 (23:22 +0200)] 
repart: don't use basename() when we called path_extract_filename() anyway already

We already have the string, use it.

4 years agorepart: prefix the correct path with root dir in log output
Lennart Poettering [Wed, 21 Apr 2021 21:21:21 +0000 (23:21 +0200)] 
repart: prefix the correct path with root dir in log output

When we copy files into the freshly formatted file system, the mount
point prefix must be prepended to the *target* path, not the *source*
path. Not just in code but in the log message about it, too.

4 years agoMerge pull request #19387 from poettering/discoverable-part-fix
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 21:10:48 +0000 (23:10 +0200)] 
Merge pull request #19387 from poettering/discoverable-part-fix

minor doc fixes

4 years agojournald: Retry if posix_fallocate returned -1 (EINTR)
Igor Zhbanov [Tue, 20 Apr 2021 17:22:28 +0000 (17:22 +0000)] 
journald: Retry if posix_fallocate returned -1 (EINTR)

On some conditions (particularly when mobile CPUs are going to sleep),
the posix_fallocate(), which is called when a new journal file is allocated,
can return -1 (EINTR). This is counted as a fatal error. So the journald
closes both old and journals, and simply throwing away further incoming
events, because of no log files open.

Introduce posix_fallocate_loop() that restarts the function in the case
of EINTR. Also let's make code base more uniform by returning negative
values on error.

Fix assert in test-sigbus.c that incorrectly counted positive values as
success. After changing the function return values, that will actually work.

Fixes: #19041
Signed-off-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
4 years agodoc: slightly reorder/improve partition type table 19387/head
Lennart Poettering [Wed, 21 Apr 2021 16:12:25 +0000 (18:12 +0200)] 
doc: slightly reorder/improve partition type table

Let's put swap and generic linux data partitions next to each other, and
clarify they predated this spec.

4 years agodoc: verity partitions may only contain Verity data (fix copypasta)
Lennart Poettering [Wed, 21 Apr 2021 16:10:08 +0000 (18:10 +0200)] 
doc: verity partitions may only contain Verity data (fix copypasta)

4 years agoman: --add was renamed --copy-to when it was merged, fix man page reference to it
Lennart Poettering [Wed, 21 Apr 2021 15:00:45 +0000 (17:00 +0200)] 
man: --add was renamed --copy-to when it was merged, fix man page reference to it

4 years agoMerge pull request #19271 from yuwata/dhcp-duid-uuid
Lennart Poettering [Wed, 21 Apr 2021 19:59:35 +0000 (21:59 +0200)] 
Merge pull request #19271 from yuwata/dhcp-duid-uuid

network: fix issues arround DHCP DUID-UUID

4 years agoMerge pull request #19365 from keszybz/sd_id128_equals
Lennart Poettering [Wed, 21 Apr 2021 19:45:14 +0000 (21:45 +0200)] 
Merge pull request #19365 from keszybz/sd_id128_equals

Add sd_id128_in_set()

4 years agoupdate TODO
Lennart Poettering [Wed, 21 Apr 2021 19:43:33 +0000 (21:43 +0200)] 
update TODO

4 years agoMerge pull request #19381 from poettering/generator-tweaks
Lennart Poettering [Wed, 21 Apr 2021 16:33:05 +0000 (18:33 +0200)] 
Merge pull request #19381 from poettering/generator-tweaks

generator: two minor tweaks

4 years agogenerator: write out special systemd-fsck-usr.service
Lennart Poettering [Wed, 7 Apr 2021 08:57:19 +0000 (10:57 +0200)] 
generator: write out special systemd-fsck-usr.service

So far all file systems where checked by instances of
systemd-fsck@.service, with the exception of the root fs which was
covered by systemd-fsck-root.service. The special handling is necessary
to deal with ordering issues: we typically want the root fs to be
checked before all others, and — weirdly — allow mounting it before the
fsck done (for compat with initrd-less boots).

This adds similar special handling for /usr: if the hierarchy is placed
on a separate file system check it with a special
systemd-fsck-usr.service instead of a regular sysemd-fsck@.service
instance. Reason is again ordering: we want to allow mounting of /usr
without the root fs already being around in the initrd, to cover for
cases where the root fs is created on first boot and thus cannot be
mounted/checked before /usr.

4 years agoMerge pull request #19362 from yuwata/network-dhcp6-pd-log-19354
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 16:20:49 +0000 (18:20 +0200)] 
Merge pull request #19362 from yuwata/network-dhcp6-pd-log-19354

network: dhcp6: add logs about delegated prefix

4 years agoMerge pull request #19370 from mrc0mmand/shellcheck-pt4
Zbigniew Jędrzejewski-Szmek [Wed, 21 Apr 2021 16:14:32 +0000 (18:14 +0200)] 
Merge pull request #19370 from mrc0mmand/shellcheck-pt4

More shellcheck shenanigans

4 years agonetwork: enable DHCP broadcast flag if required by interface 19346/head
Viktor Mihajlovski [Wed, 14 Apr 2021 11:01:35 +0000 (13:01 +0200)] 
network: enable DHCP broadcast flag if required by interface

Some interfaces require that the DHCPOFFER message is sent via broadcast
if they can't receive unicast messages before they've been configured
with an IP address.

E.g., s390 ccwgroup network interfaces operating in layer3 mode face
this limitation. This can prevent the interfaces from receiving an
IP address via DHCP, if the have been configured for layer3.

To allow DHCP over such interfaces, we're introducing a new device
property ID_NET_DHCP_BROADCAST which can be set for those.
The networkd DHCP client will check whether this property is set
for an interface, and if so will set the broadcast flag, unless
the network configuration for the interface has an explicit
RequestBroadcast setting.

Besides that, we're adding a udev rule to set this device property
for ccwgroup devices operating in layer3 mode, which is the case
if the ID_NET_DRIVER property is qeth_l3.

Supercedes #18829

4 years agorepart: reword log message 19365/head
Zbigniew Jędrzejewski-Szmek [Mon, 19 Apr 2021 13:43:01 +0000 (15:43 +0200)] 
repart: reword log message

The UUID does not exist, a partion with the UUID exists. So let's
say that the UUID is "already used" for clarity.

4 years agopartition,shared/gpt: use sd_id128_in_set()
Zbigniew Jędrzejewski-Szmek [Mon, 19 Apr 2021 13:42:05 +0000 (15:42 +0200)] 
partition,shared/gpt: use sd_id128_in_set()

I was worried that the text size will grow, but apparently that's not the
case:
With --optimization=2:
$ size build/src/shared/libsystemd-shared-248.a.p/gpt.c.o*
   text    data     bss     dec     hex filename
   3674    1104       0    4778    12aa build/src/shared/libsystemd-shared-248.a.p/gpt.c.o.old
   3085    1104       0    4189    105d build/src/shared/libsystemd-shared-248.a.p/gpt.c.o

(I don't understand the generated assembly, even though it seems to work:

Disassembly of section .text.gpt_partition_type_is_usr_verity:

0000000000000000 <gpt_partition_type_is_usr_verity>:

bool gpt_partition_type_is_usr_verity(sd_id128_t id) {
   0:   48 83 ec 08             sub    $0x8,%rsp
        return sd_id128_in_set(id,
   4:   4c 8b 05 00 00 00 00    mov    0x0(%rip),%r8        # b <gpt_partition_type_is_usr_verity+0xb>
   b:   31 c0                   xor    %eax,%eax
   d:   4c 8b 0d 00 00 00 00    mov    0x0(%rip),%r9        # 14 <gpt_partition_type_is_usr_verity+0x14>
  14:   48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 1b <gpt_partition_type_is_usr_verity+0x1b>
  1b:   48 8b 0d 00 00 00 00    mov    0x0(%rip),%rcx        # 22 <gpt_partition_type_is_usr_verity+0x22>
  22:   6a 00                   pushq  $0x0
  24:   6a 00                   pushq  $0x0
  26:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 2c <gpt_partition_type_is_usr_verity+0x2c>
  2c:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 32 <gpt_partition_type_is_usr_verity+0x32>
  32:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 38 <gpt_partition_type_is_usr_verity+0x38>
  38:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 3e <gpt_partition_type_is_usr_verity+0x3e>
  3e:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 44 <gpt_partition_type_is_usr_verity+0x44>
  44:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 4a <gpt_partition_type_is_usr_verity+0x4a>
  4a:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 50 <gpt_partition_type_is_usr_verity+0x50>
  50:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 56 <gpt_partition_type_is_usr_verity+0x56>
  56:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 5c <gpt_partition_type_is_usr_verity+0x5c>
  5c:   ff 35 00 00 00 00       pushq  0x0(%rip)        # 62 <gpt_partition_type_is_usr_verity+0x62>
  62:   e8 00 00 00 00          callq  67 <gpt_partition_type_is_usr_verity+0x67>
  67:   85 c0                   test   %eax,%eax
  69:   0f 95 c0                setne  %al
                               GPT_USR_ARM_VERITY,
                               GPT_USR_ARM_64_VERITY,
                               GPT_USR_IA64_VERITY,
                               GPT_USR_RISCV32_VERITY,
                               GPT_USR_RISCV64_VERITY);
}
  6c:   48 83 c4 68             add    $0x68,%rsp
  70:   c3                      retq
)

4 years agosd-id128: add convenience functions to compare multiple sd_id128_t
Zbigniew Jędrzejewski-Szmek [Mon, 19 Apr 2021 13:36:10 +0000 (15:36 +0200)] 
sd-id128: add convenience functions to compare multiple sd_id128_t

Similar to sd_bus_error_has_names() that was added in
2b07ec316a0e25a3e10c270c7f6baee9e0187bf8.

It is made inline in the hope that the compiler will be able to optimize
all the va_args boilerplate away, and do an efficient comparison when
the arguments are all constants.

4 years agojournald: enforce longer line length limit during "setup" phase of stream protocol
Yangyang Shen [Wed, 24 Mar 2021 13:23:01 +0000 (21:23 +0800)] 
journald: enforce longer line length limit during "setup" phase of stream protocol

This PR made modification on Lennart Poettering's basis. Fix the LineMax's function failure problem.

Signed-off-by: Yangyang Shen <shenyangyang4@huawei.com>