]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agocore/cgroup: use helper macro for bfq conversion 20522/head
Zbigniew Jędrzejewski-Szmek [Wed, 10 Nov 2021 10:37:15 +0000 (11:37 +0100)] 
core/cgroup: use helper macro for bfq conversion

As suggested in https://github.com/systemd/systemd/pull/20522#discussion_r696699984.

2 years agocore/cgroup: set bfq.weight first, and fixes blkio.weight value
Yu Watanabe [Tue, 24 Aug 2021 16:28:47 +0000 (01:28 +0900)] 
core/cgroup: set bfq.weight first, and fixes blkio.weight value

Fixes issues introduced by 29eb0eefd14afc9a2424781a28b376db47c3c570.

This also fixes the value sets to blkio.weight, that is, "default" is dropped.

Moreover, This also changes the logic for mapping weight -> bfq.weight,
to always matches the min, max, and default values.

Fixes #20519 and #21187.

2 years agoMerge pull request #20524 from weblate/weblate-systemd-master
Yu Watanabe [Mon, 23 Aug 2021 18:28:06 +0000 (03:28 +0900)] 
Merge pull request #20524 from weblate/weblate-systemd-master

Translations update from Weblate

2 years agopo: Translated using Weblate (Finnish) 20524/head
Jan Kuparinen [Mon, 23 Aug 2021 18:04:54 +0000 (20:04 +0200)] 
po: Translated using Weblate (Finnish)

Currently translated at 1.5% (3 of 189 strings)

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main

2 years agopo: Translated using Weblate (German)
Ettore Atalan [Mon, 23 Aug 2021 18:04:54 +0000 (20:04 +0200)] 
po: Translated using Weblate (German)

Currently translated at 70.3% (133 of 189 strings)

Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/main

2 years agoMerge pull request #20513 from yuwata/network-allow-deny-list-take-prefix-length
Yu Watanabe [Mon, 23 Aug 2021 17:01:51 +0000 (02:01 +0900)] 
Merge pull request #20513 from yuwata/network-allow-deny-list-take-prefix-length

network: dhcp4,ndisc: make addresses in Allow/DenyList= optionally take prefix length

2 years agojson: rework JSON_BUILD_XYZ() macros to use compound literals instead of compound...
Lennart Poettering [Mon, 23 Aug 2021 08:48:56 +0000 (10:48 +0200)] 
json: rework JSON_BUILD_XYZ() macros to use compound literals instead of compound statements

Compound statements is this stuff: ({ … })

Compound literals is this stuff: (type) { … }

We use compound statements a lot in macro definitions: they have one
drawback though: they define a code block of their own, hence if macro
invocations are nested within them that use compound literals their
lifetime is limited to the code block, which might be unexpected.

Thankfully, we can rework things from compound statements to compund
literals in the case of json.h: they don't open a new codeblack, and
hence do not suffer by the problem explained above.

The interesting thing about compound statements is that they also work
for simple types, not just for structs/unions/arrays. We can use this
here for a typechecked implicit conversion: we want to superficially
typecheck arguments to the json_build() varargs function, and we do that
by assigning the specified arguments to our compound literals, which
does the minimal amount of typechecks and ensures that types are
propagated on correctly.

We need one special tweak for this: sd_id128_t is not a simple type but
a union. Using compound literals for initialzing that would mean
specifiying the components of the union, not a complete sd_id128_t. Our
hack around that: instead of passing the object directly via the stack
we now take a pointer (and thus a simple type) instead.

Nice side-effect of all this: compound literals is C99, while compound
statements are a GCC extension, hence we move closer to standard C.

Fixes: #20501
Replaces: #20512

2 years agotest-network: add more testcases for *Allow/DenyList= 20513/head
Yu Watanabe [Mon, 23 Aug 2021 11:37:36 +0000 (20:37 +0900)] 
test-network: add more testcases for *Allow/DenyList=

2 years agonetwork: dhcp4,ndisc: make addresses in Allow/DenyList= optionally take prefix length
Yu Watanabe [Sun, 22 Aug 2021 16:36:21 +0000 (01:36 +0900)] 
network: dhcp4,ndisc: make addresses in Allow/DenyList= optionally take prefix length

Closes #20505.

2 years agoMerge pull request #20498 from yuwata/network-fix-gateway
Yu Watanabe [Sun, 22 Aug 2021 13:58:20 +0000 (22:58 +0900)] 
Merge pull request #20498 from yuwata/network-fix-gateway

network: fix logic for checking gateway address

2 years agopo: Added translation using Weblate (Finnish)
Jan Kuparinen [Sun, 22 Aug 2021 10:19:47 +0000 (12:19 +0200)] 
po: Added translation using Weblate (Finnish)

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
2 years agotree-wide: fix typo
Yu Watanabe [Sun, 22 Aug 2021 06:42:51 +0000 (15:42 +0900)] 
tree-wide: fix typo

2 years agoMerge pull request #20303 from andir/sysconfig-example
Yu Watanabe [Sun, 22 Aug 2021 06:40:39 +0000 (15:40 +0900)] 
Merge pull request #20303 from andir/sysconfig-example

{core, login}: respect install_sysconfdir_samples in meson file

2 years agotest-network: add testcases that gateway address is IPv6 link local 20498/head
Yu Watanabe [Fri, 20 Aug 2021 18:54:35 +0000 (03:54 +0900)] 
test-network: add testcases that gateway address is IPv6 link local

2 years agonetwork: fix logic for checking gateway address is ready
Yu Watanabe [Fri, 20 Aug 2021 18:51:39 +0000 (03:51 +0900)] 
network: fix logic for checking gateway address is ready

This fixes the followings:
- The corresponding route or address to the gateway address must be in
  the same link.
- IPv6 link local address is not necessary to be reachable.

Fixes an issue reported in https://github.com/systemd/systemd/issues/8686#issuecomment-902562324.

2 years agologin: respect install_sysconfdir_samples in meson file 20303/head
Andreas Rammhold [Mon, 26 Jul 2021 15:20:34 +0000 (17:20 +0200)] 
login: respect install_sysconfdir_samples in meson file

The refactoring done in c900d89faa0 caused the configuration files to be
installed into the pkgsysconfdir regardless of the state of the
install_sysconfdir_samples boolean that indicates whether or not the
sample files should be installed.

2 years agocore: respect install_sysconfdir_samples in meson file
Andreas Rammhold [Mon, 26 Jul 2021 14:57:43 +0000 (16:57 +0200)] 
core: respect install_sysconfdir_samples in meson file

The refactoring done in e11a25cadbe caused the configuration files to be
installed into the pkgsysconfdir regardless of the state of the
install_sysconfdir_samples boolean that indicates whether or not the
sample files should be installed.

2 years agodocs: Add documentation on how to use VSCode to debug systemd via mkosi
Daan De Meyer [Fri, 20 Aug 2021 18:09:37 +0000 (19:09 +0100)] 
docs: Add documentation on how to use VSCode to debug systemd via mkosi

2 years agoMerge pull request #20500 from poettering/import-tweaks
Yu Watanabe [Sat, 21 Aug 2021 03:50:22 +0000 (12:50 +0900)] 
Merge pull request #20500 from poettering/import-tweaks

a few minor tweaks/bugfixlets to importd backends

2 years agoMerge pull request #20499 from poettering/align-to-tweak
Yu Watanabe [Sat, 21 Aug 2021 03:50:07 +0000 (12:50 +0900)] 
Merge pull request #20499 from poettering/align-to-tweak

ALIGN_TO() tweaks

2 years agoMerge pull request #20494 from bluca/snprintf_voidify
Yu Watanabe [Fri, 20 Aug 2021 21:45:58 +0000 (06:45 +0900)] 
Merge pull request #20494 from bluca/snprintf_voidify

tree-wide: voidify unchecked snprintf calls or use snprintf_ok

2 years agoMerge pull request #20484 from DaanDeMeyer/rx-gro-hw
Yu Watanabe [Fri, 20 Aug 2021 21:43:49 +0000 (06:43 +0900)] 
Merge pull request #20484 from DaanDeMeyer/rx-gro-hw

Add rx-gro-hw support

2 years agotest: make sure test timeout has a higher priority than a pass
Frantisek Sumsal [Fri, 20 Aug 2021 12:08:18 +0000 (14:08 +0200)] 
test: make sure test timeout has a higher priority than a pass

otherwise we might mark tests where something crashes during shutdown as
successful, as happened in one of the recent TEST-01-BASIC runs:

```
testsuite-01.service: About to execute rm -f /failed /testok
testsuite-01.service: Forked rm as 606
testsuite-01.service: Executing: rm -f /failed /testoktestsuite-01.service: Changed dead -> start-pre
         Starting TEST-01-BASIC...
...
Child 606 (rm) died (code=exited, status=0/SUCCESS)
testsuite-01.service: Child 606 belongs to testsuite-01.service.
testsuite-01.service: Control process exited, code=exited, status=0/SUCCESS (success)
testsuite-01.service: Got final SIGCHLD for state start-pre.
testsuite-01.service: Passing 0 fds to service
testsuite-01.service: About to execute sh -e -x -c "systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok"
testsuite-01.service: Forked sh as 607
testsuite-01.service: Changed start-pre -> start
testsuite-01.service: Executing: sh -e -x -c "systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok"systemd-journald.service: Got notification message from PID 560 (FDSTORE=1)S
...
testsuite-01.service: Child 607 belongs to testsuite-01.service.
testsuite-01.service: Main process exited, code=exited, status=0/SUCCESS (success)
testsuite-01.service: Deactivated successfully.
testsuite-01.service: Service will not restart (restart setting)
testsuite-01.service: Changed start -> dead
testsuite-01.service: Job 207 testsuite-01.service/start finished, result=done
[  OK  ] Finished TEST-01-BASIC.
...
end.service: About to execute /bin/sh -x -c "systemctl poweroff --no-block"
end.service: Forked /bin/sh as 623end.service: Executing: /bin/sh -x -c "systemctl poweroff --no-block"
...
end.service: Job 213 end.service/start finished, result=canceled
Caught <SEGV>, dumped core as pid 624.
Freezing execution.

CentOS Linux 8
Kernel 4.18.0-305.12.1.el8_4.x86_64 on an x86_64 (ttyS0)

H login: qemu-kvm: terminating on signal 15 from pid 80134 (timeout)
E: Test timed out after 600s
Spawning getter /root/systemd/build/journalctl -o export -D /var/tmp/systemd-test.0UYjAS/root/var/log/journal/ca6031c2491543fe8286c748258df8d1...
Finishing after writing 15125 entries
Spawning getter /root/systemd/build/journalctl -o export -D /var/tmp/systemd-test.0UYjAS/root/var/log/journal/remote...
Finishing after writing 0 entries
-rw-r-----. 1 root root 25165824 Aug 20 12:26 /var/tmp/systemd-test.0UYjAS/system.journal
TEST-01-BASIC RUN: Basic systemd setup [OK]
...

2 years agomacro: handle overflow in ALIGN_TO() somewhat reasonably 20499/head
Lennart Poettering [Fri, 20 Aug 2021 16:11:14 +0000 (18:11 +0200)] 
macro: handle overflow in ALIGN_TO() somewhat reasonably

The helper call rounds up to next multiple of specified boundary. If one
passes a very large value as first argument, then there might not be a
next multiple. So far we ignored that. Let's handle this now and return
SIZE_MAX in this case, as special indicator that we reached the end.

Of course, IRL this should not happen. With this new change we at least
do something somewhat reasonable, leaving it to the caller to handle it
further.

2 years agotest: split out macro tests into own test-macro.c
Lennart Poettering [Fri, 20 Aug 2021 16:28:21 +0000 (18:28 +0200)] 
test: split out macro tests into own test-macro.c

No changes in code, just a split out of tests for stuff from macro.h
into test-macro.c

2 years agoimport-fs: create paren dirs in --direct mode too 20500/head
Lennart Poettering [Fri, 20 Aug 2021 12:22:29 +0000 (14:22 +0200)] 
import-fs: create paren dirs in --direct mode too

There's no reason not to create these in advance if they are missing.

2 years agoimport: don't attempt full-file clones if we only are supposed to write a part of...
Lennart Poettering [Thu, 19 Aug 2021 14:53:51 +0000 (16:53 +0200)] 
import: don't attempt full-file clones if we only are supposed to write a part of the file

Otherwise we'll copy more than we were told to.

2 years agoimport: enable sparse file writing logic only for files we create
Lennart Poettering [Thu, 19 Aug 2021 15:22:18 +0000 (17:22 +0200)] 
import: enable sparse file writing logic only for files we create

Only if we create a file we know for sure that it is empty and hence our
sparse file logic of skipping over NUL bytes can can work. If we hwoever
are called to write data to some existing file/block device, we must do
regular writes to override everything that might be in place before.

Hence, conditionalize sparse file writing on the write offset not being
configured (which is how we internally distinguish write to existing
file and write to new file)

2 years agoimport: when completed, say how many bytes we wrote/acquired
Lennart Poettering [Thu, 19 Aug 2021 16:19:26 +0000 (18:19 +0200)] 
import: when completed, say how many bytes we wrote/acquired

This is just too useful.

2 years agoimport: allow file:// in addition to HTTP(S)
Lennart Poettering [Thu, 19 Aug 2021 16:15:37 +0000 (18:15 +0200)] 
import: allow file:// in addition to HTTP(S)

Previously we only allows http/https urls, let's open this up a bit.
Why? Because it makes testing *so* *much* *easier* as we don't need to
run a HTTP server all the time.

CURL mostly abstracts the differences of http/https away from us, hence
we can get away with very little extra work.

2 years agoimport: turn off weird protocols in curl
Lennart Poettering [Thu, 19 Aug 2021 16:12:56 +0000 (18:12 +0200)] 
import: turn off weird protocols in curl

Let's lock things down a bit and now allow curl's weirder protocols to
be used with our use. i.e. stick to http:// + https:// + file:// and
turn everything else off. (Gopher!)

This is cde that interfaces with the network after all, and we better
shouldn't support protocols needlessly that are much less tested.

(Given that HTTP redirects (and other redirects) exist, this should give
us a security benefit, since we will then be sure that noone can forward
us to a weird protocol, which we never tested, and other people test
neither)

2 years agoMerge pull request #20421 from maanyagoenka/systemd-security
Lennart Poettering [Fri, 20 Aug 2021 19:42:11 +0000 (21:42 +0200)] 
Merge pull request #20421 from maanyagoenka/systemd-security

systemd-analyze: refactor security_info struct and add option to perform security analysis of specified unit file(s)

2 years agojournalctl: Use constants for _BOOT_ID= matches
Jan Janssen [Fri, 20 Aug 2021 17:34:22 +0000 (19:34 +0200)] 
journalctl: Use constants for _BOOT_ID= matches

2 years agosystemd-analyze: add new 'security' option to compare unit's overall exposure level... 20421/head
Maanya Goenka [Tue, 17 Aug 2021 17:40:15 +0000 (10:40 -0700)] 
systemd-analyze: add new 'security' option to compare unit's overall exposure level with

--threshold option added to work with security verb and with the --offline option so that
users can determine what qualifies as a security threat. The threshold set by the user is
compared with the overall exposure level assigned to a unit file and if the exposure is
higher than the threshold, 'security' will return a non-zero exit status. The default value
of the --threshold option is 100.

Example Run:

1. testcase.service is a unit file created for testing the --threshold option

    maanya-goenka@debian:~/systemd (systemd-security)$ cat<<EOF>testcase.service

    > [Service]
    > ExecStart = echo hello
    > EOF

    For the purposes of this demo, the security table outputted below has been cut to show only the first two security settings.

    maanya-goenka@debian:~/systemd (systemd-security)$ sudo build/systemd-analyze security --offline=true testcase.service
    /usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
    process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
    Support for KillMode=none is deprecated and will eventually be removed.
    /usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
    unit file, and consider removing the setting altogether.
    /usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
    /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

      NAME                                        DESCRIPTION                                                       EXPOSURE
    ✗ PrivateNetwork=                             Service has access to the host's network                          0.5
    ✗ User=/DynamicUser=                          Service runs as root user                                         0.4

    → Overall exposure level for testcase.service: 9.6 UNSAFE 😨

    maanya-goenka@debian:~/systemd (systemd-security)$ echo $? 0

2. Next, we use the same testcase.service file but add an additional --threshold=60 parameter. We would expect 'security' to exit
   with a non-zero status because the overall exposure level (= 96) is higher than the set threshold (= 60).

    maanya-goenka@debian:~/systemd (systemd-security)$ sudo build/systemd-analyze security --offline=true --threshold=60 testcase.service
    /usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
    process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
    Support for KillMode=none is deprecated and will eventually be removed.
    /usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
    unit file, and consider removing the setting altogether.
    /usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
    /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

      NAME                                        DESCRIPTION                                                       EXPOSURE
    ✗ PrivateNetwork=                             Service has access to the host's network                          0.5
    ✗ User=/DynamicUser=                          Service runs as root user                                         0.4

    → Overall exposure level for testcase.service: 9.6 UNSAFE 😨

    maanya-goenka@debian:~/systemd (systemd-security)$ echo $? 1

2 years agosystemd-analyze: 'security' option to perform offline reviews of the specified unit...
Maanya Goenka [Tue, 17 Aug 2021 17:25:38 +0000 (10:25 -0700)] 
systemd-analyze: 'security' option to perform offline reviews of the specified unit file(s)

New option --offline which works with the 'security' command and takes in a boolean value. When set to true,
it performs an offline security review of the specified unit file(s). It does not rely on PID 1 to acquire
security information for the files like 'security' when used by itself does. It makes use of the refactored
security_info struct instead (commit #8cd669d3d3cf1b5e8667acc46ba290a9e8a8e529). This means that --offline can be
used with --image and --root as well. When used with --threshold, if a unit's overall exposure level is above
that set by the user, the default value being 100, --offline returns a non-zero exit status.

Example Run:

1. testcase.service is a unit file created for testing the --offline option

maanya-goenka@debian:~/systemd (systemd-security)$ cat<<EOF>testcase.service

> [Service]
> ExecStart = echo hello
> EOF

For the purposes of this demo, the security table outputted below has been cut to show only the first two security settings.

maanya-goenka@debian:~/systemd (systemd-security)$ sudo build/systemd-analyze security --offline=true testcase.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

  NAME                                        DESCRIPTION                                                       EXPOSURE
✗ PrivateNetwork=                             Service has access to the host's network                          0.5
✗ User=/DynamicUser=                          Service runs as root user                                         0.4

→ Overall exposure level for testcase.service: 9.6 UNSAFE 😨

maanya-goenka@debian:~/systemd (systemd-security)$ echo $? 0

2. The testcase.service unit file is modified to set PrivateNetwork to "yes". This reduces the exposure level from 9.6 to 9.1.

maanya-goenka@debian:~/systemd (systemd-security)$ nano testcase.service

> [Service]
> ExecStart = echo hello
> PrivateNetwork = yes
> EOF

maanya-goenka@debian:~/systemd (systemd-security)$ sudo build/systemd-analyze security --offline=true testcase.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

  NAME                                        DESCRIPTION                                                       EXPOSURE
✓ PrivateNetwork=                             Service has access to the host's network
✗ User=/DynamicUser=                          Service runs as root user                                         0.4

→ Overall exposure level for testcase.service: 9.1 UNSAFE 😨

maanya-goenka@debian:~/systemd (systemd-security)$ echo $? 0

3. Next, we use the same testcase.service unit file but add the additional --threshold=60 option to see how --threshold works with
--offline. Since the overall exposure level is 91 which is greater than the threshold value set by the user (= 60), we can expect
a non-zero exit status.

maanya-goenka@debian:~/systemd (systemd-security)$ sudo build/systemd-analyze security --offline=true --threshold=60 testcase.service
/usr/lib/systemd/system/plymouth-start.service:15: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'.
Support for KillMode=none is deprecated and will eventually be removed.
/usr/lib/systemd/system/gdm.service:30: Standard output type syslog is obsolete, automatically updating to journal. Please update your
unit file, and consider removing the setting altogether.
/usr/lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.

  NAME                                        DESCRIPTION                                                       EXPOSURE
✓ PrivateNetwork=                             Service has access to the host's network
✗ User=/DynamicUser=                          Service runs as root user                                         0.4

→ Overall exposure level for testcase.service: 9.1 UNSAFE 😨

maanya-goenka@debian:~/systemd (systemd-security)$ echo $? 1

2 years agosystemd-analyze: refactor security_info to make use of existing struct variables
Maanya Goenka [Tue, 10 Aug 2021 21:00:23 +0000 (14:00 -0700)] 
systemd-analyze: refactor security_info to make use of existing struct variables

In the original implementation of the security_info struct, the struct variables receive its values
via dbus protocol. We want to make use of existing structs ExecContext, Unit, and CGroupContext to
assign values to the security_info variables instead of relying on dbus for the same. This is possible since these
pre-defined structs already contain all the variables that security_info needs to perform security reviews on
unit files that are passed to it in the command line.

2 years agotree-wide: voidify unchecked snprintf calls 20494/head
Luca Boccassi [Fri, 20 Aug 2021 13:57:02 +0000 (14:57 +0100)] 
tree-wide: voidify unchecked snprintf calls

According to Coverity, 194 ouf of 227 times we check for snprintf return code.
Voidify the rest.

CID#1461512
CID#1461513
CID#1461514
CID#1461515
CID#1461516
CID#1461518
CID#1461519
CID#1461520
CID#1461522

2 years agoformat-util/sd-bus: do not ignore snprintf result
Luca Boccassi [Fri, 20 Aug 2021 17:15:35 +0000 (18:15 +0100)] 
format-util/sd-bus: do not ignore snprintf result

2 years agohwdb-usb-device: use xsprintf
Luca Boccassi [Fri, 20 Aug 2021 17:13:16 +0000 (18:13 +0100)] 
hwdb-usb-device: use xsprintf

2 years agoset: modify the previously incorrect definition of set_copy and add test for it
Maanya Goenka [Mon, 16 Aug 2021 22:55:51 +0000 (15:55 -0700)] 
set: modify the previously incorrect definition of set_copy and add test for it

2 years agoMerge pull request #20488 from yuwata/timesync-fix
Lennart Poettering [Fri, 20 Aug 2021 11:34:20 +0000 (13:34 +0200)] 
Merge pull request #20488 from yuwata/timesync-fix

timesync: fix wrong type for receiving timestamp in nanoseconds

2 years agoMerge pull request #20490 from poettering/id128-format-compound-literal
Lennart Poettering [Fri, 20 Aug 2021 11:33:51 +0000 (13:33 +0200)] 
Merge pull request #20490 from poettering/id128-format-compound-literal

compound literal love for sd_id128_to_string()

2 years agosrc/boot/efi/linux: fix linux_exec prototype
Alfonso Sánchez-Beato [Thu, 19 Aug 2021 10:21:12 +0000 (12:21 +0200)] 
src/boot/efi/linux: fix linux_exec prototype

Callers to linux_exec() are actually passing an EFI_HANDLE, not a pointer to
it. linux_efi_handover(), which is called by linux_exec(), also expects an
EFI_HANDLE.

2 years agotree-wide: port everything over to new sd-id128 compund literal bliss 20490/head
Lennart Poettering [Fri, 20 Aug 2021 08:54:49 +0000 (10:54 +0200)] 
tree-wide: port everything over to new sd-id128 compund literal bliss

2 years agosd-id128: add compound literal love to sd_id128_to_string() + id128_to_uuid_string()
Lennart Poettering [Fri, 20 Aug 2021 08:51:53 +0000 (10:51 +0200)] 
sd-id128: add compound literal love to sd_id128_to_string() + id128_to_uuid_string()

2 years agoman: reference getrandom(2) instead of urandom from sd_id128_randomize() page
Lennart Poettering [Fri, 20 Aug 2021 08:53:23 +0000 (10:53 +0200)] 
man: reference getrandom(2) instead of urandom from sd_id128_randomize() page

It's 2021, /dev/urandom is mostly a thing of the past now.

2 years agoman: document SD_ID128_ALLF
Lennart Poettering [Fri, 20 Aug 2021 08:52:55 +0000 (10:52 +0200)] 
man: document SD_ID128_ALLF

2 years agoman: re-run ninja -C update-man-rules
Lennart Poettering [Fri, 20 Aug 2021 09:09:32 +0000 (11:09 +0200)] 
man: re-run ninja -C update-man-rules

2 years agolink: Add support for rx-gro-hw nic feature 20484/head
Daan De Meyer [Thu, 19 Aug 2021 12:44:35 +0000 (13:44 +0100)] 
link: Add support for rx-gro-hw nic feature

2 years agolink: Stop prefixing features with "the"
Daan De Meyer [Thu, 19 Aug 2021 12:37:41 +0000 (13:37 +0100)] 
link: Stop prefixing features with "the"

2 years agonetwork: add UseMTU= in [IPv6AcceptRA]
Yu Watanabe [Fri, 20 Aug 2021 00:41:34 +0000 (09:41 +0900)] 
network: add UseMTU= in [IPv6AcceptRA]

Note that kernel has similar knob in sysctl: accept_ra_mtu.

Closes #18868.

2 years agoMerge pull request #18385 from kinvolk/mauricio/restrict-network-interfaces
Lennart Poettering [Fri, 20 Aug 2021 01:41:11 +0000 (03:41 +0200)] 
Merge pull request #18385 from kinvolk/mauricio/restrict-network-interfaces

Add RestrictNetworkInterfaces=

2 years agoicmp6: drop unnecessary assertion 20488/head
Yu Watanabe [Thu, 19 Aug 2021 23:44:27 +0000 (08:44 +0900)] 
icmp6: drop unnecessary assertion

Follow-up for 3691bcf3c5eebdcca5b4f1c51c745441c57a6cd1.

2 years agotimesync: fix wrong type for receiving timestamp in nanoseconds
Yu Watanabe [Thu, 19 Aug 2021 23:40:11 +0000 (08:40 +0900)] 
timesync: fix wrong type for receiving timestamp in nanoseconds

Fixes #20482.

2 years agoudev: Add support for configuring nic coalescing settings
Daan De Meyer [Wed, 18 Aug 2021 12:52:00 +0000 (13:52 +0100)] 
udev: Add support for configuring nic coalescing settings

These are configured via the corresponding ethtool ioctl.

2 years agoMerge pull request #20486 from DaanDeMeyer/sd-bus-eproto
Luca Boccassi [Thu, 19 Aug 2021 22:32:34 +0000 (23:32 +0100)] 
Merge pull request #20486 from DaanDeMeyer/sd-bus-eproto

sd-bus: Return detailed (sd-buscntr) error from bus_container_connect_socket().

2 years agoMerge pull request #20436 from fbuihuu/add-no-build-support-on-opensuse
Luca Boccassi [Thu, 19 Aug 2021 20:11:31 +0000 (21:11 +0100)] 
Merge pull request #20436 from fbuihuu/add-no-build-support-on-opensuse

Add no build support on opensuse

2 years agosd-bus: Improve (sd-buscntr) error logging 20486/head
Daan De Meyer [Thu, 19 Aug 2021 14:09:44 +0000 (15:09 +0100)] 
sd-bus: Improve (sd-buscntr) error logging

We're only doing one thing in the child process which is connecting
to the D-Bus socket so let's mention that in the error message when
something goes wrong instead of having a generic error message.

2 years agosd-bus: Return detailed (sd-buscntr) error from bus_container_connect_socket()
Daan De Meyer [Thu, 19 Aug 2021 14:09:34 +0000 (15:09 +0100)] 
sd-bus: Return detailed (sd-buscntr) error from bus_container_connect_socket()

Previously, when the connect() call in (sd-buscntr) failed, we returned
-EPROTO without ever reading the actual errno from the error pipe. To fix
the issue, delay checking the process exit status until after we've read
and processed any error from the error pipe.

2 years agoMerge pull request #19797 from oniko/systemd-fido2-pkcs11-plugins
Lennart Poettering [Thu, 19 Aug 2021 14:37:55 +0000 (16:37 +0200)] 
Merge pull request #19797 from oniko/systemd-fido2-pkcs11-plugins

Add support for remaining systemd fido2 and pkcs11 libcryptsetup plugins

2 years agoMerge pull request #20471 from poettering/format-str-proc-fd
Luca Boccassi [Thu, 19 Aug 2021 13:05:22 +0000 (14:05 +0100)] 
Merge pull request #20471 from poettering/format-str-proc-fd

add FORMAT_PROC_FD_PATH() macro for generating /proc/self/fd/ paths on-the-fly

2 years agoREADME: add requirements for RestrictNetworkInterfaces= 18385/head
Mauricio Vásquez [Tue, 13 Jul 2021 16:03:31 +0000 (11:03 -0500)] 
README: add requirements for RestrictNetworkInterfaces=

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agosystemctl: show RestrictNetworkInterfaces= in systemctl show
Mauricio Vásquez [Thu, 21 Jan 2021 16:20:16 +0000 (11:20 -0500)] 
systemctl: show RestrictNetworkInterfaces= in systemctl show

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agotests: add integration test for RestrictNetworkInterfaces=
Mauricio Vásquez [Fri, 26 Feb 2021 00:59:36 +0000 (19:59 -0500)] 
tests: add integration test for RestrictNetworkInterfaces=

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agoAdd support for systemd-pkcs11 libcryptsetup plugin. 19797/head
Ondrej Kozina [Thu, 20 May 2021 13:37:08 +0000 (15:37 +0200)] 
Add support for systemd-pkcs11 libcryptsetup plugin.

Add support for systemd-pkcs11 based LUKS2 device activation
via libcryptsetup plugin. This make the feature (pkcs11 sealed
LUKS2 keyslot passphrase) usable from both systemd utilities
and cryptsetup cli.

The feature is configured via -Dlibcryptsetup-plugins combo
with default value set to 'auto'. It get's enabled automatically
when cryptsetup 2.4.0 or later is installed in build system.

2 years agopkcs11-util: split pkcs11_token_login function
Ondrej Kozina [Fri, 4 Jun 2021 14:21:30 +0000 (16:21 +0200)] 
pkcs11-util: split pkcs11_token_login function

Future systemd-pkcs11 plugin requires unlock via single
call with supplied pin. To reduce needless code duplication
in plugin itself split original pkcs_11_token_login call in
two calls:

new pkcs11_token_login_by_pin and the former where loop
for retrying via PIN query callback remains.

2 years agocryptsetup-pkcs11: move pkcs11_callback and data in shared utils.
Ondrej Kozina [Wed, 2 Jun 2021 16:45:42 +0000 (18:45 +0200)] 
cryptsetup-pkcs11: move pkcs11_callback and data in shared utils.

To be used later by both (future) systemd-pkcs11 libcryptsetup
plugin and cryptsetup-pkcs11.

2 years agoAdd support for systemd-fido2 libcryptsetup plugin.
Ondrej Kozina [Mon, 17 May 2021 13:26:14 +0000 (15:26 +0200)] 
Add support for systemd-fido2 libcryptsetup plugin.

Add support for systemd-fido2 based LUKS2 device activation
via libcryptsetup plugin. This make the feature (fido2 sealed
LUKS2 keyslot passphrase) usable from both systemd utilities
and cryptsetup cli.

The feature is configured via -Dlibcryptsetup-plugins combo
with default value set to 'auto'. It get's enabled automatically
when cryptsetup 2.4.0 or later is installed in build system.

2 years agopo: Translated using Weblate (Sinhala)
Hela Basa [Thu, 19 Aug 2021 07:04:49 +0000 (09:04 +0200)] 
po: Translated using Weblate (Sinhala)

Currently translated at 0.5% (1 of 189 strings)

Co-authored-by: Hela Basa <r45xveza@pm.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/si/
Translation: systemd/main

2 years agocreds-util: fix possible divide-by-zero
Yu Watanabe [Wed, 18 Aug 2021 07:05:02 +0000 (16:05 +0900)] 
creds-util: fix possible divide-by-zero

input_size may be zero.

Fixes #20469.

2 years agotree-wide: port things over to FORMAT_PROC_FD_PATH() 20471/head
Lennart Poettering [Wed, 18 Aug 2021 07:43:25 +0000 (09:43 +0200)] 
tree-wide: port things over to FORMAT_PROC_FD_PATH()

2 years agotest: add test for FORMAT_PROC_FD_PATH()
Lennart Poettering [Wed, 18 Aug 2021 07:43:19 +0000 (09:43 +0200)] 
test: add test for FORMAT_PROC_FD_PATH()

2 years agofd-util: add macro for generating /proc/self/fd/ paths on the fly
Lennart Poettering [Wed, 18 Aug 2021 07:43:07 +0000 (09:43 +0200)] 
fd-util: add macro for generating /proc/self/fd/ paths on the fly

2 years agostdio-util: give snprintf_ok() some love
Lennart Poettering [Wed, 18 Aug 2021 12:03:10 +0000 (14:03 +0200)] 
stdio-util: give snprintf_ok() some love

as per docs snprintf() can fail in which case it returns -1. The
snprintf_ok() macro so far unconditionally cast the return value of
snprintf() to size_t, which would turn -1 to (size_t) INT_MAX,
presumably, at least on 2 complements system.

Let's be more careful with types here, and first check if return value
is positive, before casting to size_t.

Also, while we are at it, let's return the input buffer as return value
or NULL instead of 1 or 0. It's marginally more useful, but more
importantly, is more inline with most of our other codebase that
typically doesn't use booleans to signal success.

All uses of snprintf_ok() don't care for the type of the return, hence
this change does not propagate anywhere else.

2 years agodiscover-image: pass the right fd to fd_getcrtime()
Lennart Poettering [Wed, 18 Aug 2021 20:41:08 +0000 (22:41 +0200)] 
discover-image: pass the right fd to fd_getcrtime()

2 years agosd-boot: Use UEFI provided CRC32
Jan Janssen [Tue, 17 Aug 2021 09:44:21 +0000 (11:44 +0200)] 
sd-boot: Use UEFI provided CRC32

2 years agosrc/test: add restrict network interfaces to test-cgroup-mask
Mauricio Vásquez [Fri, 26 Feb 2021 12:07:44 +0000 (07:07 -0500)] 
src/test: add restrict network interfaces to test-cgroup-mask

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agoman: add RestrictNetworkInterfaces= documentation
Mauricio Vásquez [Thu, 21 Jan 2021 20:36:13 +0000 (15:36 -0500)] 
man: add RestrictNetworkInterfaces= documentation

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agoDocument RestrictNetworkInterfaces dbus properties
Mauricio Vásquez [Thu, 21 Jan 2021 20:35:33 +0000 (15:35 -0500)] 
Document RestrictNetworkInterfaces dbus properties

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agocore: add D-bus properties for RestrictNetworkInterfaces=
Mauricio Vásquez [Thu, 21 Jan 2021 16:29:36 +0000 (11:29 -0500)] 
core: add D-bus properties for RestrictNetworkInterfaces=

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agocore: add load fragment implementation for RestrictNetworkInterfaces=
Mauricio Vásquez [Thu, 21 Jan 2021 16:19:07 +0000 (11:19 -0500)] 
core: add load fragment implementation for RestrictNetworkInterfaces=

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agocore: implement RestrictNetworkInterfaces=
Mauricio Vásquez [Thu, 21 Jan 2021 16:08:19 +0000 (11:08 -0500)] 
core: implement RestrictNetworkInterfaces=

This commit introduces all the logic to load and attach the BPF
programs to restrict network interfaces when a unit specifying it is
loaded.

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agocore: add RestrictNetworkInterfaces= BPF program source code
Mauricio Vásquez [Thu, 21 Jan 2021 15:45:38 +0000 (10:45 -0500)] 
core: add RestrictNetworkInterfaces= BPF program source code

The code is composed by two BPF_PROG_TYPE_CGROUP_SKB programs that
are loaded in the cgroup inet ingress and egress hooks
(BPF_CGROUP_INET_{INGRESS|EGRESS}).

The decision to let a packet pass or not is based on a map that contains
the indexes of the interfaces.

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agotest: if haveged is part of initrd it needs to be installed in the image too 20436/head
Franck Bui [Fri, 6 Aug 2021 14:47:32 +0000 (16:47 +0200)] 
test: if haveged is part of initrd it needs to be installed in the image too

Otherwise haveged won't survive when switching root from initrd to host making
haveged service in host fail.

2 years agotest: adapt install_pam() for openSUSE
Franck Bui [Thu, 5 Aug 2021 13:34:37 +0000 (15:34 +0200)] 
test: adapt install_pam() for openSUSE

On openSUSE the default pam config files are shipped in /usr/etc/pam.d.

Also empty password is not allowed by default.

2 years agoRevert "test: adapt TEST-13-NSPAWN-SMOKE for SUSE"
Franck Bui [Tue, 3 Aug 2021 10:18:40 +0000 (12:18 +0200)] 
Revert "test: adapt TEST-13-NSPAWN-SMOKE for SUSE"

This reverts commit 491b736a49fb9d64b0b515aa773297a30c8bab1d.

If the _static_ linked version of busybox is installed, openSUSE doesn't need
any specific code.

A following commit will make sure that the static linked version of busybox is
installed in the busybox container.

2 years agotest: on openSUSE the static linked version of busybox is named "busybox-static"
Franck Bui [Sun, 8 Aug 2021 05:35:04 +0000 (07:35 +0200)] 
test: on openSUSE the static linked version of busybox is named "busybox-static"

2 years agoTEST-13-*: in busybox container sleep(1) takes a delay in seconds only
Franck Bui [Thu, 5 Aug 2021 06:38:27 +0000 (08:38 +0200)] 
TEST-13-*: in busybox container sleep(1) takes a delay in seconds only

2 years agotest: don't try to find BUILD_DIR when NO_BUILD is set
Franck Bui [Tue, 3 Aug 2021 06:44:47 +0000 (08:44 +0200)] 
test: don't try to find BUILD_DIR when NO_BUILD is set

NO_BUILD=1 indicates that we want to test systemd from the local system and not
the one from the local build. Hence there should be no need to call
find-build-dir.sh when NO_BUID=1 especially since it's likely that the script
will fail to find a local build in this case.

This avoids find-build-dir.sh to emit 'Specify build directory with $BUILD_DIR'
message when NO_BUILD=1 and no local build can be found.

This introduces a behavior change though: systemd from the local system will
always be preferred when NO_BUILD=1 even if a local build can be found.

2 years agotest: add support for NO_BUILD=1 on openSUSE
Franck Bui [Tue, 3 Aug 2021 06:18:13 +0000 (08:18 +0200)] 
test: add support for NO_BUILD=1 on openSUSE

2 years agoudev: make RxChannels= or friends also accept "max"
Yu Watanabe [Wed, 18 Aug 2021 07:41:11 +0000 (16:41 +0900)] 
udev: make RxChannels= or friends also accept "max"

Follow-up for 406041b7de767316674eb6a2f98ad466577ce8a4.

Also, this makes
- the settings accept an empty string,
- if the specified value is too large, also use the advertised maximum
  value.
- mention the range of the value in the man page.

2 years agotree-wide: fix typo
Yu Watanabe [Wed, 18 Aug 2021 10:14:31 +0000 (19:14 +0900)] 
tree-wide: fix typo

2 years agodocs: portable services are no longer in preview 20470/head
Luca Boccassi [Tue, 17 Aug 2021 23:00:46 +0000 (00:00 +0100)] 
docs: portable services are no longer in preview

Reword the intro to the document, as portable services are a stable interface
and no longer a preview.

2 years agofstab-generator: Respect nofail when ordering
Vladimir Panteleev [Tue, 17 Aug 2021 18:30:29 +0000 (18:30 +0000)] 
fstab-generator: Respect nofail when ordering

2 years agoFix typo in dbus property name ("OnSuccesJobMode")
Vladimir Panteleev [Tue, 17 Aug 2021 17:56:41 +0000 (17:56 +0000)] 
Fix typo in dbus property name ("OnSuccesJobMode")

2 years agoMerge pull request #20460 from yuwata/udevadm-test-builtin-introduce-action
Yu Watanabe [Wed, 18 Aug 2021 06:59:40 +0000 (15:59 +0900)] 
Merge pull request #20460 from yuwata/udevadm-test-builtin-introduce-action

udevadm: introduce --action option for test-builtin

2 years agoudev: Support "max" string for BufferSize options (#20458)
Daan De Meyer [Wed, 18 Aug 2021 06:59:13 +0000 (07:59 +0100)] 
udev: Support "max" string for BufferSize options (#20458)

"max" indicates the hardware advertised maximum queue buffer size
should be used.

The max sizes can be checked by running `ethtool -g <dev>` (Preset maximums).
Since the buffer sizes can't be set to 0 by users, internally we use 0 to
indicate that the hardware advertised maximum should be used.

2 years agoMerge pull request #20456 from tomty89/man
Yu Watanabe [Wed, 18 Aug 2021 06:58:06 +0000 (15:58 +0900)] 
Merge pull request #20456 from tomty89/man

Adding a few notes in the systemd.network man page

2 years agonetwork: do not assume the highest priority when Priority= is unspecified
Yu Watanabe [Tue, 17 Aug 2021 05:03:19 +0000 (14:03 +0900)] 
network: do not assume the highest priority when Priority= is unspecified

Previously, when Priority= is unspecified, networkd configured the rule with
the highest (=0) priority. This commit makes networkd distinguish the case
the setting is unspecified and one explicitly specified as Priority=0.

Note.
1) If the priority is unspecified on configure, then kernel dynamically picks
   a priority for the rule.
2) The new behavior is consistent with 'ip rule' command.

Replaces #15606.

2 years agoudevadm: introduce -a|--action option for test-builtin command 20460/head
Yu Watanabe [Tue, 17 Aug 2021 14:14:29 +0000 (23:14 +0900)] 
udevadm: introduce -a|--action option for test-builtin command

As net_setup_link builtin requires that a device action is set for the
sd_device object.