1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00
Commit Graph

61333 Commits

Author SHA1 Message Date
Lennart Poettering
e3b9a5ff26 blkid: add helpers that get gpt partition uuid as sd_id128_t
just some refactoring to make things simpler.
2022-11-29 16:05:17 +01:00
Lennart Poettering
e6d1d4c0b3 btrfs-util: convert O_PATH if necessary, in btrfs quota call
Fixes: #25468
2022-11-29 15:35:06 +01:00
Lennart Poettering
698bc1861e blockdev-util: move O_PATH fd conversion into btrfs_get_block_device_fd() to shorten things
And let's use a simple call to the new fd_reopen_condition() helper
there.
2022-11-29 15:34:27 +01:00
Lennart Poettering
f1cab3d6dc btrfs-util: convert to fd_reopen_condition() 2022-11-29 15:33:51 +01:00
Lennart Poettering
5f5865f0ad fd-util: add new helper fd_reopen_conditional()
This is a wrapper around fd_reopen() that will reopen an fd if the
F_GETFL flags indicate this is necessary, and otherwise not.

This is useful for various utility calls that shall be able to operate
on O_PATH and without it, and might need to convert between the two
depending on what's passed in.
2022-11-29 15:32:47 +01:00
Jan Janssen
f6d59e2ebf boot: Only do full driver initialization in VMs
Doing the reconnect dance on some real firmware creates huge delays on
boot. This should not be needed anymore as we now ask the firmware to
make console devices and xbootldr partitions available explicitly in a
more targeted fashion.

Fixes: #25510
2022-11-29 15:05:56 +01:00
Jan Janssen
7f19be808c boot: Make sure all partitions drivers are connected 2022-11-29 15:03:52 +01:00
Jan Janssen
b99bf58118 boot: Use EFI_BOOT_MANAGER_POLICY_PROTOCOL to connect console devices 2022-11-29 15:03:52 +01:00
Lennart Poettering
0461375326
Merge pull request #25385 from drvink/main
systemd: Support OOMPolicy in scope units
2022-11-29 14:40:18 +01:00
Lennart Poettering
63b96eb9b3 fdisk-util: add fdisk_partition_get_type_as_id128() helper
Let's also add an easy accessor for the other per-partition UUID.
2022-11-29 12:07:15 +01:00
Lennart Poettering
02e32aa629 fdisk-util: add fdisk_partition_get_uuid_as_id128() helper
Inspired by: #25534
2022-11-29 12:07:15 +01:00
Joerg Behrmann
0ccfd3564b kernel-install: Add uki layout
Currently the kernel-install man page only documents the bls layout for use
with the boot loader spec type #1. 90-loaderentry.install uses this layout to
generate loader entries and copy the kernel image and initrd to $BOOT.

This commit documents a second layout "uki" and adds 90-uki-copy.install,
which copies a UKI "uki.efi" from the staging area or any file with the .efi
extension given on the command line to
$BOOT/EFI/Linux/$ENTRY_TOKEN-$KERNEl_VERSION(+$TRIES).efi

This allows for both locally generated and distro-provided UKIs to be handled
by kernel-install.
2022-11-29 11:33:27 +01:00
Lennart Poettering
87a7084b35 update TODO 2022-11-29 10:47:51 +01:00
Daan De Meyer
49d1fcd01c
Merge pull request #25132 from yuwata/core-device-inactivate-removed-device-on-switching-root
core/device: inactivate removed device on switching root
2022-11-29 10:27:34 +01:00
Yu Watanabe
7a95d1d8d1
Merge pull request #25508 from enr0n/test-various-fixes
Fix test failures found in Ubuntu autopkgtest
2022-11-29 13:46:39 +09:00
Yu Watanabe
f334a8c8e9
Merge pull request #25536 from yuwata/sd-netlink-several-fixes
sd-netlink: several fixes
2022-11-29 10:35:07 +09:00
Yu Watanabe
c167ed0fd1
Merge pull request #25552 from yuwata/network-ndisc-trivial-fixes
network: NDisc: trivial fixes
2022-11-29 10:33:33 +09:00
Luca Boccassi
8936a2a8f0
Merge pull request #25532 from Werkov/fix-cgtop-args
cgtop: Do not rewrite -P or -k options
2022-11-28 22:20:47 +01:00
Tonći Galić
bcad98ee4d
hwdb: Add support for Elgato Stream Pedal (#25550)
This adds the [Elgato Stream Pedal](https://www.elgato.com/en/stream-deck-pedal)
as part of the supported family
2022-11-29 05:15:25 +09:00
Yu Watanabe
6a4f43cd66 network: drop invalid and unused flag
Route.flags can only take RTNH_F_ONLINK, and other flags are silently
dropped.
2022-11-29 04:31:27 +09:00
Yu Watanabe
d87c5cd8d9 network: fix indentation 2022-11-29 04:30:12 +09:00
Nick Rosbrook
bb59fdc1e3 test: handle Debian's /etc/default/locale in testsuite-74.firstboot.sh
This handles a Debian-specific quirk where /etc/default/locale is used
instead of /etc/locale.conf. There is currently special handling for
this in testsuite-73.sh, so the quirk should be handled here too for
consistency.
2022-11-28 11:01:22 -05:00
Nick Rosbrook
84e5b9225d test: make sure mount point exists in testsuite-64.sh 2022-11-28 10:55:20 -05:00
Luca Boccassi
94d2caedee
Merge pull request #25496 from DaanDeMeyer/repart-optimize
repart: Prefer using loop devices to populate filesystems when available
2022-11-28 15:51:32 +01:00
Luca Boccassi
6d3fcb6ccd
Merge pull request #25222 from medhefgo/stub-cmdline
stub: Fix cmdline handling
2022-11-28 15:49:17 +01:00
Michal Koutný
d4e32838e8 test: Add tests for systemd-cgtop args parsing 2022-11-28 14:29:49 +01:00
Michal Koutný
48600b3524 cgtop: Do not rewrite -P or -k options
--recursive=no will overwrite possible -P or -k option hence making the
recursive disabling impossible.

Check what counting types the system supports (encoded in the ordering
of our enum) of and pick whatever user requests but is also supported.

Fixes: #25248
2022-11-28 14:29:49 +01:00
Daan De Meyer
d3201eb4f4 repart: Prefer using loop devices to populate filesystems when available
Let's make sure we use loop devices if we have access to them and
only fall back to regular files if we can't use loop devices. We
prefer loop devices because when using mkfs --root options, we have
to populate a temporary staging tree which means we're copying every
file twice instead of once when using loop devices.
2022-11-28 10:52:21 +01:00
Daan De Meyer
d2ac7698cb repart: Make sure all files in the image are owned by root 2022-11-28 10:46:00 +01:00
Daan De Meyer
8a050905a3 repart: Move comment 2022-11-28 10:46:00 +01:00
Jan Janssen
b17f3b3d80 stub: Detect empty LoadOptions when run from EFI shell
The EFI shell will pass the entire command line to the application it
starts, which includes the file path of the stub binary. This prevents
us from using the built-in cmdline if the command line is otherwise
empty.

Fortunately, the EFI shell registers a protocol on any images it starts
this way. The protocol even lets us access the args individually, making
it easy to strip the stub path off.

Fixes: #25201
2022-11-27 17:13:04 +01:00
Mike Yuan
3185360980 systemctl: deprecate passing positional argument to reboot completely
(follow-up of #15958)

In #15958 we deprecated passing positional argument to reboot by
generate a warning. It's been two years now and I believe it can
be dropped completely, as per requested in #15773.
2022-11-27 11:18:32 +01:00
Evgeny Vereshchagin
84f788d669 resolve: format zero-length RDATA according to rfc3597
If the RDATA is of zero length, the text representation contains only
the \# token and the single zero representing the length.
2022-11-26 12:20:21 +00:00
Evgeny Vereshchagin
49f936cd0a tests: add a file triggering "applying zero offset to null pointer"
```
../src/basic/hexdecoct.c:66:44: runtime error: applying zero offset to null pointer
    #0 0x7f6022650c44 in hexmem /home/vagrant/systemd/build-fuzzers/../src/basic/hexdecoct.c:66:44
    #1 0x577583 in dns_resource_record_to_string /home/vagrant/systemd/build-fuzzers/../src/resolve/resolved-dns-rr.c:1140:21
    #2 0x563669 in LLVMFuzzerTestOneInput /home/vagrant/systemd/build-fuzzers/../src/resolve/fuzz-resource-record.c:25:39
    #3 0x44d2a1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-resource-record+0x44d2a1) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #4 0x42d32f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-resource-record+0x42d32f) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #5 0x434920 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/out/fuzz-resource-record+0x434920) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #6 0x424006 in main (/home/vagrant/systemd/out/fuzz-resource-record+0x424006) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #7 0x7f602142950f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) (BuildId: 85c438f4ff93e21675ff174371c9c583dca00b2c)
    #8 0x7f60214295c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x295c8) (BuildId: 85c438f4ff93e21675ff174371c9c583dca00b2c)
    #9 0x424044 in _start (/home/vagrant/systemd/out/fuzz-resource-record+0x424044) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/basic/hexdecoct.c:66:44 in
```
2022-11-26 11:57:22 +00:00
Evgeny Vereshchagin
ae8654f9e6 tests: fuzz dns resource records
It should help to catch issues like https://github.com/systemd/systemd/issues/19584,
https://github.com/systemd/systemd/issues/25449.
2022-11-26 09:52:09 +00:00
Yu Watanabe
52ceba53d3 sd-netlink: append instead of prepend multipart message
Previously, e.g., networkd enumerated network interfaces with ifindex
in a decreasing order, as sd-netlink inverses the order of the received
multipart messages.
Let's keep the order of the multipart messages. Hopefully this changes
no behavior, as our code do not depend on the order of the received
multipart messages.

Before:
===
Nov 26 09:35:10 systemd[1]: Starting Network Configuration...
Nov 26 09:35:11 systemd-networkd[36185]: wlp59s0: Saved new link: ifindex=3, iftype=ETHER(1), kind=n/a
Nov 26 09:35:12 systemd-networkd[36185]: enp0s31f6: Saved new link: ifindex=2, iftype=ETHER(1), kind=n/a
Nov 26 09:35:12 systemd-networkd[36185]: lo: Saved new link: ifindex=1, iftype=LOOPBACK(772), kind=n/a

After:
===
Nov 26 09:45:18 systemd[1]: Starting Network Configuration...
Nov 26 09:45:19 systemd-networkd[38372]: lo: Saved new link: ifindex=1, iftype=LOOPBACK(772), kind=n/a
Nov 26 09:45:19 systemd-networkd[38372]: enp0s31f6: Saved new link: ifindex=2, iftype=ETHER(1), kind=n/a
Nov 26 09:45:19 systemd-networkd[38372]: wlp59s0: Saved new link: ifindex=3, iftype=ETHER(1), kind=n/a
2022-11-26 11:28:27 +09:00
Yu Watanabe
a8ac052624 sd-netlink: do not link non-multipart messages
Previously, if a single packet contains multiple non-multipart messages,
then the messages were linked and saved as a single entry, especially
even if the messages has different serial numbers. Though, not sure if
the kernel sends such packet. But at least for safety, let's link only
multipart messages.
2022-11-26 11:28:27 +09:00
Yu Watanabe
9482429af9 sd-netlink: split out parse_message_one() from socket_read_message()
No functional change, just refactoring and preparation for later
commits.
2022-11-26 11:28:27 +09:00
Yu Watanabe
2b176edc74 sd-netlink: do not use serials currently queued 2022-11-26 11:28:27 +09:00
Yu Watanabe
7b34bae3b1 sd-netlink: also manage received messages by serial
Then, we can easily find the received message matching with requested
serial.
2022-11-26 11:28:27 +09:00
Yu Watanabe
e417c4ac44 sd-netlink: reimplement received message queue
By using OrderedSet and Hashmap, we can drop all memmove() calls.
No functional changes, just refactoring.
2022-11-26 11:28:27 +09:00
Yu Watanabe
2ea465ef62 sd-netlink: introduce netlink_queue_received_message() and friend
No functional change, just refactoring.
2022-11-26 11:28:27 +09:00
Yu Watanabe
766417bd76 sd-netlink: fix segfault 2022-11-26 11:28:27 +09:00
Yu Watanabe
bc1a8e2b6e sd-netlink: fix possible use-after-free
When we receive a multi-part message and fail to parse it, then
the prviously received message is freed with the _cleanup_ attribute,
but still referenced by sd_netlink.rqueue_partial. That causes
use-after-free when we receive another multi-part message.
2022-11-26 11:28:27 +09:00
Yu Watanabe
b491454dfc sd-netlink: return earlier when received invalid message 2022-11-26 11:28:27 +09:00
Yu Watanabe
fb298ef104 sd-netlink: allocate read buffer when necessary 2022-11-26 11:28:27 +09:00
Yu Watanabe
61d95dc02c sd-netlink: check received size in socket_recv_message()
No functional change, just refactoring and slightly shorten
socket_read_message().
2022-11-26 11:28:27 +09:00
Yu Watanabe
b374397ec5 sd-netlink: drop redundant 'else' 2022-11-26 11:28:27 +09:00
Yu Watanabe
027193db48 sd-netlink: always initialize return variable on success 2022-11-26 11:28:27 +09:00
Lennart Poettering
f8cf3d19d2 fdisk: introduce common fdisk_new_context_fd() helper
We do the same thing over and over again and it's a bit ugly, hence
let's unify the code for it at one common place.
2022-11-26 11:28:05 +09:00