]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agoportable: copy SELinux label when extracting units from images 20767/head
Luca Boccassi [Thu, 16 Sep 2021 11:47:42 +0000 (12:47 +0100)] 
portable: copy SELinux label when extracting units from images

Units are copied out via sendmsg datafd from images, but that means
the SELinux labels get lost in transit. Extract them and copy them over.

Given recvmsg cannot use multiple IOV transparently when the sizes are
variable, use a '\0' as a separator between the filename and the label.

4 years agoportable: use send_one_fd_iov/receive_one_fd_iov instead of custom helpers
Luca Boccassi [Thu, 16 Sep 2021 11:43:51 +0000 (12:43 +0100)] 
portable: use send_one_fd_iov/receive_one_fd_iov instead of custom helpers

Will be useful for the next commit switching to multiple IOVs

4 years agoselinux: add mac_selinux_create_file_prepare_label helper
Luca Boccassi [Fri, 17 Sep 2021 11:42:18 +0000 (12:42 +0100)] 
selinux: add mac_selinux_create_file_prepare_label helper

Allow to use setfscreatecon with a custom label rather than the default

4 years agosocket-util: const-ify iov parameter in send_one_fd_iov_sa
Luca Boccassi [Mon, 20 Sep 2021 11:29:45 +0000 (12:29 +0100)] 
socket-util: const-ify iov parameter in send_one_fd_iov_sa

4 years agohwdb: add touchpad fuzz for Asus UX362FA (#20770)
Lukas Senionis [Mon, 20 Sep 2021 04:00:42 +0000 (07:00 +0300)] 
hwdb: add touchpad fuzz for Asus UX362FA (#20770)

4 years agoMerge pull request #20780 from mrc0mmand/test-storage-btrfs
Luca Boccassi [Sun, 19 Sep 2021 18:04:45 +0000 (19:04 +0100)] 
Merge pull request #20780 from mrc0mmand/test-storage-btrfs

test: btrfs-related udev tests

4 years agotest: dump the test output to console as well for easier debugging 20780/head
Frantisek Sumsal [Sat, 18 Sep 2021 21:18:57 +0000 (23:18 +0200)] 
test: dump the test output to console as well for easier debugging

4 years agotest: regenerate module dependencies after installing all modules
Frantisek Sumsal [Sat, 18 Sep 2021 21:06:36 +0000 (23:06 +0200)] 
test: regenerate module dependencies after installing all modules

4 years agotest: fix error handling with `set -e`
Frantisek Sumsal [Sat, 18 Sep 2021 19:44:38 +0000 (21:44 +0200)] 
test: fix error handling with `set -e`

Unfortunately, when checking the return/exit code using &&, ||, if,
while, etc., `set -e` is disabled for all nested functions as well,
which leads to incorrectly ignored errors, *sigh*.

Example:

```
set -eu
set -o pipefail

task() {
    echo "task init"
    echo "this should fail"
    false
    nonexistentcommand
    echo "task end (we shouldn't be here)"
}

if ! task; then
    echo >&2 "The task failed"
    exit 1
else
    echo "The task passed"
fi
```

```
$ bash test.sh
task init
this should fail
test.sh: line 10: nonexistentcommand: command not found
task end (we shouldn't be here)
The task passed
$ echo $?
0
```

But without the `if`, everything works "as expected":

```
set -eu
set -o pipefail

task() {
    echo "task init"
    echo "this should fail"
    false
    nonexistentcommand
    echo "task end (we shouldn't be here)"
}

task
```

```
$ bash test.sh
task init
this should fail
$ echo $?
1
```

Wonderful.

4 years agotest: btrfs-related udev tests
Frantisek Sumsal [Fri, 17 Sep 2021 17:28:38 +0000 (19:28 +0200)] 
test: btrfs-related udev tests

4 years agotest: check symlinks under /dev/mapper by default as well
Frantisek Sumsal [Sat, 18 Sep 2021 17:02:10 +0000 (19:02 +0200)] 
test: check symlinks under /dev/mapper by default as well

4 years agotest: use subshells a bit more
Frantisek Sumsal [Fri, 17 Sep 2021 21:59:38 +0000 (23:59 +0200)] 
test: use subshells a bit more

to tweak shell flags in specific functions without affecting the rest of
the script.

4 years agotest: cleanup the intermediate disk images
Frantisek Sumsal [Fri, 17 Sep 2021 21:03:44 +0000 (23:03 +0200)] 
test: cleanup the intermediate disk images

4 years agotest: tidy up the feature handling
Frantisek Sumsal [Fri, 17 Sep 2021 17:28:22 +0000 (19:28 +0200)] 
test: tidy up the feature handling

4 years agotest: add a btrfs helper
Frantisek Sumsal [Fri, 17 Sep 2021 17:19:23 +0000 (19:19 +0200)] 
test: add a btrfs helper

4 years agotest: lower the number of iterations in LVM tests
Frantisek Sumsal [Sat, 18 Sep 2021 18:43:50 +0000 (20:43 +0200)] 
test: lower the number of iterations in LVM tests

as some of the operations take a really long time.

4 years agobash-completion: circumvent aliases for 'ls'
Lia Lenckowski [Fri, 17 Sep 2021 21:08:19 +0000 (23:08 +0200)] 
bash-completion: circumvent aliases for 'ls'

4 years agotest: unify handling of supported "features"
Frantisek Sumsal [Fri, 17 Sep 2021 15:45:39 +0000 (17:45 +0200)] 
test: unify handling of supported "features"

4 years agoci: temporarily set -Wno-deprecated-declarations in Packit
Frantisek Sumsal [Fri, 17 Sep 2021 09:24:07 +0000 (11:24 +0200)] 
ci: temporarily set -Wno-deprecated-declarations in Packit

to suppress OpenSSL 3.0 deprecation warnings (until a proper solution
is deployed):

```
../src/shared/creds-util.c: In function ‘sha256_hash_host_and_tpm2_key’:
../src/shared/creds-util.c:412:9: error: ‘SHA256_Init’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  412 |         if (SHA256_Init(&sha256_context) != 1)
      |         ^~
In file included from /usr/include/openssl/x509.h:41,
                 from ../src/shared/openssl-util.h:8,
                 from ../src/shared/creds-util.c:21:
/usr/include/openssl/sha.h:73:27: note: declared here
   73 | OSSL_DEPRECATEDIN_3_0 int SHA256_Init(SHA256_CTX *c);
      |                           ^~~~~~~~~~~
../src/shared/creds-util.c:415:9: error: ‘SHA256_Update’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  415 |         if (host_key && SHA256_Update(&sha256_context, host_key, host_key_size) != 1)
      |         ^~
In file included from /usr/include/openssl/x509.h:41,
                 from ../src/shared/openssl-util.h:8,
                 from ../src/shared/creds-util.c:21:
/usr/include/openssl/sha.h:74:27: note: declared here
   74 | OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c,
      |                           ^~~~~~~~~~~~~
../src/shared/creds-util.c:418:9: error: ‘SHA256_Update’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  418 |         if (tpm2_key && SHA256_Update(&sha256_context, tpm2_key, tpm2_key_size) != 1)
      |         ^~
In file included from /usr/include/openssl/x509.h:41,
                 from ../src/shared/openssl-util.h:8,
                 from ../src/shared/creds-util.c:21:
/usr/include/openssl/sha.h:74:27: note: declared here
   74 | OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c,
      |                           ^~~~~~~~~~~~~
../src/shared/creds-util.c:421:9: error: ‘SHA256_Final’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  421 |         if (SHA256_Final(ret, &sha256_context) != 1)
      |         ^~
In file included from /usr/include/openssl/x509.h:41,
                 from ../src/shared/openssl-util.h:8,
                 from ../src/shared/creds-util.c:21:
/usr/include/openssl/sha.h:76:27: note: declared here
   76 | OSSL_DEPRECATEDIN_3_0 int SHA256_Final(unsigned char *md, SHA256_CTX *c);
      |                           ^~~~~~~~~~~~
cc1: all warnings being treated as errors

```

4 years agoMerge pull request #20769 from weblate/weblate-systemd-master
Frantisek Sumsal [Thu, 16 Sep 2021 18:23:51 +0000 (20:23 +0200)] 
Merge pull request #20769 from weblate/weblate-systemd-master

Translations update from Weblate

4 years agopo: Translated using Weblate (Portuguese) 20769/head
Hugo Carvalho [Thu, 16 Sep 2021 18:05:00 +0000 (20:05 +0200)] 
po: Translated using Weblate (Portuguese)

Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pt/
Translation: systemd/main

4 years agopo: Translated using Weblate (German)
Christian Wehrli [Thu, 16 Sep 2021 18:05:00 +0000 (20:05 +0200)] 
po: Translated using Weblate (German)

Currently translated at 71.4% (135 of 189 strings)

Co-authored-by: Christian Wehrli <christian@chw.onl>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/main

4 years agoMerge pull request #20763 from poettering/fileio-test
Lennart Poettering [Thu, 16 Sep 2021 15:47:03 +0000 (17:47 +0200)] 
Merge pull request #20763 from poettering/fileio-test

test-fileio: test read_virtual_file() with more files from /proc

4 years agopo: add false positives to POTFILES.skip
Piotr Drąg [Thu, 16 Sep 2021 12:48:05 +0000 (14:48 +0200)] 
po: add false positives to POTFILES.skip

4 years agotest-fileio: test read_virtual_file() with more files from /proc 20763/head
Lennart Poettering [Thu, 16 Sep 2021 09:31:52 +0000 (11:31 +0200)] 
test-fileio: test read_virtual_file() with more files from /proc

i.e. let's pick some files we know are too large, or where struct stat's
.st_size is zero even though non-empty, and test read_virtual_file()
with that, to ensure things are handled sensibly. Goal is to ensure all
three major codepaths in read_virtual_file() are tested.

Prompted-by: #20743
4 years agofileio: fix truncated read handling in read_virtual_file()
Lennart Poettering [Thu, 16 Sep 2021 10:20:09 +0000 (12:20 +0200)] 
fileio: fix truncated read handling in read_virtual_file()

We mishandled the case where the size we read from the file actually
matched the maximum size fully. In that case we cannot really make a
determination whether the file was fully read or only partially. In that
case let's do another loop, so that we operate with a buffer, and
we can detect the EOF (which will be signalled to us via a short read).

4 years agojournal,network,timesync: fix segfault on 32bit timeval/timespec systems
Yu Watanabe [Wed, 15 Sep 2021 14:29:11 +0000 (23:29 +0900)] 
journal,network,timesync: fix segfault on 32bit timeval/timespec systems

Fixes #20741.

4 years agofileio: start with 4k buffer for procfs
Anita Zhang [Tue, 14 Sep 2021 23:33:10 +0000 (16:33 -0700)] 
fileio: start with 4k buffer for procfs

There's a very gradual increase of anonymous memory in systemd-journald that
blames to 2ac67221bb6270f0fbe7cbd0076653832cd49de2.

systemd-journald makes many calls to read /proc/PID/cmdline and
/proc/PID/status, both of which tend to be well under 4K. However the
combination of allocating 4M read buffers, then using `realloc()` to
shrink the buffer in `read_virtual_file()` appears to be creating
fragmentation in the heap (when combined with the other allocations
systemd-journald is doing).

To help mitigate this, try reading /proc with a 4K buffer as
`read_virtual_file()` did before 2ac67221bb6270f0fbe7cbd0076653832cd49de2.
If it isn't big enough then try again with the larger buffers.

4 years agoMerge pull request #20758 from yuwata/test-17-udev-cleanups
Luca Boccassi [Thu, 16 Sep 2021 08:45:10 +0000 (09:45 +0100)] 
Merge pull request #20758 from yuwata/test-17-udev-cleanups

test: several cleanups for TEST-17-UDEV

4 years agoMerge pull request #20721 from mrc0mmand/test-storage-lvm
Yu Watanabe [Thu, 16 Sep 2021 03:39:24 +0000 (12:39 +0900)] 
Merge pull request #20721 from mrc0mmand/test-storage-lvm

test: udev/LVM storage tests

4 years agoMerge pull request #20738 from mrc0mmand/ci-llvm-13
Yu Watanabe [Thu, 16 Sep 2021 00:32:21 +0000 (09:32 +0900)] 
Merge pull request #20738 from mrc0mmand/ci-llvm-13

ci: build with clang-13

4 years agoMerge pull request #20483 from medhefgo/boot
Lennart Poettering [Wed, 15 Sep 2021 22:03:41 +0000 (00:03 +0200)] 
Merge pull request #20483 from medhefgo/boot

sd-boot: Add support for changing console mode at runtime

4 years agoMerge pull request #20731 from a-wai/main
Lennart Poettering [Wed, 15 Sep 2021 22:02:05 +0000 (00:02 +0200)] 
Merge pull request #20731 from a-wai/main

hostnamed: add support for getting the chassis type from device-tree

4 years agoMerge pull request #20746 from poettering/sysctl-rework
Lennart Poettering [Wed, 15 Sep 2021 22:01:18 +0000 (00:01 +0200)] 
Merge pull request #20746 from poettering/sysctl-rework

various sysctl-util.c cleanups

4 years agotest: drop unnecessary sleep and 'udevadm settle' 20758/head
Yu Watanabe [Wed, 15 Sep 2021 21:04:28 +0000 (06:04 +0900)] 
test: drop unnecessary sleep and 'udevadm settle'

After the triggered events are processed, all symlinks which store
watch handles should be valid.

4 years agotest: use --settle option for udevadm trigger
Yu Watanabe [Wed, 15 Sep 2021 21:38:08 +0000 (06:38 +0900)] 
test: use --settle option for udevadm trigger

4 years agotest: use --settle option for udevadm trigger
Yu Watanabe [Wed, 15 Sep 2021 21:34:45 +0000 (06:34 +0900)] 
test: use --settle option for udevadm trigger

Then, we can drop the loops.
This also drops unnecessary `udevadm control --reload`.

4 years agotest: use /dev/null instead of the loop back network interface
Yu Watanabe [Wed, 15 Sep 2021 21:14:18 +0000 (06:14 +0900)] 
test: use /dev/null instead of the loop back network interface

It should faster to be processed. So, we can shorten the timeout.
Also, this makes the test use `udevadm trigger`.

4 years agotest: use --settle option for udevadm trigger
Yu Watanabe [Wed, 15 Sep 2021 21:22:18 +0000 (06:22 +0900)] 
test: use --settle option for udevadm trigger

4 years agoMerge pull request #20751 from poettering/watchdog-tweaklet
Luca Boccassi [Wed, 15 Sep 2021 20:48:39 +0000 (21:48 +0100)] 
Merge pull request #20751 from poettering/watchdog-tweaklet

two minor watchdog tweaklets

4 years agotest: basic LVM tests 20721/head
Frantisek Sumsal [Mon, 13 Sep 2021 17:30:41 +0000 (19:30 +0200)] 
test: basic LVM tests

4 years agosd-journal: Ignore data threshold if set to zero in sd_journal_enumerate_fields()
Daan De Meyer [Wed, 15 Sep 2021 12:05:46 +0000 (13:05 +0100)] 
sd-journal: Ignore data threshold if set to zero in sd_journal_enumerate_fields()

According to the documentation, Setting the data threshold to zero disables the
data threshold alltogether. Let's make sure we actually implement this behaviour
in sd_journal_enumerate_fields() by only applying the data threshold if it exceeds
zero.

4 years agopo: Added translation using Weblate (Portuguese)
Hugo Carvalho [Wed, 15 Sep 2021 14:44:46 +0000 (16:44 +0200)] 
po: Added translation using Weblate (Portuguese)

Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
4 years agohostnamed: add support for getting the chassis type from device-tree 20731/head
Arnaud Ferraris [Tue, 14 Sep 2021 13:40:42 +0000 (15:40 +0200)] 
hostnamed: add support for getting the chassis type from device-tree

Device-tree based devices can't get the chassis type from DMI or ACPI,
and so far need a custom `/etc/machine-info` to set this property right.

A new 'chassis-type' toplevel device tree property has recently been
approved into the DT specification, making it possible to automate
chassis type detection on such devices.

This patch therefore falls back to reading this device-tree property if
nothing is available through both DMI and ACPI.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
4 years agobasic: nulstr-util: add nulstr_get() returning the matching string
Arnaud Ferraris [Tue, 14 Sep 2021 14:20:20 +0000 (16:20 +0200)] 
basic: nulstr-util: add nulstr_get() returning the matching string

Currently `nulstr_contains` returns a boolean, making it difficult to
identify which of the input strings matches the "needle".

Adding a new `nulstr_get()` function, returning a const pointer to the
matching string, eases this process and allows us to directly re-use the
result of a call to this function without additional processing or
memory allocation.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
4 years agotest: add test case for sysctl-util.[ch] 20746/head
Lennart Poettering [Tue, 14 Sep 2021 21:13:36 +0000 (23:13 +0200)] 
test: add test case for sysctl-util.[ch]

4 years agotest: make array in test-sysctl fully read-only
Lennart Poettering [Tue, 14 Sep 2021 21:13:23 +0000 (23:13 +0200)] 
test: make array in test-sysctl fully read-only

4 years agosysctl-util: per coding style, compare chars explicit against 0.
Lennart Poettering [Wed, 15 Sep 2021 07:23:56 +0000 (09:23 +0200)] 
sysctl-util: per coding style, compare chars explicit against 0.

4 years agosysctl-util: make sysctl_read_ip_property() a wrapper around sysctl_read()
Lennart Poettering [Wed, 15 Sep 2021 07:22:06 +0000 (09:22 +0200)] 
sysctl-util: make sysctl_read_ip_property() a wrapper around sysctl_read()

let's do what we did for sysctl_write()/sysctl_write_ip_property() also
for the read paths: i.e. make one a wrapper of the other, and add more
careful input validation.

4 years agosysctl-util: modernize sysctl_read() a bit
Lennart Poettering [Wed, 15 Sep 2021 07:20:49 +0000 (09:20 +0200)] 
sysctl-util: modernize sysctl_read() a bit

Let's add similar path validation to sysctl_read() as we already have in
sysctl_write().

Let's also drop the trailing newline from the returned string, like
sysctl_read_ip_property() already does it.

(I checked all users of this, they don't care)

4 years agosysctl-util: make sysctl_write_ip_property() a wrapper around sysctl_write()
Lennart Poettering [Wed, 15 Sep 2021 07:19:04 +0000 (09:19 +0200)] 
sysctl-util: make sysctl_write_ip_property() a wrapper around sysctl_write()

It does the same stuff, let's use the same codepaths as much as we can.

And while we are at it, let's generate good error codes in case we are
called with unsupported parameters/let's validate stuff more that might
originate from user input.

4 years agosd-boot: Add support for changing console mode at runtime 20483/head
Jan Janssen [Sun, 15 Aug 2021 11:44:47 +0000 (13:44 +0200)] 
sd-boot: Add support for changing console mode at runtime

4 years agosysctl-util: rework sysctl_write() to wrap write_string_file()
Lennart Poettering [Tue, 14 Sep 2021 21:19:38 +0000 (23:19 +0200)] 
sysctl-util: rework sysctl_write() to wrap write_string_file()

The sysctl_write_ip_property() call already uses write_string_file(), so
let's do so here, too, to make the codepaths more uniform.

While we are at it, let's also validate the passed path a bit, since we
shouldn't allow sysctls with /../ or such in the name. Hence simplify
the path first, and then check if it is normalized, and refuse if not.

4 years agofileio: set O_NOCTTY when reading virtual files
Lennart Poettering [Tue, 14 Sep 2021 21:11:55 +0000 (23:11 +0200)] 
fileio: set O_NOCTTY when reading virtual files

Better be safe than sorry, maybe someone points this call to a TTY one
day, and we'd rather not make it our controlling TTY in that case.

4 years agofileio: lower maximum virtual file buffer size by one byte
Lennart Poettering [Tue, 14 Sep 2021 21:03:37 +0000 (23:03 +0200)] 
fileio: lower maximum virtual file buffer size by one byte

When reading virtual files (i.e. procfs, sysfs, …) we currently put a
limit of 4M-1 on that. We have to pick something, and we have to read
these files in a single read() (since the kernel generally doesn't
support continuation read()s for them). 4M-1 is actually the maximum
size the kernel allows for reads from files in /proc/sys/, all larger
reads will result in an ENOMEM error (which is really weird, but the
kernel does what the kernel does). Hence 4M-1 sounds like a smart
choice.

However, we made one mistake here: in order to be able to detect EOFs
properly we actually read one byte more than we actually intend to
return: if that extra byte can be read, then we know the file is
actually larger than our limit and we can generate an EFBIG error from
that. However, if it cannot be read then we know EOF was hit, and we are
good. So ultimately after all we issued a single 4M read, which the
kernel then responds with ENOMEM to.  And that means read_virtual_file()
actually doesn't work properly right now on /proc/sys/. Let's fix that.

The fix is simple, lower the limit of the the buffer we intend to return
by one, i.e. 4M-2. That way, the read() we'll issue is exactly as large
as the limit the kernel allows, and we still get safely detect EOF from
it.

4 years agowatchdog: add ", ignoring" to log messages about errors we ignore 20751/head
Lennart Poettering [Wed, 15 Sep 2021 13:52:53 +0000 (15:52 +0200)] 
watchdog: add ", ignoring" to log messages about errors we ignore

As per coding style. Also downgrade relevant log messages to
LOG_WARNING.

4 years agowatchdog: pass right error code to log function so that %m works
Lennart Poettering [Wed, 15 Sep 2021 13:43:42 +0000 (15:43 +0200)] 
watchdog: pass right error code to log function so that %m works

4 years agorepart: mark an assert()-only variable as unused 20738/head
Frantisek Sumsal [Wed, 15 Sep 2021 13:46:19 +0000 (15:46 +0200)] 
repart: mark an assert()-only variable as unused

otherwise compilation with -Db_ndebug=true complains about a
set-but-not-used variable:

```
 ../src/partition/repart.c:907:33: error: variable 'left' set but not used [-Werror,-Wunused-but-set-variable]
                 uint64_t start, left;
                                                 ^
                                                 1 error generated.
```

4 years agoMerge pull request #20650 from fbuihuu/watchdog-rework
Luca Boccassi [Wed, 15 Sep 2021 13:44:49 +0000 (14:44 +0100)] 
Merge pull request #20650 from fbuihuu/watchdog-rework

Watchdog rework

4 years agojournalctl: never fail at flushing when the flushed flag is set
Franck Bui [Wed, 4 Aug 2021 09:20:07 +0000 (11:20 +0200)] 
journalctl: never fail at flushing when the flushed flag is set

Even if journald was not running, flushing the volatile journal used to work if
the journal was already flushed (ie the flushed flag
/run/systemd/journald/flushed was created).

However since commit 4f413af2a0a, this behavior changed and now '--flush' fails
because it tries to contact journald without checking the presence of the
flushed flag anymore.

This patch restores the previous behavior since there's no reason to fail when
journalctl can figure out that the flush is not necessary.

4 years agotest: document autopkgtest CI infrastructure
Luca Boccassi [Wed, 15 Sep 2021 12:49:04 +0000 (13:49 +0100)] 
test: document autopkgtest CI infrastructure

4 years agoMerge pull request #20729 from yuwata/ethtool-features-set
Yu Watanabe [Wed, 15 Sep 2021 11:28:24 +0000 (20:28 +0900)] 
Merge pull request #20729 from yuwata/ethtool-features-set

ethtool-util: support more offloading feature settings

4 years agoMerge pull request #20728 from yuwata/network-introduce-source-and-state-neighbor...
Yu Watanabe [Wed, 15 Sep 2021 11:26:44 +0000 (20:26 +0900)] 
Merge pull request #20728 from yuwata/network-introduce-source-and-state-neighbor-rule-and-nexthops

network: introduce NetworkConfigSource/State

4 years agoMerge pull request #20742 from pdmorrow/startup_cpus
Yu Watanabe [Wed, 15 Sep 2021 11:26:10 +0000 (20:26 +0900)] 
Merge pull request #20742 from pdmorrow/startup_cpus

add StartupAllowedCPUs= and StartupAllowedMemoryNodes= directives

4 years agotree-wide: mark set-but-not-used variables as unused to make LLVM happy
Frantisek Sumsal [Wed, 15 Sep 2021 08:56:21 +0000 (10:56 +0200)] 
tree-wide: mark set-but-not-used variables as unused to make LLVM happy

LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which
trips over some intentionally set-but-not-used variables or variables
attached to cleanup handlers with side effects (`_cleanup_umask_`,
`_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.):

```
../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable]
        _cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL;
                                                     ^
                                                     1 error generated.
```

4 years agowatchdog: use MIN() in update_timeout() 20650/head
Franck Bui [Wed, 15 Sep 2021 09:20:17 +0000 (11:20 +0200)] 
watchdog: use MIN() in update_timeout()

Also the previous expression was probably wrong as "(int) t >= INT_MAX" is
likely to always evaluate to false.

4 years agoshutdown: introduce init_watchdog()
Franck Bui [Wed, 15 Sep 2021 07:13:12 +0000 (09:13 +0200)] 
shutdown: introduce init_watchdog()

No functional change.

4 years agowatchdog: constify watchdog_set_device() parameter
Franck Bui [Wed, 15 Sep 2021 07:14:17 +0000 (09:14 +0200)] 
watchdog: constify watchdog_set_device() parameter

4 years agowatchdog: rename watchdog_set_timeout() into watchdog_setup()
Franck Bui [Tue, 14 Sep 2021 20:36:14 +0000 (22:36 +0200)] 
watchdog: rename watchdog_set_timeout() into watchdog_setup()

"watchdog_set_timeout()" was misleading as the function is not just a setter -
it must be called for activating the watchdog device.

4 years agomeson: add missing include directory when using xkbcommon
Antonio Alvarez Feijoo [Wed, 15 Sep 2021 06:46:40 +0000 (08:46 +0200)] 
meson: add missing include directory when using xkbcommon

Otherwise the build fails:

FAILED: systemd-localed.p/src_locale_localed.c.o
cc -Isystemd-localed.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -g -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=overflow -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Werror=unused-function -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wwrite-strings -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -Werror=shadow -include config.h -MD -MQ systemd-localed.p/src_locale_localed.c.o -MF systemd-localed.p/src_locale_localed.c.o.d -o systemd-localed.p/src_locale_localed.c.o -c ../src/locale/localed.c
../src/locale/localed.c:9:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
    9 | #include <xkbcommon/xkbcommon.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

4 years agowatchdog: minor simplification of watchdog_runtime_wait()
Franck Bui [Mon, 6 Sep 2021 12:31:30 +0000 (14:31 +0200)] 
watchdog: minor simplification of watchdog_runtime_wait()

No functional change.

4 years agowatchdog: no need to ping the device twice in watchdog_ping() if the device has just...
Franck Bui [Mon, 6 Sep 2021 10:42:50 +0000 (12:42 +0200)] 
watchdog: no need to ping the device twice in watchdog_ping() if the device has just been opened

4 years agowatchdog: update watchdog_timeout with the closest timeout found by the driver
Franck Bui [Mon, 6 Sep 2021 10:12:45 +0000 (12:12 +0200)] 
watchdog: update watchdog_timeout with the closest timeout found by the driver

Store the actual timeout value found by the driver in watchdog_timeout since
this value is more accurate for calculating the next time for pinging the
device.

4 years agocore: watchdog_set_timeout() doesn't need to return the timeout value used by the HW
Franck Bui [Mon, 6 Sep 2021 10:12:06 +0000 (12:12 +0200)] 
core: watchdog_set_timeout() doesn't need to return the timeout value used by the HW

The manager currently doesn't need it and if it does in the future an helper
should probably be introduced instead.

4 years agocore: call watchdog_ping() unconditionally
Franck Bui [Mon, 6 Sep 2021 06:26:30 +0000 (08:26 +0200)] 
core: call watchdog_ping() unconditionally

This basically reverts commit 61927b9f116bf45bfdbf19dc2981d4a4f527ae5f and
relies on the fact that watchdog_ping() will open and setup the watchdog for us
in case the device appears later on.

Also unlike what is said in comment
https://github.com/systemd/systemd/pull/17460#pullrequestreview-517434377, both
m->watchdog[] and m->overriden_watchdog[] are not supposed to store the actual
timeout used by the watchdog device but stores the value defined by the user.

If the HW timeout value is really needed by the manager then it's probably
better to read it via an helper defined in watchdog.c instead. However the HW
timeout value is currently only needed by the watchdog code itself mainly when
it calculates the time for the next ping.

4 years agowatchdog: make watchdog_ping() a NOP when the watchdog is disabled or closed
Franck Bui [Mon, 6 Sep 2021 06:47:08 +0000 (08:47 +0200)] 
watchdog: make watchdog_ping() a NOP when the watchdog is disabled or closed

This patch allows watchdog_ping() to be used unconditionally regardless of
whether watchdog_set_timeout() or watchdog_close() has been previously called
or not and in both cases watchdog_ping() does nothing.

shutdown.c has been updated to cope with this change.

4 years agofuzz: add StartupAllowedCPUs and StartupAllowedMemoryNodes to directives 20742/head
Peter Morrow [Tue, 14 Sep 2021 18:31:07 +0000 (19:31 +0100)] 
fuzz: add StartupAllowedCPUs and StartupAllowedMemoryNodes to directives

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agodocs: update docs with StartupAllowedCPUs and StartupAllowedMemoryNodes details
Peter Morrow [Tue, 14 Sep 2021 16:28:46 +0000 (17:28 +0100)] 
docs: update docs with StartupAllowedCPUs and StartupAllowedMemoryNodes details

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agosd-boot: Simplify setting console mode
Jan Janssen [Sun, 15 Aug 2021 11:44:42 +0000 (13:44 +0200)] 
sd-boot: Simplify setting console mode

4 years agocgroup: add support for StartupAllowedCPUs and StartupAllowedMemoryNodes
Peter Morrow [Tue, 14 Sep 2021 16:14:53 +0000 (17:14 +0100)] 
cgroup: add support for StartupAllowedCPUs and StartupAllowedMemoryNodes

Add new settings which can be used to control cpuset based cpu affinity
during the startup phase only.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agonetwork: use NetworkConfigSource/State to manage nexthops 20728/head
Yu Watanabe [Mon, 6 Sep 2021 00:58:59 +0000 (09:58 +0900)] 
network: use NetworkConfigSource/State to manage nexthops

This also changes the logic when Id= is not specified.
Previously, kernel picks the lowest unused ID, but now networkd picks
the lowest unused ID.

4 years agonetwork: use NetworkConfigSource/State to manage routing policy rules
Yu Watanabe [Tue, 31 Aug 2021 08:24:07 +0000 (17:24 +0900)] 
network: use NetworkConfigSource/State to manage routing policy rules

This also changes the logic when Priority= is not specified.
Previously, we request without FRA_PRIORITY attribute and kernel picks
the highest unused priority for the rule.
This makes networkd picks the highest unused priority and always request
FRA_PRIORITY attribute.

4 years agonetwork: use NetworkConfigSource/State to manage neighbors
Yu Watanabe [Sun, 5 Sep 2021 03:34:41 +0000 (12:34 +0900)] 
network: use NetworkConfigSource/State to manage neighbors

4 years agonetwork: introduce NetworkConfigSource and NetworkConfigState
Yu Watanabe [Wed, 14 Jul 2021 07:50:26 +0000 (16:50 +0900)] 
network: introduce NetworkConfigSource and NetworkConfigState

These will be used in later commits.

4 years agoRespect install_sysconfdir
Kai Wohlfahrt [Mon, 13 Sep 2021 23:32:52 +0000 (00:32 +0100)] 
Respect install_sysconfdir

This was lost e11a25cadbe and c900d89faa0 while adding jinja2
templating. Breaks builds on NixOS.

4 years agosd-journal: Don't compare hashes from different journal files
Daan De Meyer [Tue, 14 Sep 2021 14:08:46 +0000 (15:08 +0100)] 
sd-journal: Don't compare hashes from different journal files

In sd_journal_enumerate_fields(), we check if we've already handled
a field by checking if we can find it in any of the already processed
journal files. We do this by calling
journal_file_find_field_object_with_hash(), which compares the size,
payload and hash of the given field against all fields in a journal file,
trying to find a match. However, since we now use per file hash functions,
hashes for the same fields will differ between different journal files,
meaning we'll never find an actual match.

To fix the issue(), let's use journal_file_find_field_object() when one
or more of the files we're comparing is using per file keyed hashes.
journal_file_find_field_object() only takes the field payload and size
as arguments and calculates the hash itself using the hash function from
the journal file we're searching in.

4 years agoFix error building repart with no libcryptsetup (#20739)
Marcus Harrison [Wed, 15 Sep 2021 01:55:07 +0000 (03:55 +0200)] 
Fix error building repart with no libcryptsetup (#20739)

4 years agocore: watchdog_runtimeout_wait() already returns USEC_INFINITY when the watchdog...
Franck Bui [Mon, 6 Sep 2021 09:06:35 +0000 (11:06 +0200)] 
core: watchdog_runtimeout_wait() already returns USEC_INFINITY when the watchdog is disabled or closed

4 years agomain: use timestamp_is_set() in become_shutdown()
Franck Bui [Mon, 6 Sep 2021 07:28:39 +0000 (09:28 +0200)] 
main: use timestamp_is_set() in become_shutdown()

4 years agopo: Translated using Weblate (Finnish)
Jan Kuparinen [Tue, 14 Sep 2021 19:04:59 +0000 (21:04 +0200)] 
po: Translated using Weblate (Finnish)

Currently translated at 100.0% (189 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

4 years agotest: check if all paths passed to helper_check_device_symlinks() are valid
Frantisek Sumsal [Tue, 14 Sep 2021 12:49:11 +0000 (14:49 +0200)] 
test: check if all paths passed to helper_check_device_symlinks() are valid

4 years agotest: make helper_check_device_symlinks() less verbose
Frantisek Sumsal [Tue, 14 Sep 2021 12:36:04 +0000 (14:36 +0200)] 
test: make helper_check_device_symlinks() less verbose

4 years agotest: handle arbitrary paths in helper_check_device_symlinks()
Frantisek Sumsal [Mon, 13 Sep 2021 17:14:12 +0000 (19:14 +0200)] 
test: handle arbitrary paths in helper_check_device_symlinks()

4 years agotest: add an LVM helper
Frantisek Sumsal [Mon, 13 Sep 2021 16:39:22 +0000 (18:39 +0200)] 
test: add an LVM helper

4 years agotest: install dmevent service and socket
Frantisek Sumsal [Mon, 13 Sep 2021 16:39:00 +0000 (18:39 +0200)] 
test: install dmevent service and socket

4 years agotest: specify the rootfs by label
Frantisek Sumsal [Mon, 13 Sep 2021 16:14:05 +0000 (18:14 +0200)] 
test: specify the rootfs by label

otherwise the boot might fail when attaching multiple SATA devices to
the VM.

4 years agoethtool-util: add more network device features 20729/head
Yu Watanabe [Tue, 14 Sep 2021 13:12:42 +0000 (22:12 +0900)] 
ethtool-util: add more network device features

Then, we can easily add new settings to configure features in .link
file.

4 years agoethtool-util: apply tx-checksum-* features at last
Yu Watanabe [Tue, 14 Sep 2021 16:48:59 +0000 (01:48 +0900)] 
ethtool-util: apply tx-checksum-* features at last

NET_DEV_FEAT_TX matches multiple features. In the next commit, all
features whose strings start with "tx-checksum-" will be added.
To make them take precedence over NET_DEV_FEAT_TX, it will be applied
only when each explicit feature is not applied.

4 years agoci: build with clang-13
Frantisek Sumsal [Tue, 14 Sep 2021 17:06:01 +0000 (19:06 +0200)] 
ci: build with clang-13

Also, drop clang-10 builds to conserve resources.

4 years agoethtool: do not set unavailable or never_changed bits
Yu Watanabe [Tue, 14 Sep 2021 08:42:52 +0000 (17:42 +0900)] 
ethtool: do not set unavailable or never_changed bits