Yu Watanabe [Fri, 4 Feb 2022 06:22:20 +0000 (15:22 +0900)]
stat-util: introduce path_is_network_fs()
Yu Watanabe [Thu, 3 Feb 2022 03:14:19 +0000 (12:14 +0900)]
network-generator: rename DHCP_TYPE_DHCP -> DHCP_TYPE_DHCP4
To emphasize this is DHCPv4. No behavior is changed.
Davide Cavalca [Thu, 3 Feb 2022 16:35:35 +0000 (08:35 -0800)]
hwdb: add HP calculators
Lennart Poettering [Thu, 3 Feb 2022 16:19:32 +0000 (17:19 +0100)]
hostnamed: trivial optimization
Luca Boccassi [Thu, 3 Feb 2022 17:43:45 +0000 (17:43 +0000)]
portable: reopen socket with O_RDONLY
Follow-up for
e3f7ed944ae750a40685c52349f3cc850db0876e
Luca Boccassi [Thu, 3 Feb 2022 22:50:38 +0000 (22:50 +0000)]
Merge pull request #22408 from mrc0mmand/test-network-cleanup
test-network: code cleanup
Anita Zhang [Thu, 3 Feb 2022 22:20:43 +0000 (14:20 -0800)]
Merge pull request #22355 from yuwata/network-tunnel-external
network: tunnel: support external mode
Jan Janssen [Thu, 3 Feb 2022 18:40:42 +0000 (19:40 +0100)]
boot: Fix some error messages
Anita Zhang [Thu, 3 Feb 2022 19:54:00 +0000 (11:54 -0800)]
Merge pull request #22400 from poettering/resolved-single-invalid-list
resolved: maintain only a single list of "dont-resolve" domain names
Lennart Poettering [Thu, 3 Feb 2022 16:41:04 +0000 (17:41 +0100)]
hostnamed: drop "iteractive" parameter from GetHardwareSerial()
Since a long time the D-Bus spec knows a special bit in its message
header for indicating that "interactive" authentication is OK. The
original hostnamed API is before that was added hence most functions
expose that boolean as explicit argument.
For new added functions let's get rid of it, the message flag is good
enough and replaces it with complete functionality.
No new APIs should carry the "interactive" boolean flag explicitly as
argument anymore.
Follow-up for:
9697662915e47a4797b05003cb1970fe2b01e530
Anita Zhang [Thu, 3 Feb 2022 19:50:06 +0000 (11:50 -0800)]
Merge pull request #22394 from bluca/requires_restart_doc
man: explicitly mention that Requires propagates restarts
Lennart Poettering [Thu, 3 Feb 2022 12:42:55 +0000 (13:42 +0100)]
systemctl: use STR_IN_SET() where appropriate
Follow-up for:
8e98568165ee3db049160045d94ce030dc7fbb79
Frantisek Sumsal [Thu, 3 Feb 2022 18:31:15 +0000 (19:31 +0100)]
test-network: disable irrelevant or one-time pylint checks
Frantisek Sumsal [Thu, 3 Feb 2022 18:30:11 +0000 (19:30 +0100)]
test-network: use specific exceptions instead of the Exception class
Frantisek Sumsal [Thu, 3 Feb 2022 18:20:42 +0000 (19:20 +0100)]
test-network: avoid name clashing/redefinition
Frantisek Sumsal [Thu, 3 Feb 2022 18:13:06 +0000 (19:13 +0100)]
test-network: disable 'no-member' warning for the Utilities class
The warning is correct, since we don't inherit the necessary
unittest.TestCase class, but that's on purpose, since the Utilities
class is not supposed to be instantiated on its own, but should
complement other classes' definitions which do inherit from the
unittest.TestCase class.
Frantisek Sumsal [Thu, 3 Feb 2022 17:55:12 +0000 (18:55 +0100)]
test-network: use raw strings for regexes with backslashes
It currently works because `\(` and `\)` are not valid escape sequences,
so they're not treated differently. Using raw strings (or double
backslashes) is a more correct solution.
Frantisek Sumsal [Thu, 3 Feb 2022 17:49:35 +0000 (18:49 +0100)]
test-network: explicitly set check=False for subprocess.run()
since we're checking the returned error code explicitly via the
`returncode` member.
Frantisek Sumsal [Thu, 3 Feb 2022 17:42:41 +0000 (18:42 +0100)]
test-network: convert certain multiline strings to comments
Multiline comments are converted to docstrings only when they're the
first statement in a function/method. Even though they're still a no-op
otherwise, let's use "true" comments to make pylint happy.
Frantisek Sumsal [Thu, 3 Feb 2022 17:17:53 +0000 (18:17 +0100)]
test-network: drop unused variables
Frantisek Sumsal [Thu, 3 Feb 2022 17:14:44 +0000 (18:14 +0100)]
test-network: drop unnecessary else statements
Frantisek Sumsal [Thu, 3 Feb 2022 17:11:26 +0000 (18:11 +0100)]
test-network: drop unnecessary semicolons
Frantisek Sumsal [Thu, 3 Feb 2022 17:10:06 +0000 (18:10 +0100)]
test-network: drop superfluous parens
Lennart Poettering [Thu, 3 Feb 2022 16:16:11 +0000 (17:16 +0100)]
resolved: maintain only a single list of "dont-resolve" domain names
Follow-up for:
46b53e8035fb60c9a7f26dd32d6689ab3b7da97c
Luca Boccassi [Thu, 3 Feb 2022 14:48:27 +0000 (14:48 +0000)]
man: explicitly mention that Requires propagates restarts
It's implicit, but the actions are different, so let's be explicit to
avoid any confusion.
Leviticoh [Thu, 3 Feb 2022 13:23:15 +0000 (14:23 +0100)]
fix italian translations to display unit name
Lennart Poettering [Thu, 3 Feb 2022 10:41:49 +0000 (11:41 +0100)]
boot: fix pretty nasty typo
Note to self: should I ever become a black hat hacker, this is how I'd
hide a vulnerability. ;-)
(No, this one is not a vulnerability)
Follow-up for:
163d1ea5dd69c75d889ba4c2d1b51432ed14127f
Lennart Poettering [Wed, 2 Feb 2022 14:21:27 +0000 (15:21 +0100)]
journal: when copying journal file to undo NOCOW flag, go via fd
We have the journal file open already, hence reference it via the fd
insted of the file name. After all, some other tool might have
renamed/deleted it already.
Let's not actually reuse the fd though, since we want a separate file
offset for the copying, hence just make it simply and reopen via
/proc/self/fd/.
Follow-up for
d71ece3f0b85c7a3decc50143b68ac07fc5831ae
Evgeny Vereshchagin [Thu, 3 Feb 2022 02:22:53 +0000 (02:22 +0000)]
tests: pass FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION to fuzzers
to let them use reproducible identifiers, which should make it possible
to really use files copied from OSS-Fuzz to reproduce issues on
GHActions and locally. Prompted by https://github.com/systemd/systemd/pull/22365
Lennart Poettering [Wed, 2 Feb 2022 16:28:35 +0000 (17:28 +0100)]
sd-boot: rename LOADER_STUB → LOADER_UNIFIED_LINUX
No actual code changes, just renaming.
Rationale: the focus here should be on the fact that these are "unified"
images, whether our stub is used or not, or something else doesn't
really matter. Moreover, these are still Linux entries. Hence, emphasize
that these are *unified* images, and *Linux* images, and deemphesize
that our sd-stub is likely used.
Evgeny Vereshchagin [Tue, 1 Feb 2022 13:11:41 +0000 (13:11 +0000)]
tests: fuzz client_send_message
to make sure outgoing packets based on incoming packets are fine.
It's just another follow-up to
https://github.com/systemd/systemd/pull/10200.
Better late than never :-)
Yu Watanabe [Thu, 3 Feb 2022 02:11:37 +0000 (11:11 +0900)]
test-network: add testcase for external tunnel
Yu Watanabe [Tue, 1 Feb 2022 23:56:14 +0000 (08:56 +0900)]
network: tunnel: support external mode
Closes #22352.
Yu Watanabe [Tue, 1 Feb 2022 23:54:52 +0000 (08:54 +0900)]
network: tunnel: reorder setting ip6tnl attributes
Just for improving readability.
Yu Watanabe [Tue, 1 Feb 2022 23:25:38 +0000 (08:25 +0900)]
network: tunnel: reduce indentation in config_parse_encap_limit()
Yu Watanabe [Tue, 1 Feb 2022 23:25:10 +0000 (08:25 +0900)]
network: tunnel: reduce indentation in config_parse_ipv6_flowlabel()
Yu Watanabe [Tue, 1 Feb 2022 23:23:59 +0000 (08:23 +0900)]
network: tunnel: use "data" field to assign result
Lennart Poettering [Wed, 2 Feb 2022 14:20:30 +0000 (15:20 +0100)]
udevadm: don't claim a sysattr was write only just because we get EPERM on read
it might be totally inaccessible, hence weaken our language a bit and
just say "not readable", thus making not claim whether it is writable or
not.
Follow-up for
3a90bef55a5a71a03629a762470b0f9014cd8453
Anita Zhang [Wed, 2 Feb 2022 21:53:18 +0000 (13:53 -0800)]
Merge pull request #22373 from DaanDeMeyer/journald-file-rename
journal: Rename JournaldFile to ManagedJournalFile
Luca Boccassi [Wed, 2 Feb 2022 15:32:20 +0000 (15:32 +0000)]
Merge pull request #22358 from yuwata/udevadm-test-support-dev-path-or-device-unit
udevadm: test,test-builtin: support /dev path or device unit
Yu Watanabe [Wed, 2 Feb 2022 06:32:23 +0000 (15:32 +0900)]
test: use rm_rf_physical_and_freep cleanup function
Daan De Meyer [Wed, 2 Feb 2022 14:30:50 +0000 (14:30 +0000)]
journal: Rename JournaldFile to ManagedJournalFile
JournalFile and JournaldFile are hard to distinguish from each other.
Let's use ManagedJournalFile instead to make the distinction more clear.
Yu Watanabe [Wed, 2 Feb 2022 07:39:38 +0000 (16:39 +0900)]
network: update operational state when we remove an address
Evgeny Vereshchagin [Wed, 2 Feb 2022 08:30:19 +0000 (08:30 +0000)]
dhcp-identifier: always use a fixed machine-id while fuzzing
It's a follow-up to https://github.com/systemd/systemd/pull/10200 where
that fuzzer was introduced. At the time it was run regularly on machines
where machine-id wasn't present so it was kind of reproducible. Now
it's run on CIFuzz and CFLite using GHActions with the public OSS-Fuzz
corpora (based on that particular machine-id) so to fully utilize
those corpora it's necessary to use it always. Other than that
it makes it possible for fuzzers targeting outgoing packets
based on incoming packets like https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/
1795921
to get past client_parse_message on my machine :-)
Yu Watanabe [Wed, 2 Feb 2022 03:46:29 +0000 (12:46 +0900)]
sd-device: drop device_new_from_synthetic_event() from libsystemd
It is used by only test-udev.c.
Yu Watanabe [Wed, 2 Feb 2022 03:53:29 +0000 (12:53 +0900)]
udevadm: trigger: drop unnecessary slash
Yu Watanabe [Wed, 2 Feb 2022 03:40:23 +0000 (12:40 +0900)]
udevadm: make test and test-builtin command accept /dev path or device unit
Yu Watanabe [Wed, 2 Feb 2022 03:31:02 +0000 (12:31 +0900)]
sd-device: make device_set_action() take sd_device_action_t
Yu Watanabe [Wed, 2 Feb 2022 03:29:54 +0000 (12:29 +0900)]
sd-device: move device_read_uevent_file() to device-private.h
Then, it can be used by our tools or daemons.
Yu Watanabe [Wed, 2 Feb 2022 03:11:26 +0000 (12:11 +0900)]
udev: do not generate format dynamically
Prompted by LGTM.
Yu Watanabe [Wed, 2 Feb 2022 02:06:41 +0000 (11:06 +0900)]
test: allow to set NULL to intro or outro
Addresses https://github.com/systemd/systemd/pull/22338#discussion_r796741033.
Luca Boccassi [Wed, 2 Feb 2022 11:03:04 +0000 (11:03 +0000)]
Merge pull request #22359 from yuwata/mkdir-fix
mkdir: allow to create directory whose path contains symlink
Yu Watanabe [Wed, 2 Feb 2022 06:08:18 +0000 (15:08 +0900)]
test: add a test for mkdir_p()
Yu Watanabe [Wed, 2 Feb 2022 05:20:48 +0000 (14:20 +0900)]
mkdir: allow to create directory whose path contains symlink
Fixes a regression caused by
3008a6f21c1c42efe852d69798a2fdd63fe657ec.
Before the commit, when `mkdir_parents_internal()` is called from `mkdir_p()`,
it uses `_mkdir()` as `flag` is zero. But after the commit, `mkdir_safe_internal()`
is always used. Hence, if the path contains a symlink, it fails with -ENOTDIR.
To fix the issue, this makes `mkdir_p()` calls `mkdir_parents_internal()` with
MKDIR_FOLLOW_SYMLINK flag.
Fixes #22334.
Yu Watanabe [Wed, 2 Feb 2022 06:06:27 +0000 (15:06 +0900)]
mkdir: CHASE_NONEXISTENT cannot used in chase_symlinks_and_stat()
Yu Watanabe [Wed, 2 Feb 2022 05:05:45 +0000 (14:05 +0900)]
core/mount: fail early if directory cannot be created
Prompted by #22334.
Yu Watanabe [Wed, 2 Feb 2022 04:47:32 +0000 (13:47 +0900)]
Merge pull request #22350 from poettering/journal-read-object-fix
journal: various fixes to journal_file_read_object()
Lennart Poettering [Tue, 1 Feb 2022 16:38:23 +0000 (17:38 +0100)]
systemctl: strings returned by sd_bus_message_read_basic() are immutable
It's totally not OK to write to the strings returned by it, the data is
shared by all code that references the message.
While we are at it, simplify the code via
json_variant_set_field_string().
Follow-up for:
5ef599b324efbcb7af317c102b59c662df068500
Lennart Poettering [Tue, 1 Feb 2022 17:45:35 +0000 (18:45 +0100)]
journal-file: don't use pread() when determining where to append, use mmap as before
This partially undoes the effect of
ab6e257b3e4e5b95f3750ed019bed6e89989e41b.
Originally, we always used the mmap logic to determine the current end
of the file.
ab6e257b3e4e5b95f3750ed019bed6e89989e41b changed this so
that we always used pread().
With this change we'll use pread() from the synchronization thread and
mmap otherwise.
Lennart Poettering [Tue, 1 Feb 2022 11:06:59 +0000 (12:06 +0100)]
tests: rework test macros to not take code as parameters
C macros are nasty. We use them, but we try to be conservative with
them. In particular passing literal, complex code blocks as argument is
icky, because of "," handling of C, and also because it's quite a
challange for most code highlighters and similar. Hence, let's avoid
that. Using macros for genreating functions is OK but if so, the
parameters should be simple words, not full code blocks.
hence, rework DEFINE_CUSTOM_TEST_MAIN() to take a function name instead
of code block as argument.
As side-effect this also fixes a bunch of cases where we might end up
returning a negative value from main().
Some uses of DEFINE_CUSTOM_TEST_MAIN() inserted local variables into the
main() functions, these are replaced by static variables, and their
destructors by the static destructor logic.
This doesn't fix any bugs or so, it's just supposed to make the code
easier to work with and improve it easthetically.
Or in other words: let's use macros where it really makes sense, but
let's not go overboard with it.
(And yes, FOREACH_DIRENT() is another one of those macros that take
code, and I dislike that too and regret I ever added that.)
Yu Watanabe [Tue, 1 Feb 2022 22:20:25 +0000 (07:20 +0900)]
network: dhcp-server: make empty string to DNS= or friends clear previously specified servers
Yu Watanabe [Tue, 1 Feb 2022 21:35:43 +0000 (06:35 +0900)]
sd-dhcp-lease: store static routes and classless static routes in different arrays
When classless static routes option is provided, then static routes
option should not be used. Hence, let's not mix and store them in one
storage.
This introduce sd_dhcp_lease_get_static_routes() and
sd_dhcp_lease_get_classless_routes().
Yu Watanabe [Wed, 2 Feb 2022 01:02:26 +0000 (10:02 +0900)]
Merge pull request #22351 from mrc0mmand/TEST-56-cgroupsv1
test: require unified cgroup hierarchy for TEST-56
Lennart Poettering [Tue, 1 Feb 2022 16:38:12 +0000 (17:38 +0100)]
resolve: add missing OOM check
Luca Boccassi [Tue, 1 Feb 2022 15:31:52 +0000 (15:31 +0000)]
core: warn on ExitType=cgroup with legacy cgroup setup
'cgroup empty' notifications are not reliable on v1, so log a warning.
See: https://github.com/systemd/systemd/issues/22320
Yu Watanabe [Tue, 1 Feb 2022 22:07:22 +0000 (07:07 +0900)]
Merge pull request #22332 from yuwata/network-dhcp-server-dns-server-address
network: dhcp-server: allow to specify server address for DNS= or friends
Yu Watanabe [Tue, 1 Feb 2022 22:06:56 +0000 (07:06 +0900)]
Merge pull request #22327 from joanbm/main_resolved_improvements
resolved: misc. small DnsStream refactors and improvements
Frantisek Sumsal [Tue, 1 Feb 2022 19:25:00 +0000 (20:25 +0100)]
test: require unified cgroup hierarchy for TEST-56
since cgroup empty notifications are unreliable in legacy cgroups.
See: systemd/systemd#22320
Complements: systemd/systemd#22344
Frantisek Sumsal [Tue, 1 Feb 2022 19:18:29 +0000 (20:18 +0100)]
test: introduce `get_cgroup_hierarchy() helper
which returns the host's cgroup hierarchy (unified, hybrid, or legacy).
Lennart Poettering [Tue, 1 Feb 2022 17:11:04 +0000 (18:11 +0100)]
units: we need systemd-journald.service from systemd-journal-flush.service
This is a follow-up for
d5ee050ffc9d413253932d9340ade8c8fb111092, and
reintroduces a requirement dep from systemd-journal-flush.service onto
systemd-journald.service, but a weaker one than originally: a Wants= one
instead of a Requires= one.
Why? Simply because the service issues an IPC call to the journald,
hence it should pull it in. (Note that socket activation doesn't happen
for the Varlink socket it uses, hence we should pull in the service
itself.)
Yu Watanabe [Tue, 1 Feb 2022 07:30:45 +0000 (16:30 +0900)]
test-network: add tests for DNS=_server_address in [DHCPServer]
Yu Watanabe [Tue, 1 Feb 2022 07:20:33 +0000 (16:20 +0900)]
network: dhcp-server: introduce special value DNS=_server_address
Closes #15026.
Yu Watanabe [Tue, 1 Feb 2022 19:55:07 +0000 (04:55 +0900)]
Merge pull request #22310 from yuwata/sd-dhcp-lease-fixes
sd-dhcp-lease: two fixes
Luca Boccassi [Tue, 1 Feb 2022 19:26:57 +0000 (19:26 +0000)]
Merge pull request #22343 from poettering/assert-se-efi
efi: add/user assert_se()/ASSERT_SE_PTR() for OOM handling
Lennart Poettering [Tue, 1 Feb 2022 16:37:19 +0000 (17:37 +0100)]
analyze: correctly mention that --json= is also understood by inspect-elf
Joan Bruguera [Sun, 30 Jan 2022 16:56:32 +0000 (17:56 +0100)]
resolved: Allow test-resolved-stream to run concurrently
Since test-resolved-stream brings up a simple DNS server on 127.0.0.1:12345,
only one instance could run at a time, so it would fail when run like
`meson test -C build test-resolved-stream --repeat=1000`.
Similarly, if by chance something is up on port 12345, the test would fail.
To make the test more reliable, run it in an isolated user + network namespace.
If this fails (some distributions disable user namespaces), just run as before.
Joan Bruguera [Sun, 30 Jan 2022 11:51:10 +0000 (12:51 +0100)]
resolved: Read as much as possible per stream EPOLLIN event
In commit
2aaf6bb6e99b0f2bd73e0c49bef9e11a2844bf1a, an issue was fixed where
systemd-resolved could get stuck for multiple seconds waiting for incoming data,
since GnuTLS/OpenSSL can buffer a TLS record, so data could be available, but
no EPOLLIN event would be generated.
To fix this, a somewhat elaborate logic consisting on asking the TLS library
whether it had buffered data, then "faking" an EPOLLIN event was implemented.
However, there is a much simpler solution: Always read as much data as available
(i.e. until we get an event like EAGAIN when trying to read) from the stream
when we get an EPOLLIN event, instead of at most a single packet per event.
This approach does not require asking the TLS library whether it has buffered
data, and the logic is exactly the same for both the TCP and TLS case.
test-resolved-stream is fixed to avoid a latent double free bug.
Joan Bruguera [Mon, 31 Jan 2022 20:28:32 +0000 (21:28 +0100)]
resolved: Avoid multiple SSL writes per DoT packet
In the DoT case, dns_stream_writev decomposed an iovec into multiple
dnstls_stream_write calls, which resulted in multiple SSL writes and multiple
TLS records. This can be checked from a network capture, e.g. using socat:
socat -v -x openssl-listen:853,reuseaddr,fork,cert=my.cert,key=my.key,verify=0 openssl:8.8.8.8:853
Instead, propagate the iovec as-is into the DoT handling code. For GnuTLS, the
library provides support for buffering ('corking') a record. OpenSSL has no
such facility, so we join the iovec into a single buffer then call SSL_write.
socat capture of `resolvectl -4 query --cache=no example.com` before the commit:
> 2022/01/30 13:35:52.194200 length=2 from=0 to=1
00 28 .(
--
> 2022/01/30 13:35:52.194253 length=40 from=2 to=41
1e b2 01 00 00 01 00 00 00 00 00 01 07 65 78 61 .............exa
6d 70 6c 65 03 63 6f 6d 00 00 01 00 01 00 00 29 mple.com.......)
ff e4 00 00 00 00 00 00 ........
--
< 2022/01/30 13:35:52.232798 length=58 from=0 to=57
00 38 1e b2 81 80 00 01 00 01 00 00 00 01 07 65 .8.............e
78 61 6d 70 6c 65 03 63 6f 6d 00 00 01 00 01 c0 xample.com......
0c 00 01 00 01 00 00 53 6f 00 04 5d b8 d8 22 00 .......So..]..".
00 29 02 00 00 00 00 00 00 00 .)........
socat capture of `resolvectl -4 query --cache=no example.com` after the commit:
> 2022/01/30 13:34:47.598099 length=42 from=504 to=545
00 28 37 86 01 00 00 01 00 00 00 00 00 01 07 65 .(7............e
78 61 6d 70 6c 65 03 63 6f 6d 00 00 01 00 01 00 xample.com......
00 29 ff e4 00 00 00 00 00 00 .)........
--
< 2022/01/30 13:34:47.613203 length=58 from=756 to=813
00 38 37 86 81 80 00 01 00 01 00 00 00 01 07 65 .87............e
78 61 6d 70 6c 65 03 63 6f 6d 00 00 01 00 01 c0 xample.com......
0c 00 01 00 01 00 00 52 5e 00 04 5d b8 d8 22 00 .......R^..]..".
00 29 02 00 00 00 00 00 00 00 .)........
Joan Bruguera [Mon, 31 Jan 2022 20:28:21 +0000 (21:28 +0100)]
resolved: Make event flags logic robust for DoT
Since when handling a DNS over TLS stream, the TLS library can override the
requested events through dnstls_events for handshake/shutdown purposes,
obtaining the event flags through sd_event_source_get_io_events and checking
for EPOLLIN or EPOLLOUT does not really tell us whether we want to read/write
a packet. Instead, it could just be OpenSSL/GnuTLS doing something else.
To make the logic more robust (and simpler), save the flags that tell us
whether we want to read/write a packet, and check them instead of the IO flags.
(& use uint32_t for the flags like in sd_event_source_set_io_events prototype)
Lennart Poettering [Tue, 1 Feb 2022 17:31:12 +0000 (18:31 +0100)]
journal: various fixes to journal_file_read_object()
This fixes a bunch of issues:
pread() returns ssize_t, and returns errors in 'errno', handle that
correctly.
More importantly: it might incompletely read data in case we hit
EOF. Check for that, and handle it.
Finally, rename the function to journal_file_read_object_header(), since
it really doesn't read full objects, but only their headers.
Follow-up for:
117e21121e857b4b7d81949542e8dd257265970a
Lennart Poettering [Tue, 1 Feb 2022 16:37:08 +0000 (17:37 +0100)]
NEWS: minor formatting tweaks
Luca Boccassi [Tue, 1 Feb 2022 16:34:00 +0000 (16:34 +0000)]
Merge pull request #22341 from poettering/pam-end-fix
pid1: pam_end() PAM_DATA_SILENT fix
Lennart Poettering [Tue, 1 Feb 2022 11:06:21 +0000 (12:06 +0100)]
util: another set of CVE-2021-4034 assert()s
It's a good idea that we validate argc/argv when we are supposed to
store them away.
Lennart Poettering [Tue, 1 Feb 2022 14:28:33 +0000 (15:28 +0100)]
efi: use assert_se() instead of assert() to guard for OOM issues in EFI code
Lennart Poettering [Tue, 1 Feb 2022 13:43:04 +0000 (14:43 +0100)]
macro: add ASSERT_SE_PTR() macro
ASSERT_SE_PTR() is like ASSERT_PTR() but uses assert_se() instead of
assert() internally.
Code should use ASSERT_SE_PTR() where the check should never be
optimized away, even if NDEBUG is set.
Rationale: assert() is the right choice for validating assumptions about
our own code, i.e. checking conditions that are "impossible" to not
hold, because we ourselves hacked things up the "right" way of course.
assert_se() is the right choice for tests that come with a weaker
guarantee, they encode assumptions over other's API behaviour, i.e.
whether something can fail there or not.
When developing tools that are not oom-safe assert_se() is the right
choice: we know that on Linux OOM doesn't really happen, even though
theoretically the API allows it to happen.
Usecase for ASSERT_SE_PTR() is mostly the fatal memory allocation logic
for EFI memory allocations. So far it used regular assert() i.e. OOM
failurs would be totally ignored if NDEBUG is set. We'd rather have our
EFI program to print an assert message and freeze instead though.
Lennart Poettering [Tue, 1 Feb 2022 14:28:19 +0000 (15:28 +0100)]
fundamental: support assert_se() in EFI mode too
Luca Boccassi [Tue, 1 Feb 2022 13:25:38 +0000 (13:25 +0000)]
Merge pull request #22331 from yuwata/network-xfrm-interface-id
network: xfrm: refuse zero interface ID
Lennart Poettering [Tue, 1 Feb 2022 12:50:28 +0000 (13:50 +0100)]
execute: document that the 'env' param is input *and* output
Lennart Poettering [Tue, 1 Feb 2022 12:50:13 +0000 (13:50 +0100)]
execute: line break comments a bit less aggressively
Lennart Poettering [Tue, 1 Feb 2022 12:49:56 +0000 (13:49 +0100)]
execute: use _cleanup_ logic where appropriate
Lennart Poettering [Tue, 1 Feb 2022 11:37:51 +0000 (12:37 +0100)]
pid1: pass PAM_DATA_SILENT to pam_end() in child
Fixes: #22318
Yu Watanabe [Tue, 1 Feb 2022 07:39:43 +0000 (16:39 +0900)]
network: dhcp-server: also refuse link local address to use as the server address
Yu Watanabe [Tue, 1 Feb 2022 07:14:59 +0000 (16:14 +0900)]
network: use GREEDY_REALLOC() at one more place
Yu Watanabe [Tue, 1 Feb 2022 07:09:17 +0000 (16:09 +0900)]
sd-dhcp-server: convert null address for e.g. DNS to server address
Yu Watanabe [Tue, 1 Feb 2022 06:49:52 +0000 (15:49 +0900)]
sd-dhcp-server: use free_and_replace() at one more place
Yu Watanabe [Tue, 1 Feb 2022 06:38:39 +0000 (15:38 +0900)]
network: drop outdated TODO comment
Follow-up for
59aa622013277cfe6349d0789a7a00ad2b884902.
Yu Watanabe [Tue, 1 Feb 2022 05:10:11 +0000 (14:10 +0900)]
Merge pull request #22254 from yuwata/dhcp-server-fix-segfault
sd-dhcp-server: remove lease with hashmap_remove_value()
Yu Watanabe [Tue, 1 Feb 2022 05:09:32 +0000 (14:09 +0900)]
Merge pull request #22319 from yuwata/network-use-reconfigure
network: also use link_reconfigure_impl() to initially assign .network file
Yu Watanabe [Tue, 1 Feb 2022 04:26:40 +0000 (13:26 +0900)]
test-network: set xfrm interface ID
This also unifies two tests for xfrm, and checks the output of
'ip link' command.
Fixes #22329.
Yu Watanabe [Tue, 1 Feb 2022 04:00:51 +0000 (13:00 +0900)]
network: xfrm: refuse zero interface ID
Since kernel 5.17-rc1, 5.16.3, and 5.15.17 (more specifically,
https://github.com/torvalds/linux/commit/
8dce43919566f06e865f7e8949f5c10d8c2493f5)
the kernel refuses to create an xfrm interface with zero ID.