Commit Graph
45159 Commits
Author SHA1 Message Date
Lennart Poettering 340d979af3 condition: add ConditionSecurity=measured-uki
We have various services that should only run in a measured UKI
environment. Let's add an explicit high-level check for that.
2023-09-27 12:10:46 +02:00
Lennart Poettering be8f478c0f efi-loader: rename efi_stub_measured() → efi_measured_uki()
Let's say "uki" rather than "stub", since that is just too generic, and
we shouldn't limit us to our own stub anyway, but generally define a
concept of a "measured UKI", which is a UKI that measures its part to
PCR 11.

This is mostly preparation for exposing this check to the user via
ConditionSecurity=.
2023-09-27 11:51:13 +02:00
Susant Sahani 0ba8374bb8 ndisc: Also set link hoplimit
The per route hop limit does not place the hop limit in the IPv6 header.
https://github.com/systemd/systemd/issues/28437#issuecomment-1711055181
2023-09-27 11:05:15 +02:00
Daan De Meyer 3bd337a084 network: Rename json_append_one() and move to json.h 2023-09-26 19:01:34 +01:00
Daan De Meyer 418a498777 journal: Stop trying to open runtime journal once flushed
Once we've flushed the runtime journal to /var, stop trying to open
it since that will just fail with ENOENT all the time.
2023-09-26 19:01:07 +01:00
Jan Janssen 90461ef56f meson: Fix version script handling
Build targets should have a link dependency on the version scripts they
use. This also uses absolute paths in anticipation for meson 1.3
needlessly deprecating file to string conversions.
2023-09-26 19:41:53 +02:00
huyubiao b53a80966e systemd-hwdb: fix unsigned and signed comparison problem
...
uint8_t c;
struct trie_node *child;

for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) {
        _cleanup_free_ struct trie_node *new_child = NULL;
        _cleanup_free_ char *s = NULL;
        ssize_t off;
if (c == search[i + p])
        continue;
...
When '®' is present in search, c is 194, search[i + p] is -62, c is not equal to search[i + p], but c should be equal to search[i + p].
2023-09-26 17:38:16 +01:00
Lennart Poettering 1617424ce7 udev: raise RLIMIT_NOFILE as high as we can
We might need a lot of fds on large systems, hence raise RLIMIT_NOFILE
to what the service manager allows us, which is quite a lot these days.

udev already sets FORK_RLIMIT_NOFILE_SAFE when forking of chilren, thus
ensuring that forked off processes get their RLIMIT_NOFILE soft limit
reset to 1K for compat with crappy old select().

Replaces: #29298
Fixes: #28583
2023-09-26 13:01:02 +02:00
Lennart Poettering 7af33700e6 varlink: remove duplicate varlink_clear_current() 2023-09-26 12:59:24 +02:00
Mike Yuan fe3d33c140 core/service: log the next restart usec only when we're arming timer
service_restart_usec_next() is also called when querying
'RestartUSecNext' dbus property. Let's avoid the redundant
logging triggered every time user does a 'systemctl status'.
2023-09-26 12:59:15 +08:00
Luca Boccassi e1e0c4f025 Merge pull request #29314 from YHNdnzj/firstboot-fixup
Small fixups for first boot
2023-09-25 22:29:24 +01:00
Lennart Poettering 902dc432e2 Merge pull request #29309 from poettering/resolved-varlink-tweaks
resolved: minor varlink API tweaks
2023-09-25 23:27:33 +02:00
Lennart Poettering 0869e1326a oomd: correct listening sockets
So, unfortunately oomd uses "io.system." rather than "io.systemd." as
prefix for its sockets. This is a mistake, and doesn't match the
Varlink interface naming or anything else in oomd.

hence, let's fix that.

Given that this is an internal protocol between PID1 and oomd let's
simply change this without retaining compat.
2023-09-25 23:27:18 +02:00
Lennart Poettering a4edf0335d varlink: move O_NONBLOCK setting to varlink_server_listen_fd(), and set O_CLOEXEC too
Let's move setting of O_NONBLOCK into varlink_server_listen_fd() and out
of varlink_server_create_listen_fd_socket(). The latter has two callers:
varlink_server_listen_fd() and varlink_server_listen_address(), which
guarantees O_CLOEXEC+O_NONBLOCK anyway, hence no neet to repeat the
logic.
2023-09-25 23:27:04 +02:00
Lennart Poettering 3510df0ae4 repart: add extra safety check that the verity signature fits in the partition we want to write 2023-09-25 19:10:37 +02:00
Lennart Poettering 8e47958423 string-util: make strgrowpad0() a bit safer
Let#s make sure we never shorten the allocation leaving an invalid
string (i.e. a memory allocation without a trailing NUL) around.
2023-09-25 19:10:37 +02:00
Mike Yuan 60e4b4291b core/main: log that we assume first boot if failed to read machine-id 2023-09-26 01:00:23 +08:00
Lennart Poettering b907b9075e alloc-util: remove duplicate empty line 2023-09-25 18:49:21 +02:00
Lennart Poettering 510b3b06fc resolved: rename varlink function to match exposed method name 2023-09-25 18:45:52 +02:00
Lennart Poettering 0319a28e42 resolved: also expose interface index in server JSON data 2023-09-25 18:45:52 +02:00
Lennart Poettering b0d00ec60a pcrextend: make PCR index configurable
Let's make the tool a tiny bit more generic by allowing the PCR index to
measure into to be configurable.
2023-09-25 17:17:20 +02:00
Lennart Poettering 32295fa08f pcrphase: rename binary to pcrextend
The tool initially just measured the boot phase, but was subsequently
extended to measure file system and machine IDs, too. At AllSystemsGo
there were request to add more, and make the tool generically
accessible.

Hence, let's rename the binary (but not the pcrphase services), to make
clear the tool is not just measureing the boot phase, but a lot of other
things too.

The tool is located in /usr/lib/ and still relatively new, hence let's
just rename the binary and be done with it, while keeping the unit names
stable.

While we are at it, also move the tool out of src/boot/ and into its own
src/pcrextend/ dir, since it's not really doing boot related stuff
anymore.
2023-09-25 17:17:20 +02:00
Alexandre Peixoto Ferreira 13abd00685 sd-dhcp-client: reject NAKs from servers that we did not send an offer to (#29290)
To support multiple DHCP servers in a network.
2023-09-25 11:46:41 +09:00
Luca Boccassi f5f4486c65 Merge pull request #29254 from yuwata/sd-ndisc-use-usec_t
sd-ndisc: make sd_ndisc return time values in usec
2023-09-22 21:46:50 +01:00
Yu Watanabe f9edbb80e9 sd-dhcp-client: split out client_parse_message()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe db849df5a1 sd-dhcp-client: introduce dhcp_lease_unref_and_replace() 2023-09-23 01:38:21 +09:00
Yu Watanabe 8fc725052a sd-dhcp-client: do not set fallback subnet mask if it is already set 2023-09-23 01:38:21 +09:00
Yu Watanabe 2ff1e23036 sd-dhcp-client: split out client_enter_requesting()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe 525717b87c sd-dhcp-client: split out client_enter_bound()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe 6197db53ba sd-ndisc: make sd_ndisc return time values in usec
This also introduces sd_ndisc_router_get_lifetime_timestamp() and
friends that return timestamp rather than timespan.
2023-09-23 01:34:56 +09:00
Mike Yuan e504e46515 btrfs-util: fix one memory leak
Follow-up for efb6a76a2a
2023-09-23 00:13:06 +08:00
Daan De Meyer 021b0ff405 repart: Don't fail on boot if we can't find the root block device
When booting from virtiofs, we won't be able to find a root block
device. Let's gracefully handle this similar to how we don't fail
if we can't find a GPT partition table.
2023-09-22 16:01:12 +01:00
Mike Yuan 17ad085993 hibernate-resume: add missing #pragma once 2023-09-22 21:03:48 +08:00
Mike Yuan 3494a8b904 hibernate-resume: break lines in meson.build files() 2023-09-22 21:02:55 +08:00
Zbigniew Jędrzejewski-Szmek a0fe45a93f Merge pull request #29224 from keszybz/netdev-config-parsing
Use a helper to simplify parsing of ranges in netdev config and related changes
2023-09-22 14:29:47 +02:00
Zbigniew Jędrzejewski-Szmek f75921c7fd netdev/wireguard: define iterator variable in the loop 2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 117843fe95 network: make DEFINE_NETDEV_CAST() assert on input and output
The macro used to return NULL if input was NULL or had the wrong type. Now
it asserts that input is nonnull and it has the expected type.

There are a few places where a missing or mismatched type was OK, but in a
majority of places, we would do both of the asserts. In various places we'd
only do one, but that was by ommission/mistake. So moving the asserts into the
macro allows us to save some lines.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 6c9935ba87 network/netdev: align tables 2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 6fded8dced network/netdev: fix resetting of 'inherit' field
We have two fields: inherit and ttl, and ttl is ignored if inherit is true.
Setting TTL=inherit and later TTL=n would not work because we didn't unset
inherit.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek af14281d2c network: refusing parsing negative flow labels
The docs for FlowLabel= said that the range is 0..1048575, but the code did not
reject negative numbers.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek a893c121ed network/fou-tunnel: simplify parsing of protocol number
Previously, we would call parse_ip_protocol(), which internally calls
safe_atoi(), and then call safe_atou(). This isn't terrible, but it's also
slightly confusing. Use parse_ip_protocol_full() to avoid the second call.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 1b2733b412 shared/ip-procotol-list: generalize and rework parse_ip_protocol()
Optionally, accept protocols that don't have a known name.
Avoid any allocations in the common case.
Return more granular error codes: -ERANGE for negative values,
-EOPNOTSUPP if the protocol is a valid number, but we don't know
the protocol, and -EINVAL only if it's not a numerical string.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 04c2a002e6 network/vxlan: avoid unneccesary temporary variables
parse_ip_port_range() DTRT and only sets the output on success.
2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 257cebb67a network/netdev: use ASSERT_PTR() more, adjust indentation 2023-09-22 08:17:42 +02:00
Zbigniew Jędrzejewski-Szmek 851cdffd1b network: use a common helper to parse bounded ranges
This compresses repetetive code and makes it easier to add new options
in networkd. The formatting of error messages becomes uniform. The
error message always specifies the rvalue literally, instead of using
a "descriptive name". This makes the message much easier to handle for
the user.

I opted to add just one parser, and wrap it with inline functions to proxy
the type. This is less verbose than copying functions for each type
separately, and the compiler should be able to get rid of the inline wrapper
almost entirely.

asserts are reordered to use the same order as the parameter list.
This makes the code easier to read.

No functional change intended, apart from the difference in error message
formatting.
2023-09-22 08:16:47 +02:00
Adam Williamson 537c00c984 find_legacy_keymap: extend variant match bonus again
If the column is "-" and the X context variant specifer only
contains commas, we should also give the match bonus. The variant
string is supposed to be a comma-separated list as long as the
list of layouts, so it's quite natural for consumers to be written
in such a way that they pass a string only containing commas if
there are multiple layouts and no variants. anaconda is a real
world case that does this.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2023-09-22 08:07:12 +02:00
Yu Watanabe c650d4cdef sd-journal: refuse entry objects with an empty boot ID
Otherwise, e.g. sd_journal_get_monotonic_usec() return an empty boot ID
when called for such a broken entry object.

Such a broken object may be stored when the system was not cleanly shutdown.

Fixes #29167.
2023-09-22 08:05:53 +02:00
Yu Watanabe 3231f624e6 sd-ndisc: rename function arguments for storing results 2023-09-22 02:17:31 +09:00
Zbigniew Jędrzejewski-Szmek 67bc612cbc systemctl: link to all non-man-page files in help
For file:// links, we urlify the link so that the user can click and either
open the file in a editor or some viewer. The detection is chosen via some
mechanism implemented by the terminal emulator. This seems too DTRT for text
files and PDFs, which should cover the majority of realistic cases. If the file
is not viable, the terminal emulator will say
  "Could not open file://…. No application is registered to view this file type."
or similar.

For all other links, which are primarily http:// and https://, we just show the
link, letting the terminal handle the hyperlinking. The user can then ctrl-click
and open the file it their browser. If we tried to open the files automatically,
we'd would need to open many pages, and we'd need to figure out what browser to
use, etc. When the user picks whether to open the file, this leads to a nicer
user experience.

Man pages are separated by an empty line from preceding in and following output.
In my testing, this makes the output easier to read. A bit of explicit flushing
is needed to make sure that various outputs are not interleaved.

Fixes https://github.com/systemd/systemd/issues/29061.
2023-09-21 18:09:48 +02:00
Zbigniew Jędrzejewski-Szmek 44fcb9a7e7 meson: do not explicitly specify ownership of /var/log/journal/
In 9289e093ae we started using install_emptydir().

When running unprivileged, 'DESTDIR=… meson install -C build --quiet --no-rebuild'
would emit two warnings:
  '…/var/log/journal': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring...
  '…/var/log/journal/remote': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring...

Those were the only two install_emptydir()s that specified ownership.
Let's drop the user/group specification to get rid of the warning.

When installing as root, we will create a root-owned directory anyway.
When not running as root, we cannot create a root-owned directory.
So this specification only makes a difference if we are running as root,
and the directory already existed, and was not owned by root. In that case,
I think it's actually better to leave the existing modification in place.
(E.g. maybe the admin chgrp'ed the ownership for whatever reason. We might
just as well leave that in place.)
2023-09-21 14:06:44 +01:00