]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agovariuos: add missing includes
Zbigniew Jędrzejewski-Szmek [Tue, 14 Sep 2021 18:17:52 +0000 (20:17 +0200)] 
variuos: add missing includes

4 years agoMerge pull request #20767 from bluca/portable_extract_selinux
Zbigniew Jędrzejewski-Szmek [Wed, 22 Sep 2021 10:57:30 +0000 (12:57 +0200)] 
Merge pull request #20767 from bluca/portable_extract_selinux

portable: copy SELinux label when extracting units from images

4 years agoAdd Logitech USB-PS/2 M-BT96A to hwdb
John Lindgren [Wed, 22 Sep 2021 00:10:04 +0000 (20:10 -0400)] 
Add Logitech USB-PS/2 M-BT96A to hwdb

4 years agoMerge pull request #20756 from benzea/benzea/usb-persist
Luca Boccassi [Wed, 22 Sep 2021 09:50:07 +0000 (10:50 +0100)] 
Merge pull request #20756 from benzea/benzea/usb-persist

hwdb: Permit unsetting power/persist for USB devices

4 years agoMerge pull request #20800 from keszybz/smack-compilatio-fix
Yu Watanabe [Wed, 22 Sep 2021 07:56:37 +0000 (16:56 +0900)] 
Merge pull request #20800 from keszybz/smack-compilatio-fix

smack: move helper function to smack-util.c

4 years agoMerge pull request #20652 from OnkelUlla/fix_systemd.netdev_manpage
Yu Watanabe [Wed, 22 Sep 2021 06:34:21 +0000 (15:34 +0900)] 
Merge pull request #20652 from OnkelUlla/fix_systemd.netdev_manpage

Some Fixes for SYSTEMD.NETDEV(5)

4 years agounit: install the systemd-bless-boot.service only if we have gnu-efi
Frantisek Sumsal [Tue, 21 Sep 2021 20:47:42 +0000 (22:47 +0200)] 
unit: install the systemd-bless-boot.service only if we have gnu-efi

Follow-up to #20591.

4 years agohwdb: update fingerprint autosuspend rules 20756/head
Benjamin Berg [Fri, 17 Sep 2021 10:57:31 +0000 (12:57 +0200)] 
hwdb: update fingerprint autosuspend rules

This pulls in a few new devices and adds ID_PERSIST=0.

4 years agohwdb: Permit unsetting power/persist for USB devices
Benjamin Berg [Wed, 15 Sep 2021 16:37:24 +0000 (18:37 +0200)] 
hwdb: Permit unsetting power/persist for USB devices

The USB persist feature allows devices that can retain their state when
powered down to work across suspend/resume. This is in particular useful
for USB drives.

However, the persist feature can get in the way for devices that are
unable to retain their state when power is lost. An example of such
stateful devices are fingerprint readers where USB persist should be
disabled to ensure userspace can detect whether the USB device had a
power loss during system suspend.

This will initially be used by the libfprint autosuspend hwdb.

Closes: #20754
4 years agomeson: ignore -Dsmack-run-label= if -Dsmack=false 20800/head
Zbigniew Jędrzejewski-Szmek [Tue, 21 Sep 2021 17:53:20 +0000 (19:53 +0200)] 
meson: ignore -Dsmack-run-label= if -Dsmack=false

Compilation would fail because we could have HAVE_SMACK_RUN_LABEL without
HAVE_SMACK. This doesn't make much sense, so let's just make -Dsmack=false
completely disable smack.

Also, the logic in smack-setup.c seems dubious: '#ifdef SMACK_RUN_LABEL'
would evaluate to true even if -Dsmack-run-label='' is used. I think
this was introduced in the conversion to meson:
8b197c3a8a57c3f7c231b39e5660856fd9580c80 added

AC_ARG_WITH(smack-run-label,
AS_HELP_STRING([--with-smack-run-label=STRING],
        [run systemd --system with a specific SMACK label]),
        [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],
        [])

i.e. it really was undefined if not specified. And it was same
still in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8 when configure.ac
was dropped.

So let's use the single conditional HAVE_SMACK_RUN_LABEL everywhere.

4 years agomkosi: Fix CI
Daan De Meyer [Fri, 17 Sep 2021 09:57:39 +0000 (10:57 +0100)] 
mkosi: Fix CI

\#20629 moved the mkosi configs to mkosi.default.d/ so we were building
for the host distro (Ubuntu) in each CI configuration. To fix it, we
write the distro we want to test to a mkosi.default file and mkosi
will apply the other necessary configs automatically from mkosi.default.d/<distro>

This commit also removes unnecessary CLI options that are already handled
by the config files.

4 years agosmack: move helper function to smack-util.c
Zbigniew Jędrzejewski-Szmek [Tue, 21 Sep 2021 16:29:23 +0000 (18:29 +0200)] 
smack: move helper function to smack-util.c

The function was in basic/fileio.c, but it's more appropriate to
keep it out of src/basic.

Fixes compilation with -Dsmack-run-label= set.

4 years agoMerge pull request #20690 from DaanDeMeyer/oomd-user-services
Luca Boccassi [Tue, 21 Sep 2021 14:39:48 +0000 (15:39 +0100)] 
Merge pull request #20690 from DaanDeMeyer/oomd-user-services

oom: Support for user services

4 years agomeson: fix creation of man pages indices
Zbigniew Jędrzejewski-Szmek [Tue, 21 Sep 2021 08:59:13 +0000 (10:59 +0200)] 
meson: fix creation of man pages indices

Fixes #20795. Bug introduced in f12c5d36a9a162f833987b03fbf0b65248581cbb.

4 years agoDrop bundled copy of linux/if_arp.h
Zbigniew Jędrzejewski-Szmek [Wed, 15 Sep 2021 14:33:05 +0000 (16:33 +0200)] 
Drop bundled copy of linux/if_arp.h

As far as I can see, we use this to get a list of ARPHRD_* defines (used in
particular for Type= in .link files). If we drop our copy, and build against
old kernel headers, the user will have a shorter list of types available.  This
seems OK, and I don't think it's worth carrying our own version of this file
just to have newest possible entries.

7c5b9952c4f6e2b72f90edbe439982528b7cf223 recently updated this file, but we'd
have to update it every time the kernel adds new entries. But if we look at
the failure carefully:

src/basic/arphrd-from-name.gperf:65:16: error: ‘ARPHRD_MCTP’ undeclared (first use in this function); did you mean ‘ARPHRD_FCPP’?
   65 | MCTP, ARPHRD_MCTP
      |                ^~
      |                ARPHRD_FCPP

we see that the list we were generating was from the system headers, so it was
only as good as the system headers anyway, without the newer entries in our
bundled copy, if there were any. So let's make things simpler by always using
system headers.

And if somebody wants to fix things so that we always have the newest list,
then we should just generate and store the converted list, not the full header.

4 years agoMerge pull request #20790 from poettering/boot-fixes
Lennart Poettering [Tue, 21 Sep 2021 09:35:04 +0000 (11:35 +0200)] 
Merge pull request #20790 from poettering/boot-fixes

various EFI/boot fixes

4 years agostub: prepare section pointers in separate steps 20790/head
Lennart Poettering [Fri, 17 Sep 2021 08:15:57 +0000 (10:15 +0200)] 
stub: prepare section pointers in separate steps

In a follow-up patch we are going to modify the initrd, hence prepare
the pointers/"physical addresses" to it, first, so that we can do so
easily.

Also, do some other tweaks and cleanups to physical address/pointer
conversion.

4 years agostub: use proper enums instead of hardcoded numeric indexes for identifying PE sections
Lennart Poettering [Thu, 16 Sep 2021 21:59:39 +0000 (23:59 +0200)] 
stub: use proper enums instead of hardcoded numeric indexes for identifying PE sections

4 years agoboot: ReallocatePool() supports NULL pointers as first argument
Lennart Poettering [Mon, 20 Sep 2021 12:06:23 +0000 (14:06 +0200)] 
boot: ReallocatePool() supports NULL pointers as first argument

Just like userspace realloc() the EFIlib ReallocatePool() function is
happy to use a NULL pointer as input, in which case it is equivalent to
AllocatePool(). See:

https://github.com/vathpela/gnu-efi/blob/269ef9dbc77ebec2723e0e6ae082bbca9516f5f1/lib/misc.c#L57

4 years agoboot: modernize measure.c
Lennart Poettering [Mon, 20 Sep 2021 11:33:18 +0000 (13:33 +0200)] 
boot: modernize measure.c

Let's use _cleanup_freepool_, compound literals for initialization,
OFFSETOF() and let's remove some unnecessary casts.

No change in behaviour.

4 years agoboot: move TCG/TPM protocol definitions into missing_efi.h
Lennart Poettering [Mon, 20 Sep 2021 11:32:12 +0000 (13:32 +0200)] 
boot: move TCG/TPM protocol definitions into missing_efi.h

That's what it is for...

4 years agoboot: use cleanup-based file handle closing a bit more
Lennart Poettering [Fri, 17 Sep 2021 08:32:33 +0000 (10:32 +0200)] 
boot: use cleanup-based file handle closing a bit more

4 years agoboot: invert if check, to reduce indentation level
Lennart Poettering [Thu, 16 Sep 2021 14:02:36 +0000 (16:02 +0200)] 
boot: invert if check, to reduce indentation level

4 years agounits: hookup systemd-boot-update.service
Lennart Poettering [Mon, 20 Sep 2021 15:46:26 +0000 (17:46 +0200)] 
units: hookup systemd-boot-update.service

It was apparently missed to hook this up in
71c8bf28378958a5ab2348e9ec586fbe78c71dfd.

4 years agoboot: don't build bootctl when -Dgnu-efi=false is set
Michal Sekletar [Mon, 30 Aug 2021 16:38:09 +0000 (18:38 +0200)] 
boot: don't build bootctl when -Dgnu-efi=false is set

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 agooom: Add support for user unit ManagedOOM property updates 20690/head
Daan De Meyer [Thu, 9 Sep 2021 15:12:55 +0000 (16:12 +0100)] 
oom: Add support for user unit ManagedOOM property updates

Compared to PID1 where systemd-oomd has to be the client to PID1
because PID1 is a more privileged process than systemd-oomd, systemd-oomd
is the more privileged process compared to a user manager so we have
user managers be the client whereas systemd-oomd is now the server.

The same varlink protocol is used between user managers and systemd-oomd
to deliver ManagedOOM property updates. systemd-oomd now sets up a varlink
server that user managers connect to to send ManagedOOM property updates.

We also add extra validation to make sure that non-root senders don't
send updates for cgroups they don't own.

The integration test was extended to repeat the chill/bloat test using
a user manager instead of PID1.

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 agocore: Introduce build_managed_oom_cgroups_json()
Daan De Meyer [Thu, 2 Sep 2021 12:32:31 +0000 (14:32 +0200)] 
core: Introduce build_managed_oom_cgroups_json()

Will be reused to build the varlink message contents sent by user
instances of systemd to systemd-oomd's varlink server in a future
commit.

4 years agooom: Introduce process_managed_oom_message()
Daan De Meyer [Thu, 2 Sep 2021 11:24:23 +0000 (13:24 +0200)] 
oom: Introduce process_managed_oom_message()

Gets rid of a few gotos, allows removing the extra ret variable and
will also be used in a future commit by the codepath that receives
cgroups from user instances of systemd.

4 years agooom: Add missing sd-bus.h include
Daan De Meyer [Thu, 2 Sep 2021 11:17:42 +0000 (13:17 +0200)] 
oom: Add missing sd-bus.h include

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.