Commit graph

5072 commits

Author SHA1 Message Date
Lennart Poettering ecc4287dee vmspawn: by default, let machined register a cgroup for VMs
This mimics what we do in nspawn: if registration is enabled we'll let
machined allocate a scope unit for us. When --keep-unit is used we'll
register without creating a new scope.

This brings behaviour more inline with what nspawn does, exposing the
same sets of options.
2024-06-21 17:49:26 +02:00
Lennart Poettering d42edbf1b8
Merge pull request #33430 from YHNdnzj/buserror-notify
core/service: store BUSERROR= & VARLINKERROR= received and show them through systemctl status
2024-06-20 23:05:32 +02:00
Mike Yuan 4b89c55c3f
TEST-80-NOTIFYACCESS: introduce test for ERRNO= + BUS/VARLINKERROR= 2024-06-20 20:51:12 +02:00
Lennart Poettering ea441dbd9d ci: test new --graceful= switch of varlinkctl 2024-06-20 18:20:09 +02:00
Lennart Poettering 9e10f3a7e8 bootctl: normalize how we report no boot entries found
This normalizes how we report an empty list of boot entries in
ListBootEntries(). Our usual pattern is to return one item per method
call, but when there is none we usually return a NoSuchXYZ error. Do so
here too.

Before this we'd return a null item instead here, and only here.

This is a minor compat break, but given that this IPC interface is very
new and probably not used so far (we don't use it in our code at least,
and google doesn#t find any other use) I think this normalization is OK
at this point.
2024-06-20 10:02:40 +02:00
Yu Watanabe 8f33bfeca1 varlink-idl: allow unbalanced quote and trailing backslash in comment
Fixes #33381.
Fixes OSS-FUZZ#69730.
Follow-up for fbb69c0306.
2024-06-19 14:12:20 +02:00
Luca Boccassi 5163c9b1e5 install: allow removing symlinks even for units that are gone
If a symlink is leftover, still allow cleaning it up via 'disable'. This
happens when a unit is stopped and removed, but not disabled, and a reload
has already happened. At that point, cleaning up the old symlinks becomes
impossible through the APIs, and needs to be done manually. Always allow
cleaning up symlinks, if they exist, by only erroring out if there is an
OOM.

Follow-up for f31f10a620
2024-06-18 16:07:26 +02:00
Luca Boccassi 3f4f065bab
Merge pull request #33359 from bluca/test_apparmor_unpriv
mkosi: enable unprivileged user ns for integration tests
2024-06-18 00:13:15 +01:00
Luca Boccassi fcbe3e3b2e
Merge pull request #32724 from bluca/dynamic_user_no_private_tmp
core: do not imply PrivateTmp with DynamicUser, create a private tmpfs instead
2024-06-18 00:11:11 +01:00
Luca Boccassi 0e551b04ef core: do not imply PrivateTmp with DynamicUser, create a private tmpfs instead
DynamicUser= enables PrivateTmp= implicitly to avoid files owned by reusable uids
leaking into the host. Change it to instead create a fully private tmpfs instance
instead, which also ensures the same result, since it has less impactful semantics
with respect to PrivateTmp=yes, which links the mount namespace to the host's /tmp
instead. If a user specifies PrivateTmp manually, let the existing behaviour
unchanged to ensure backward compatibility is not broken.
2024-06-17 17:05:55 +01:00
Yu Watanabe 4f6d8ab076 test-network: mention that the captive portal option is supported since v2.20
The current latest release is v2.19, hence the test is typically skipped now.
2024-06-18 00:20:27 +09:00
Luca Boccassi 80468db8fa test: use 'auto' instead of 'uefi' for automated fallback
mkosi will prefer UEFI if the architecture supports it, but fallback
to 'linux' if it doesn't.
2024-06-17 15:52:50 +01:00
Luca Boccassi 464d182b3e test: support TEST_NO_QEMU in mkosi integration wrapper
Same as the old integration test suite, allow skipping tests that
require qemu.
ppc64el's vsock support doesn't appear to work, so we'll skip it,
as it is already done in the legacy framework.
2024-06-17 15:52:50 +01:00
Luca Boccassi 7d2701e7d1 test: support TEST_NO_KVM
The shell integration suite allows to manually deselect KVM, so
suppor the same env var for the same purpose in python.
2024-06-17 15:52:50 +01:00
Luca Boccassi 626518ecd5 test: drop obsolete comment
We want to keep various logic here instead of mkosi, so drop the
temporary comment
2024-06-17 15:52:50 +01:00
Luca Boccassi f44fc531c9 test: drop unneeded firmware: uefi setting
These tests no longer need this, as they are running in nspawn, drop it
2024-06-17 11:34:52 +01:00
Luca Boccassi e1daedb4be test: check the skip condition before installing additional files 2024-06-17 11:34:52 +01:00
Lennart Poettering aa413d5fc6 ci: add superficial --quiet testcase 2024-06-13 11:31:44 +02:00
Lennart Poettering e1ef88e56e test: add test for new varlinkctl features 2024-06-13 09:37:15 +02:00
Frantisek Sumsal 2ac0e52f29 test: dump a simple summary at the end of TEST-02-UNITTEST
Let's dump a list of skipped tests and logs from failed tests at the end
of TEST-02-UNITTEST to make debugging fails in CI slightly less painful.
2024-06-12 14:04:10 +01:00
Lennart Poettering 8c5045f9b2 analyze: add verb for dumping SMBIOS Type #11 data
I find myself wanting to check this data with a quick command, and
browsing through /sys/ manually getting binary data sucks. Hence let's
do add a nice little analysis tool.
2024-06-12 12:48:28 +02:00
Matthieu Baerts (NGI0) 3f69070598 core/socket: allow MPTCP protocol
Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths. It allows a device
to make use of multiple interfaces at once to send and receive TCP
packets over a single MPTCP connection. MPTCP can aggregate the
bandwidth of multiple interfaces or prefer the one with the lowest
latency, it also allows a fail-over if one path is down, and the traffic
is seamlessly re-injected on other paths.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [2]. To
use it on Linux, an application must explicitly enable it when creating
the socket:

  int sd = socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP);

No need to change anything else in the application.

This patch allows MPTCP protocol in the Socket unit configuration. So
now, a <unit>.socket can contain this to use MPTCP instead of TCP:

  [Socket]
  SocketProtocol=mptcp

MPTCP support has been allowed similarly to what has been already done
to allow SCTP: just one line in core/socket.c, a very simple addition
thanks to the flexible architecture already in place.

On top of that, IPPROTO_MPTCP has also been added in the list of allowed
protocols in two other places, and in the doc. It has also been added to
the missing_network.h file, for systems with an old libc -- note that it
was also required to include <netinet/in.h> in this file to avoid
redefinition errors.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.mptcp.dev [2]
2024-06-12 00:14:08 +01:00
Yu Watanabe 8843726ac2 test-network: wait a while for addresses to be dropped
Hopefully fixes the following failure:
```
======================================================================
FAIL: test_ipv6_token_prefixstable (__main__.NetworkdRATests.test_ipv6_token_prefixstable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py", line 5705, in test_ipv6_token_prefixstable
    self.assertNotIn('2002:da8:1:0:b47e:7975:fc7a:7d6e/64', output) # the 1st prefixstable
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '2002:da8:1:0:b47e:7975:fc7a:7d6e/64' unexpectedly found in
  '19: veth99@veth-peer: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000\n
       inet6 2002:da8:1:0:b47e:7975:fc7a:7d6e/64 scope global tentative dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 2002:da8:1:0:da5d:e50a:43fd:5d0f/64 scope global dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 fe80::1034:56ff:fe78:9abc/64 scope link proto kernel_ll \n
          valid_lft forever preferred_lft forever'
----------------------------------------------------------------------
```
2024-06-11 13:52:41 +01:00
Yu Watanabe 01420b2db5 network/ndisc: use router lifetime as one for redirect route
Previously, we did not set lifetime for redirect route, and redirect
routes were removed only when received a RA from the target address.
Thus, routes that redirect on-link addresses were never removed.

RFCs mention nothing about the lifetime of redirection. But the previous
implementation does not pass the IPv6 Core Conformance Tests.

This makes
- remember all received RAs and manage them by the sender address
  (previously, remembered only one with the highest preference),
- then use the router lifetime as one for redirect route,
- remove redirect route also when the router corresponds to the sender
  address is dropped (previously, considered only target address).

Note, even if we recieve a new RA, we do not update existing redirect
routes. The lifetime of the redirect route is updated only when a new
Redirect message is received.

Closes #32527.
2024-06-06 11:19:55 +01:00
Daan De Meyer 1a48d8549f core: Fix CPUQuotaPerSecUSec unit file serialization
CPUQuota= can deal with float percentages perfectly fine these days
(up to two places after the dot), so let's take that into account
when serializing the value to the transient unit file so we don't lose
precision when specifying e.g. "CPUQuota=0.5%".
2024-06-05 16:50:36 +02:00
Yu Watanabe dadf2bd4f4 test-network: introduce a .network file to protect existing interfaces 2024-06-03 18:41:26 +01:00
Yu Watanabe 653c38b3eb test-network: show PID and Invocation ID of networkd
Then, we can easily find relevant journal entry on failure.
This is especially useful when the test is running with --no-journal.
2024-06-03 18:41:26 +01:00
Yu Watanabe 6fec598290 test-network: flush stream buffer and journals before/after running test 2024-06-03 18:41:26 +01:00
Yu Watanabe 22fa8f6724 test-network: generate debugging logs of networkd-persistent-storage.service 2024-06-03 18:41:26 +01:00
Luca Boccassi 80a3eb5ab5 test: disable TEST-21-DFUZZER in mkosi, as it is very flacky
Can be re-enabled once https://github.com/systemd/systemd/issues/33156
is solved
2024-06-03 19:37:17 +02:00
Luca Boccassi d6243ebedd journald: enable persistent FD Store to fix logging during soft-reboot
A unit with StandardOutput=journal (the default) will get its stdout/stderr sockets
disconnected when journald stops, as the file descriptors on journald's side are
not preserved (it works on restart, as the FD Store keeps them open during restarts).
Set FileDescriptorStorePreserve=yes so that the journal FD's stay open during a soft
reboot, and applications don't get broken stdout/stderr.
2024-06-03 16:30:54 +01:00
Luca Boccassi 88c2ef1f75 Revert "test: Run end.sh when running integration tests with mkosi"
It seems this introduced a regression in the CentOS CI;

14:25:58 FAILED TASKS:14:25:58 -------------
14:25:58 TEST-03-JOBS
14:25:58 TEST-52-HONORFIRSTSHUTDOWN
14:25:58 TEST-63-PATH

Revert for now.

This reverts commit da3c6fc553.
2024-06-03 16:29:23 +01:00
Daan De Meyer 9619fdc102
Merge pull request #33157 from DaanDeMeyer/end
test: Run end.sh when running integration tests with mkosi
2024-06-02 21:04:56 +02:00
Daan De Meyer da3c6fc553 test: Run end.sh when running integration tests with mkosi 2024-06-02 19:15:21 +02:00
Daan De Meyer 7c0ab0cdf2 TEST-16-EXTEND-TIMEOUT: Convert to oneshot service
To match the other service units more and allow adding more
ExecStart= lines via dropins.
2024-06-02 19:15:21 +02:00
Yu Watanabe 46322f2742 test: exit earlier when cgroup user xattr is not supported
Also, use trap for cleaning up the test environment.
2024-06-01 22:35:07 +09:00
Yu Watanabe 5f03c19f7b test: reduce number of 'systemctl daemon-reload' a bit 2024-06-01 22:28:32 +09:00
Yu Watanabe 7faf8987ed test: sync journal in short-living services
This also adjusts LogLevelMax=.

Hopefully, this makes the test much stabler.
2024-06-01 22:25:50 +09:00
Yu Watanabe 77356099ce test-network: add missing sleep()
Fixes a bug introduced by 7ef26afca5.

Fixes #33098.
2024-06-01 08:25:10 +02:00
Daan De Meyer f4a0dd0ef6
Merge pull request #33105 from DaanDeMeyer/sanitizers
Sanitizers
2024-05-31 19:44:05 +02:00
Daan De Meyer 605d72cb14 TEST-21-DFUZZER: Stop marking as slow
This was a workaround to not run TEST-21-DFUZZER without sanitizers.
Now that we're going to get sanitizer support, let's run it by default
again.
2024-05-31 17:26:13 +02:00
Daan De Meyer e690a8cd09 TEST-69-SHUTDOWN: Order after systemd-user-sessions.service
Make sure that we're allowed to login by ordering ourselves after
systemd-user-sessions.service.
2024-05-31 17:26:13 +02:00
Daan De Meyer 80a5f762bb
Merge pull request #33121 from yuwata/test-integration-tests-mkosi
Test: several integration test improvements
2024-05-31 15:40:43 +02:00
Yu Watanabe 1f4345b5ed networkd-test: first wait for interface being configured
DNS setting propagation to resolved may take some time.
2024-05-31 10:00:21 +02:00
Yu Watanabe 7ae191a5ea test: optionally allow to disable user service manager, and disable it on TEST-64
The test triggers many uevents, and running both system and user service
managers make the test slow.
2024-05-31 16:29:19 +09:00
Yu Watanabe 052500a072 test: make it sure that devices are processed by udevd before running subtests 2024-05-31 16:10:55 +09:00
Yu Watanabe 60914351c8 test: lock device on sfdisk or mkfs, and extend timeout
Hopefully fixes #33111.
2024-05-31 16:09:31 +09:00
Luca Boccassi 0630069f0b
Merge pull request #33081 from keszybz/networkctl-formatting
Fix formatting of speeds in networkctl
2024-05-30 16:33:38 +02:00
Daan De Meyer 6b572e88a3 test-network: Add dirs_exist_ok=True to cp_r()
Let's not fail if directories already exist in cp_r().
2024-05-30 12:47:45 +02:00
Daan De Meyer f824a33a79 test-execute: Load systemd-asan-env environment file if available
When DynamicUser= is enabled, we need LD_PRELOAD to be configured
correctly as the tests will load systemd's nss module which will complain
when built with sanitizers if the sanitizer libraries were not loaded
first.
2024-05-30 12:47:45 +02:00