Commit Graph
54455 Commits
Author SHA1 Message Date
Lennart Poettering b4f25c649d boot: move TCG/TPM protocol definitions into missing_efi.h
That's what it is for...
2021-09-20 22:18:08 +02:00
Lennart Poettering 2da0a7e154 boot: use cleanup-based file handle closing a bit more 2021-09-20 22:18:03 +02:00
Lennart Poettering 70d24fedc1 boot: invert if check, to reduce indentation level 2021-09-20 22:17:49 +02:00
Lennart Poettering f62c5bd152 units: hookup systemd-boot-update.service
It was apparently missed to hook this up in
71c8bf2837.
2021-09-20 19:39:03 +02:00
Michal Sekletar 3435754559 boot: don't build bootctl when -Dgnu-efi=false is set 2021-09-20 17:41:23 +02:00
Luca Boccassi 409f4cf1f2 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.
2021-09-20 14:23:55 +01:00
Luca Boccassi 447d46879c 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
2021-09-20 14:23:55 +01:00
Luca Boccassi 6f7ccbcc74 selinux: add mac_selinux_create_file_prepare_label helper
Allow to use setfscreatecon with a custom label rather than the default
2021-09-20 14:23:55 +01:00
Daan De Meyer 064a5c1438 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.
2021-09-20 13:53:11 +01:00
Luca Boccassi f621b8d773 socket-util: const-ify iov parameter in send_one_fd_iov_sa 2021-09-20 12:30:02 +01:00
Lukas Senionis fa4f366211 hwdb: add touchpad fuzz for Asus UX362FA (#20770) 2021-09-20 14:00:42 +10:00
Luca Boccassi 4ee41ed515 Merge pull request #20780 from mrc0mmand/test-storage-btrfs
test: btrfs-related udev tests
2021-09-19 19:04:45 +01:00
Frantisek Sumsal 26a5ae8e95 test: dump the test output to console as well for easier debugging 2021-09-19 13:46:55 +02:00
Frantisek Sumsal 41187e716d test: regenerate module dependencies after installing all modules 2021-09-19 13:46:55 +02:00
Frantisek Sumsal abfa9a0e7d 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.
2021-09-19 13:46:55 +02:00
Frantisek Sumsal b1471e559e test: btrfs-related udev tests 2021-09-19 13:46:49 +02:00
Frantisek Sumsal 677acd2101 test: check symlinks under /dev/mapper by default as well 2021-09-18 20:44:34 +02:00
Frantisek Sumsal de11005c1a test: use subshells a bit more
to tweak shell flags in specific functions without affecting the rest of
the script.
2021-09-18 20:44:34 +02:00
Frantisek Sumsal b216501a8e test: cleanup the intermediate disk images 2021-09-18 20:44:34 +02:00
Frantisek Sumsal 70ec7736f8 test: tidy up the feature handling 2021-09-18 20:44:34 +02:00
Frantisek Sumsal babe935563 test: add a btrfs helper 2021-09-18 20:44:34 +02:00
Frantisek Sumsal dbc04797c1 test: lower the number of iterations in LVM tests
as some of the operations take a really long time.
2021-09-18 20:44:34 +02:00
Lia Lenckowski 66e10d45d9 bash-completion: circumvent aliases for 'ls' 2021-09-18 15:19:40 +09:00
Frantisek Sumsal 776fc8c385 test: unify handling of supported "features" 2021-09-17 17:45:39 +02:00
Frantisek Sumsal af861917c5 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

```
2021-09-17 12:07:02 +01:00
Frantisek Sumsal 93caec7ed6 Merge pull request #20769 from weblate/weblate-systemd-master
Translations update from Weblate
2021-09-16 20:23:51 +02:00
Hugo Carvalho b6c5a863a5 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
2021-09-16 20:05:00 +02:00
Christian Wehrli 3b55bd2fa9 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
2021-09-16 20:05:00 +02:00
Lennart Poettering 281752e406 Merge pull request #20763 from poettering/fileio-test
test-fileio: test read_virtual_file() with more files from /proc
2021-09-16 17:47:03 +02:00
Piotr Drąg f0c5e8d452 po: add false positives to POTFILES.skip 2021-09-16 16:19:32 +01:00
Daan De Meyer f2ed82d510 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.
2021-09-16 12:26:29 +01:00
Daan De Meyer 71feeae4bf 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.
2021-09-16 12:26:29 +01:00
Daan De Meyer ccf7cf2aa4 oom: Add missing sd-bus.h include 2021-09-16 12:26:26 +01:00
Lennart Poettering f3b751220b 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
2021-09-16 12:23:32 +02:00
Lennart Poettering 00bd9a4a82 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).
2021-09-16 12:23:25 +02:00
Yu Watanabe f782eee68a journal,network,timesync: fix segfault on 32bit timeval/timespec systems
Fixes #20741.
2021-09-16 11:47:44 +02:00
Anita Zhang 5aaa55d841 fileio: start with 4k buffer for procfs
There's a very gradual increase of anonymous memory in systemd-journald that
blames to 2ac67221bb.

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 2ac67221bb.
If it isn't big enough then try again with the larger buffers.
2021-09-16 11:31:29 +02:00
Luca Boccassi 1dcd91ad11 Merge pull request #20758 from yuwata/test-17-udev-cleanups
test: several cleanups for TEST-17-UDEV
2021-09-16 09:45:10 +01:00
Yu Watanabe 2d253d7206 Merge pull request #20721 from mrc0mmand/test-storage-lvm
test: udev/LVM storage tests
2021-09-16 12:39:24 +09:00
Yu Watanabe 73bf0f2ace Merge pull request #20738 from mrc0mmand/ci-llvm-13
ci: build with clang-13
2021-09-16 09:32:21 +09:00
Lennart Poettering 28078aa5cc Merge pull request #20483 from medhefgo/boot
sd-boot: Add support for changing console mode at runtime
2021-09-16 00:03:41 +02:00
Lennart Poettering 46ebc0a6f5 Merge pull request #20731 from a-wai/main
hostnamed: add support for getting the chassis type from device-tree
2021-09-16 00:02:05 +02:00
Lennart Poettering 3d7e273dba Merge pull request #20746 from poettering/sysctl-rework
various sysctl-util.c cleanups
2021-09-16 00:01:18 +02:00
Yu Watanabe a871f3bb54 test: drop unnecessary sleep and 'udevadm settle'
After the triggered events are processed, all symlinks which store
watch handles should be valid.
2021-09-16 06:55:11 +09:00
Yu Watanabe a9d8bebacd test: use --settle option for udevadm trigger 2021-09-16 06:55:11 +09:00
Yu Watanabe e70f57796d test: use --settle option for udevadm trigger
Then, we can drop the loops.
This also drops unnecessary `udevadm control --reload`.
2021-09-16 06:55:04 +09:00
Yu Watanabe 9228ecaf8c 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`.
2021-09-16 06:46:19 +09:00
Yu Watanabe 26146d82db test: use --settle option for udevadm trigger 2021-09-16 06:39:48 +09:00
Luca Boccassi a51f6dba60 Merge pull request #20751 from poettering/watchdog-tweaklet
two minor watchdog tweaklets
2021-09-15 21:48:39 +01:00
Frantisek Sumsal 0203b2e4be test: basic LVM tests 2021-09-15 20:17:50 +02:00