Commit Graph
75416 Commits
Author SHA1 Message Date
dependabot[bot] e2dca8d9c0 build(deps): bump ossf/scorecard-action from 2.3.3 to 2.4.0
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.3 to 2.4.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/dc50aa9510b46c811795eb24b2f1ba02a914e534...62b2cac7ed8198b15735ed49ab1e5cf35480ba46)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 13:08:42 +02:00
Yu Watanabe a8bc75089d journalctl: fix compile error on i386
Fixes the following error:
===
In file included from ../src/basic/macro.h:13,
                 from ../src/basic/dirent-util.h:8,
                 from ../src/journal/journalctl-misc.c:3:
../src/journal/journalctl-misc.c: In function 'show_log_ids':
../src/journal/journalctl-misc.c:107:22: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  107 |         assert(n_ids < INT64_MAX);
      |                      ^
../src/fundamental/macro-fundamental.h:70:44: note: in definition of macro '_unlikely_'
   70 | #define _unlikely_(x) (__builtin_expect(!!(x), 0))
      |                                            ^
../src/basic/macro.h:165:22: note: in expansion of macro 'assert_message_se'
  165 | #define assert(expr) assert_message_se(expr, #expr)
      |                      ^~~~~~~~~~~~~~~~~
../src/journal/journalctl-misc.c:107:9: note: in expansion of macro 'assert'
  107 |         assert(n_ids < INT64_MAX);
      |         ^~~~~~
cc1: all warnings being treated as errors
===

Follow-up for 0a8c1f6212.
2024-08-01 10:49:40 +02:00
Yu Watanabe 12a12c5af5 Merge pull request #33888 from YHNdnzj/followups
core: a few follow-ups for recent PRs
2024-08-01 11:35:13 +09:00
Yu Watanabe 89cf6f0b0a Merge pull request #32448 from yuwata/journalctl-current-invocation
journalctl: introduce --list-invocations, -I, --invocation= options
2024-08-01 11:33:20 +09:00
Yu Watanabe b1b30d0226 test: add test for journalctl --list-invocations and --invocation= 2024-08-01 07:31:44 +09:00
Yu Watanabe 7d3ae6b213 journalctl: add --list-invocations command and -I/--invocation options
The --list-invocations command is similar to --list-boots, but shows
invocation IDs of specified unit. This should be useful when showing
a specific invocation of a unit.

The --invocation option is similar to --boot, but takes a invocation ID
or an offset. The -I option is equivalent to --invocation=0.
2024-08-01 07:31:44 +09:00
Yu Watanabe 82721be7d6 logs-show: extend journal_get_boots() and friends to find invocation IDs
Currently the extended features are not used, but will be used later.
2024-08-01 07:31:44 +09:00
Yu Watanabe 1a997cb732 logs-show: introduce several helper functions
Currently these are not used, but will be used later.
2024-08-01 07:31:44 +09:00
Yu Watanabe 0a8c1f6212 use int64_t for index in show_log_ids() 2024-08-01 07:31:44 +09:00
Yu Watanabe b3a16f3985 journalctl: split out show_log_ids() from action_list_boots()
No functional change, just refactoring and prepraration for later change.
2024-08-01 07:31:44 +09:00
Yu Watanabe a581a2ce8d journalctl: update log messages 2024-08-01 07:31:44 +09:00
Yu Watanabe 6ecee6cf2b logs-show: rename BootId -> LogId
The struct itself is generic, and can be used for other ID.
Let's rename it to more generic one.
No functional change, just refactoring and preparation for later
commits.
2024-08-01 07:31:44 +09:00
Mike Yuan 4c523d62d2 core/socket: stop hardcoding every service inactive state
History (c068650fcf,
941a12dcba) has proven
that we're not good at keeping socket and service states
in sync. Instead, let's query the high-level unit_active_state()
first, and only hardcode the two special auto-restart
service states.

Additionally, allow returning to listening state on SERVICE_CLEANING.
2024-07-31 21:56:28 +02:00
Mike Yuan 067c91fcb8 core/cgroup: use UNIT_IS_INACTIVE_OR_FAILED where appropriate 2024-07-31 21:40:28 +02:00
Mike Yuan 8574b7940b core/unit: merge use of LOG_CONTEXT_SET_LOG_LEVEL into LOG_CONTEXT_PUSH_UNIT
No functional change, since LOG_CONTEXT_PUSH_UNIT is only used
in exec_spawn().
2024-07-31 21:40:28 +02:00
Mike Yuan c4c416b109 core: clean up ambient capability logging
Follow-up for e0ebc81b2d
2024-07-31 21:40:28 +02:00
Daan De Meyer 3a5d72d8a3 Merge pull request #33886 from DaanDeMeyer/autologin
Two mkosi improvements
2024-07-31 20:21:12 +02:00
Daan De Meyer ff5662129a Merge pull request #33885 from DaanDeMeyer/pidref-kthread
Two pidfd fixes
2024-07-31 19:07:35 +02:00
Daan De Meyer 3fe25d4530 mkosi: Beef up testuser a bit
Give it a password and add it to some common groups.
2024-07-31 18:32:53 +02:00
Daan De Meyer b3db96f230 mkosi: Switch to autologin via credentials
Let's use the newly added credentials to only enable autologin for
/dev/console (systemd-nspawn) and /dev/hvc0 (qemu) instead of enabling
autologin for every tty.
2024-07-31 17:38:12 +02:00
Daan De Meyer e54a8e0fc3 Merge pull request #33873 from DaanDeMeyer/rename-creds
core: Add support for renaming credentials with ImportCredential=
2024-07-31 17:35:58 +02:00
Michal Sekletar 941a12dcba socket: fix socket activation of stopped services with pinned FD store 2024-07-31 16:29:07 +02:00
Luca Boccassi 0e5c97ae6f Merge pull request #32937 from steelman/github/drop-ambient-caps-executor
core: drop ambient capabilities in systemd-executor
2024-07-31 16:11:30 +02:00
Daan De Meyer e97429902d units: Import tty specific credentials for each getty unit
As explained in the previous commit, this allows us to configure
agetty and login for individual ttys instead of globally.
2024-07-31 15:52:29 +02:00
Daan De Meyer 831f208783 core: Add support for renaming credentials with ImportCredential=
This allows for "per-instance" credentials for units. The use case
is best explained with an example. Currently all our getty units
have the following stanzas in their unit file:

"""
ImportCredential=agetty.*
ImportCredential=login.*
"""

This means that setting agetty.autologin=root as a system credential
will make every instance of our all our getty units autologin as the
root user. This prevents us from doing autologin on /dev/hvc0 while
still requiring manual login on all other ttys.

To solve the issue, we introduce support for renaming credentials with
ImportCredential=. This will allow us to add the following to e.g.
serial-getty@.service:

"""
ImportCredential=tty.serial.%I.agetty.*:agetty.
ImportCredential=tty.serial.%I.login.*:login.
"""

which for serial-getty@hvc0.service will make the service manager read
all credentials of the form "tty.serial.hvc0.agetty.xxx" and pass them
to the service in the form "agetty.xxx" (same goes for login). We can
apply the same to each of the getty units to allow setting agetty and
login credentials for individual ttys instead of globally.
2024-07-31 15:52:27 +02:00
Daan De Meyer 3de13e6148 exec-credential: Skip duplicate credentials in load_credential_glob()
We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.
2024-07-31 15:23:45 +02:00
Daan De Meyer 590348e2bf exec-credential: Log if we skip duplicate credential 2024-07-31 15:23:45 +02:00
Daan De Meyer 2c2ed3272b Drop EEXIST handling in load_credential_glob()
Credentials are written to a temporary file and renamed to the
destination with renameat() which will replace existing files so
EEXIST should not happen so drop the handling for EEXIST.
2024-07-31 15:23:45 +02:00
Daan De Meyer 5551426785 Merge pull request #33884 from DaanDeMeyer/log-context
log: Fix size calculation for number of iovecs
2024-07-31 14:23:08 +02:00
Daan De Meyer ead48ec35c cgroup-util: Don't try to open pidfd for kernel threads
The kernel might start returning -EINVAL when trying to open pidfd's
for kernel threads so let's not try to open pidfd's for kernel threads.
2024-07-31 13:50:16 +02:00
Daan De Meyer 9ce964d55b Merge pull request #33882 from bluca/efi_proto_fallback_memory
stub: allocate and zero enough space in legacy x86 handover protocol
2024-07-31 13:46:41 +02:00
Daan De Meyer fc83ff3f55 log: Fix size calculation for number of iovecs
Each log context field can expand to up to three iovecs (key, value
and newline) so let's fix the size calculation to take this into
account.
2024-07-31 13:12:55 +02:00
Daan De Meyer 7881f485c9 execute: Drop log level to unit log level in exec_spawn()
All messages logged from exec_spawn() are attributed to the unit
and as such we should set the log level to the unit's max log level
for the duration of the function.
2024-07-31 13:12:55 +02:00
Łukasz Stelmach 18d51ec876 Revert "execute: Call capability_ambient_set_apply even if ambient set is 0"
With ambient capabilities being dropped at the start of process managers
(both system and user) as well as systemd-executor it isn't necessary
to drop them here. Moreover, at this point also the inheritable set can
be preserved. This makes it possible to assign a user session manager
inheritable capabilities which combined with file capabilites (ei sets)
of service executables enable running user services with capabilities
but only when started by the manager.

This reverts commit 943800f4e7.
2024-07-31 11:09:58 +02:00
Łukasz Stelmach e0ebc81b2d core: drop ambient capabilities in systemd-executor
Since the commit 963b6b906e ("core: drop ambient capabilities in
user manager") systemd running as the session manager has dropped ambient
capabilities retaining other sets allowing user services to be started
with elevated capabilities. This, worked fine until the introduction of
sd-executor. For a non-root process to be started with elevated
capabilities by a non-root parent it either needs file capabilities or
ambient capabilities in the parent process. Thus, systemd needs to allow
sd-executor to inherit its ambient capabilities and sd-executor should
drop them as systemd did before.

The ambient set is managed for both system and session managers, but
with the default set for PID#1 being empty, this code does not affect
operation of PID#1.

Fixes: bb5232b6a3 ("core: add systemd-executor binary")
2024-07-31 11:09:58 +02:00
Yu Watanabe 175cdefd33 man: suggest to enable global IPv6Forwarding= setting to make IPv6 packets forwarded
Closes #33414.
2024-07-31 09:53:18 +02:00
Yu Watanabe acda1b3f2a NEWS: mention that udevadm test and test-builtin are now non-destructive
Follow-up for 089bef6631.
Prompted by https://github.com/systemd/systemd/issues/33619#issuecomment-2257576579.
2024-07-31 10:06:25 +09:00
Yu Watanabe dd87ad8e19 network: mention that IPv4 ACD is enabled by default for 169.254.0.0/16
Prompted by #33824.
2024-07-31 10:06:25 +09:00
Yu Watanabe e2becab085 network: request non-NULL SSID when a wlan interface is configured as station
To avoid conflicts with user .network file for the wlan interface with Bond=.
See https://github.com/systemd/systemd/issues/19832#issuecomment-857661200.
2024-07-31 10:06:04 +09:00
Yu Watanabe 6d0cdbe0bc Merge pull request #33878 from yuwata/network-bind-carrier
network: several cleanups for BindCarrier= setting
2024-07-31 10:05:43 +09:00
Yu Watanabe 356f25ab85 Merge pull request #33875 from yuwata/network-link-get-address
network: several fixlets related to link_get_address()
2024-07-31 10:05:11 +09:00
Luca Boccassi 4d6ab7e844 efi: fix link to legacy EFI handover protocol 2024-07-31 01:46:58 +01:00
Luca Boccassi 19812661f1 stub: allocate and zero enough space in legacy x86 handover protocol
A PE image's memory footprint might be larger than its file size due
to uninitialized memory sections. Normally all PE headers should be
parsed to check the actual required size, but the legacy EFI handover
protocol is only used for x86 Linux bzImages, so we know only the last
section will require extra memory. Use SizeOfImage from the PE header
and if it is larger than the file size, allocate and zero extra memory
before using it.

Fixes https://github.com/systemd/systemd/issues/33816
2024-07-31 01:46:25 +01:00
Yu Watanabe ba7c4bd6f2 network: shorten code a bit 2024-07-31 06:47:33 +09:00
Yu Watanabe 36b8ad085c network: call link_handle_bound_by_list() before trying to reconfigure interface
Otherwise, when an interface gained its carrier, the interface may not
have matching .network file yet, then link_reconfigure_impl() returns
zero, and link_handle_bound_by_list() is skipped.

Fixes #33837.
2024-07-31 06:47:11 +09:00
Ivan Shapovalov 7767896d12 Revert "network/ndisc: ignore most fields of RA header when lifetime is zero"
This reverts commit ffef01acdd.

Similar to 2d393b1b6d ("network: IPv6 Compliance: Router Advertisement
Processing, Reachable Time [v6LC.2.2.15]"),

Extract from: https://www.ietf.org/rfc/rfc4861.html#section-4.2, p.21,
first paragraph:

    The Router Lifetime applies only to
    the router's usefulness as a default router; it
    does not apply to information contained in other
    message fields or options.

So it does not make sense to prevent DHCPv6 when Router Lifetime is 0.

Fixes #33357.
2024-07-30 22:42:56 +02:00
Daniel P. Berrangé 9d7be044ca Fix detection of TDX confidential VM on Azure platform
The original CVM detection logic for TDX assumes that the guest can see
the standard TDX CPUID leaf. This was true in Azure when this code was
originally written, however, current Azure now blocks that leaf in the
paravisor. Instead it is required to use the same Azure specific CPUID
leaf that is used for SEV-SNP detection, which reports the VM isolation
type.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-07-30 22:39:20 +02:00
Yu Watanabe f320c0777a test-network: add test case for preferred source with peer
For issue #31950.
2024-07-31 05:36:14 +09:00
Yu Watanabe 56f91e2d0b network: make link_get_address() provide matching address with peer
As all callers do not care if the address has peer address.
This also drops prefixlen argument as it is always zero.

Fixes a bug introduced by 42f8b6a808.
Fixes #31950.
2024-07-31 05:36:14 +09:00
Yu Watanabe d9ef1cc407 network/ipv4acd: manage ACD engines with Address object
IPv4 addresses are managed with local and peer addresses and prefix
length. So, potentially, the same address with different prefix length
can be assigned on a link, e.g. 192.168.0.1/24 and 192.168.0.1/26.
If one of the address is configured with ACD but the other is not,
then previously ACD might be unexpectedly disabled or enabled on them,
as we managed ACD engines with only local addresses.

This makes ACD engines managed with the corresponding Address objects.
2024-07-31 05:35:20 +09:00