Commit Graph

47887 Commits

Author SHA1 Message Date
Adrian Vovk
25c89b8977 homectl: Add flags to edit blob directories
This makes it possible to edit blob directories using homectl. The
following syntax is available:

* `--blob-directory=/path/somewhere`: Replaces the entire blob directory
with the contents of /path/somewhere

* `--blob-directory=foobar=/path/somewhere`: Replaces just the file
foobar in the blob directory with the contents of /path/somewhere

* `--blob-directory=foobar=`: Deletes the file foobar from the blob
directory

* `--blob-directory=`: Resets all previous flags

* `--avatar=`, etc: Shortcuts for `--blob-directory=FILENAME=` for the
known files in the blob directory
2024-02-19 11:18:11 +00:00
Adrian Vovk
a4d72746c7 homework: Handle Update & Create w/ blob dir
Introduces new extended variants of the various incarnations of
Create and Update, which take a map of filenames to FDs. This map is
then used to populate the bulk directory.

FDs are used to prevent the client from abusing homed's blob directory
permissions (everything is made world-readable by homed) to open files
that they normally aren't allowed to open. Passing along an FD ensures
that the client has read access to the file it wants homed to make
world-readable.

Internally, homework uses the map to overwrite the system blob dir.
Later, homework's existing blob dir reconciliation logic will propagate
the new contents from the system blob dir into the embedded blob
dir
2024-02-19 11:18:11 +00:00
Adrian Vovk
17ac40e4cd homework: Reconcile blob directories
Whenever the host & embedded records are reconciled, the host & embedded
blob directories are now reconciled too in the same direction.
Reconciling the blob directories serves exactly the same purpose as
reconciling the user records, and thus should behave in the same way.
2024-02-19 11:18:11 +00:00
Adrian Vovk
c3d50255fc homed: Create & advertise blob directory
This ensures that a user-specific blob directory exists in
/var/cache/systemd/homed for as long as the user exists, and gets
deleted if the user gets deleted.

It also advertises this blob directory via the user record, so that
clients can find and use it.
2024-02-19 11:18:11 +00:00
Adrian Vovk
1b466c0940 user-record: Add blobDirectory and blobManifest
These fields are used to connect a JSON user record to its blob
directory, and to include the directory's contents in the record's
signature
2024-02-19 11:18:11 +00:00
Adrian Vovk
85f660d46b fd-util: Expose helper to pack fds into 3,4,5,...
This is useful for situations where an array of FDs is to be passed into
a child process (i.e. by passing it through safe_fork). This function
can be called in the child (before calling exec) to pack the FDs to all
be next to each-other starting from SD_LISTEN_FDS_START (i.e. 3)
2024-02-19 11:18:11 +00:00
Luca Boccassi
034569150f Merge pull request #31364 from bluca/vpick_ext
core: add support for vpick for ExtensionImages=/ExtensionDirectories=
2024-02-19 11:15:54 +00:00
Yu Watanabe
ac63c8df30 sd-radv: fix potential buffer overflow
Fixes a bug in 1925f829ab and
6a6d27bc5b (v255).
2024-02-19 10:16:36 +00:00
Yu Watanabe
b5b2510800 pam-util: include cache ID of bus connection in the log message
To make it easier to debug issues like #31375.
2024-02-19 10:15:33 +00:00
Yu Watanabe
d42b81f93f core/exec: do not crash with UtmpMode=user without User= setting
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2264404.

Replaces #31356.
2024-02-19 10:51:00 +01:00
Franck Bui
190ff0d0a8 vconsole-setup: don't fail if the only found vc is already used by plymouth
During the boot process, systemd-vconsole-setup can be started when the only
allocated VC is already taken by plymouth.

This case is expected when a boot splash is displayed hence
systemd-vconsole-setup.service should not fail if it happens.

However rather than doing nothing, the sysfs utf8 flag is set before exiting
early.
2024-02-19 09:25:14 +01:00
Yu Watanabe
b4054aff24 network: do not request DHCP addresses configured on checking prefix delegation
This does not change anything for DHCPv4, as a DHCPv4 address is always
requested anyway. However for DHCPv6, the client may not request IA_NA
addresses by UseAddress=no, or even if it is requested, the server may
not provide any IA_NA addresses. Even in such cases, here the check is
for delegated prefixes, hence it is not necessary to check if DHCPv6
IA_NA addresses are configured.

Fixes a bug introduced by 195b83edf8.

Fixes #31349.
2024-02-17 11:48:25 +00:00
Yu Watanabe
43a752669e network/dhcp6: deem DHCPv6 configuration to be finished even if no IA_NA is provided
Follow-up for fc4aa64c2d.

Otherwise, even if we request no address, Link.dhcp6_configured stuck on
false.
2024-02-17 11:48:25 +00:00
Luca Boccassi
622efc544d core: add support for vpick for ExtensionDirectories= 2024-02-17 11:20:00 +00:00
Luca Boccassi
5e79dd96a8 core: add support for vpick for ExtensionImages= 2024-02-17 11:20:00 +00:00
Luca Boccassi
70247b103a Merge pull request #31367 from yuwata/cgroup-runtime-fix
core/cgroup: several follow-up about CGroupRuntime
2024-02-17 10:24:06 +00:00
Yu Watanabe
160d636ff4 resolve: name field may be NULL
Follow-up for e1634bb832.

Fixes #31361.
2024-02-17 10:22:53 +00:00
Yu Watanabe
ad48cc6f81 core/unit: fix superficial NULL-pointer dereference
Though, when unit_prepare_exec() is called, the unit should always
have the cgroup runtime context 'crt'. So, I think we can insert assert().
But, for consistency with other places that call unit_get_cgroup_runtime(),
here use the simple non-NULL check for 'crt' instead of using assert().

Follow-up for 9cc545447e.

Fixes CID#1534667.
2024-02-17 16:50:46 +09:00
Yu Watanabe
e7cf5c82da core/cgroup: drop duplicated free()s
Follow-up for 9cc545447e.

Fixes CID#1534665 and CID#1534666.
2024-02-17 16:46:19 +09:00
Luca Boccassi
67065a7fa1 Merge pull request #31127 from poettering/cgroup-runtime2
core: split out cgroup specific state fields from Unit → CGroupRuntime
2024-02-16 23:38:53 +00:00
Yu Watanabe
e21dd22040 Merge pull request #31338 from ssahani/network-bond-missed
network: netdev - bond add support for ARP missed max
2024-02-17 06:16:42 +09:00
Vishal Chillara Srinivas
e1634bb832 resolve: provide service resolve over varlink
ported the d-bus implementation of service resolve to varlink
extended TEST-75-RESOLVED to cover this use-case
2024-02-16 16:24:08 +01:00
Luca Boccassi
92d1419eb8 Merge pull request #31218 from CodethinkLabs/vmspawn/journal_forwarding
vmspawn: support journal forwarding
2024-02-16 12:09:52 +00:00
Tomáš Pecka
9f78da68ac varlink: fix varlink_collect_full not resetting state
The varlink_collect_full function did not set varlink client's state
when the reply was an error. The state was stuck in "collecting-reply".

I discovered that while hacking on network varlink interface (adding a
new varlink method). The debug logs shows the process of performing the
first query which replies with an error:

  varlink: Setting state idle-client
  network: Sending message: {"method":"io.systemd.Network.LLDPNeighbors","parameters":{"ifindex":1},"more":true}
  network: Changing state idle-client → collecting
  network: Received message: {"error":"org.varlink.service.MethodNotFound","parameters":{"method":"io.systemd.Network.LLDPNeighbors"}}
  network: Changing state collecting → collecting-reply

Now another varlink_collect call is being made, but

  network: Connection busy.
  Failed to execute varlink call: Device or resource busy

This was not caught by the tests because there were no varlink_collect
calls that resulted in error reply.
2024-02-16 12:08:31 +00:00
Luca Boccassi
5ea0da03d4 Merge pull request #31311 from yuwata/journal-user-corruption
journal: fix user journal corruption on rotation
2024-02-16 12:07:50 +00:00
Sam Leonard
ec3d2f2e9d vmspawn: fix possible NULL dereference in discover_boot_entry 2024-02-16 12:45:08 +01:00
Lennart Poettering
f03e8f19b7 Merge pull request #30263 from msizanoen1/fix-onboot-rotate-2
journal: Reset runtime seqnum data when flushing to system journal
2024-02-16 12:02:09 +01:00
Lennart Poettering
9cc545447e core: split out cgroup specific state fields from Unit → CGroupRuntime
This refactors the Unit structure a bit: all cgroup-related state fields
are moved to a new structure CGroupRuntime, which is only allocated as
we realize a cgroup.

This is both a nice cleanup and should make unit structures considerably
smaller that have no cgroup associated, because never realized or
because they belong to a unit type that doesn#t have cgroups anyway.

This makes things nicely symmetric:

        ExecContext → static user configuration about execution
        ExecRuntime → dynamic user state of execution
        CGroupContext → static user configuration about cgroups
        CGroupRuntime → dynamic user state of cgroups

And each time the XyzContext is part of the unit type structures such as
Service or Slice that need it, but the runtime object is only allocated
when a unit is started.
2024-02-16 10:17:40 +01:00
Lennart Poettering
3f236f24ba cgroup: normalize parameter order in format_cgroup_memory_comparison()
We usually put the return parameter last. Do so here too.
2024-02-16 10:17:16 +01:00
Susant Sahani
b33bba0434 network: netdev - bond add support for ARP missed max
Allows to configure bond arp_missed_max is the maximum number of arp_interval monitor cycle
for missed ARP replies. If this number is exceeded, link is reported as
down.
2024-02-16 14:44:51 +05:30
Daan De Meyer
55c2350e85 Merge pull request #31320 from DaanDeMeyer/versioning
meson: Start adding devel and rc suffixes to the project version
2024-02-15 20:15:04 +01:00
Yu Watanabe
18d4e475c7 journal-file-util: use COPY_VERIFY_LINKED
As the main thread may call journal_directory_vacuum() ->
unlinkat_deallocate() while another thread is copying the file.

Fixes #24150 and #31222.
2024-02-16 03:48:18 +09:00
Yu Watanabe
72ef2a617f copy: introduce COPY_VERIFY_LINKED flag
If the flag is set, then copy_file() and friends check if the source
file still exists when the copy operation finished.
2024-02-16 03:48:18 +09:00
Yu Watanabe
cb0d5f73e6 sd-journal: use stat_verify_linked() 2024-02-16 03:48:18 +09:00
Yu Watanabe
a6d0cf939c stat-util: introduce {stat,fd}_verify_linked() 2024-02-16 03:48:18 +09:00
Yu Watanabe
dd7fa015a6 stat-util: rebreak comment 2024-02-16 03:48:18 +09:00
Yu Watanabe
f0455cec53 bsod: fix -c/--continuous support
Fixes a bug introduced by f7f062bf9f.

Fixes #31334.
2024-02-16 02:21:11 +09:00
Yu Watanabe
3900255ac1 Merge pull request #31331 from yuwata/xopenat
tree-wide: several cleanups related to xopenat()
2024-02-16 01:32:21 +09:00
Yu Watanabe
f73ad0a9fb journal-file-util: use the file descriptor of journal file on copy
No effective functionality changed, just refactoring.
2024-02-16 00:25:37 +09:00
Yu Watanabe
0f938a024e test: add test for copying symlink with copy_tree_at() 2024-02-16 00:25:37 +09:00
Yu Watanabe
d1553bfd20 copy: use xopenat() to make 'from' argument optional 2024-02-16 00:25:37 +09:00
Yu Watanabe
e40b11be04 fs-util: rename xopenat() -> xopanat_full() 2024-02-16 00:25:37 +09:00
Yu Watanabe
6383abd62c loop-util: fix error handling
Follow-up for 972c8db589.
2024-02-16 00:25:37 +09:00
Yu Watanabe
59a4e17249 chattr-util: fix error code
Follow-up for cf91b9155c.
2024-02-16 00:25:37 +09:00
Yu Watanabe
bec1383623 chase: do not wrap xopenat() with RET_NERRNO()
Follow-up for 47f0e1b5e0.
2024-02-16 00:25:37 +09:00
Yu Watanabe
e4c094c055 fs-util: readlinkat() supports an empty string
From readlinkat(2):
Since Linux 2.6.39, pathname can be an empty string, in which case the
call operates on the symbolic link referred to by dirfd (which should
have been obtained using open(2) with the O_PATH and O_NOFOLLOW flags).
2024-02-16 00:25:37 +09:00
Luca Boccassi
55d37de121 Merge pull request #30910 from YHNdnzj/logind-followup
logind-user: switch tracking logic to user-runtime-dir@.service
2024-02-15 14:32:48 +00:00
Michael Biebl
50b68cff54 systemctl: drop chain invocation of telinit
This functionality relied on telinit being available in a different path
then the compat symlink shipped by systemd itself. This is no longer the
case for any known distro, so remove that code.

Fixes: #31220
Replaces: #31249
2024-02-15 14:29:20 +00:00
Sam Leonard
258d26940f vmspawn: add --forward-journal= 2024-02-15 14:08:21 +00:00
Sam Leonard
b4d4ebe850 journal-remote: allow AF_VSOCK and AF_UNIX for --listen-raw
This allows log messages forwarded over an AF_UNIX or AF_VSOCK socket by
journald to be received by systemd-journal-remote.
2024-02-15 14:08:20 +00:00