1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00
Commit Graph

53205 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
a14e028e86 man: cross-reference DeviceAllow= and PrivateDevices=
They are somewhat similar, but not easy to discover, esp. considering that
they are described in different pages.

For PrivateDevices=, split out the first paragraph that gives the high-level
overview. (The giant second paragraph could also use some heavy editing to break
it up into more digestible chunks, alas.)
2021-09-27 09:19:02 +02:00
Zbigniew Jędrzejewski-Szmek
ce0458be09 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.
2021-09-21 18:31:42 +02:00
Luca Boccassi
71a80dcc0b
Merge pull request #20690 from DaanDeMeyer/oomd-user-services
oom: Support for user services
2021-09-21 15:39:48 +01:00
Zbigniew Jędrzejewski-Szmek
a7052c6e5c meson: fix creation of man pages indices
Fixes #20795. Bug introduced in f12c5d36a9.
2021-09-21 15:36:46 +01:00
Zbigniew Jędrzejewski-Szmek
e7f46ee3ae 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.

7c5b9952c4 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.
2021-09-21 12:04:28 +01:00
Lennart Poettering
f0c6333d4e
Merge pull request #20790 from poettering/boot-fixes
various EFI/boot fixes
2021-09-21 11:35:04 +02:00
Lennart Poettering
5b5d365d73 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.
2021-09-20 22:18:27 +02:00
Lennart Poettering
e41d3d8929 stub: use proper enums instead of hardcoded numeric indexes for identifying PE sections 2021-09-20 22:18:22 +02:00
Lennart Poettering
04394aa185 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:

269ef9dbc7/lib/misc.c (L57)
2021-09-20 22:18:17 +02:00
Lennart Poettering
ff3aa8d1e0 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.
2021-09-20 22:18:12 +02:00
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
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
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