Commit Graph
71663 Commits
Author SHA1 Message Date
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
Luca Boccassi e07e7017bb man: enchance sd_bus_set_watch_bind() example to handle one more failure
In case the D-Bus policy is not set up correctly the example just
loops forever. Check the return of sd_bus_request_name_async() in
a callback and exit if the error is not temporary.

Follow-up for 34bbda18a5
2024-02-15 14:19:39 +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
Sam Leonard f31cff849d journald: implement socket forwarding
This commit adds a new way of forwarding journal messages - forwarding
over a socket.

The socket can be any of AF_INET, AF_INET6, AF_UNIUX or AF_VSOCK.

The address to connect to is retrieved from the "journald.forward_address" credential.

It can also be specified in systemd-journald's unit file with ForwardAddress=
2024-02-15 14:08:20 +00:00
Sam Leonard 6813be2eba journald: Add assertions to config_parse_compress 2024-02-15 14:08:20 +00:00
Mike Yuan 0ba24952f5 core/manager: don't propagate manager session env to children
Follow-up for 4cb4e6cf6d

Fixes #31287
2024-02-15 19:23:53 +08:00
Mike Yuan 9128fd553c env-util: minor modernization 2024-02-15 19:23:52 +08:00
Mike Yuan 52bcc872b5 logind-session: use Requires= for user{,-runtime-dir}@.service
Since we do require these basic user services, let's make
the dependency stronger. Note that logind should enqueue
start jobs for these already in user_start(), so mostly
just paranoia.
2024-02-15 19:23:52 +08:00
Mike Yuan e2a42c0c43 logind-user: track user started/stopping state through user-runtime-dir@.service
Before #30884, the user state is tied to user@.service (user service
manager). However, #30884 introduced sessions that need no manager,
and we can no longer rely on that.

Consider the following situation:

1. A 'background-light' session '1' is created (i.e. no user service manager
   is needed)
2. Session '1' scope unit pulls in user-runtime-dir@.service
3. Session '1' exits. A stop job is enqueued for user-runtime-dir@.service
   due to StopWhenUnneeded=yes
4. At the same time, another session '2' which requires user manager is started.
   However, session scope units have JobMode=fail, therefore the start job
   for user-runtime-dir@.service that was pulled in by session '2' scope job
   is deleted as it conflicts with the stop job.

We want session scope units to continue using JobMode=fail, but we still need
the dependencies to be started correctly, i.e. explicitly requested by logind
beforehand. Therefore, let's stop using StopWhenUnneeded=yes for
user-runtime-dir@.service, and track users' `started` and `stopping` state
based on that when user@.service is not needed. Then, for every invocation
of user_start(), we'll recheck if we need the service manager and start it
if so.

Also, the dependency type on user-runtime-dir@.service from user@.service
is upgraded to `BindsTo=`, in order to ensure that when logind stops the
former, the latter is stopped as well.
2024-02-15 19:23:44 +08:00
Mike Yuan 5518b72ba8 login/logind-session-dbus: some follow-ups for 'user-incomplete' (#30226)
We don't usually say ", refusing" in bus error messages.
Also, make use of unref_and_replace_full.
2024-02-15 19:23:44 +08:00
Adrian Vovk d0aef638ac keyring-util: Use reported key size to resize buf
According to keyctl(2), the return value for KEYCTL_READ is:

    The amount of data that is available in the key,
    irrespective of the provided buffer size

So, we could pass in a NULL buffer to query the size, then allocate the
exact right amount of space, then call keyctl again to get the key data.
However, we must still keep the for loop to avoid TOCTOU issues: the key
might have been replaced with something bigger while we're busy
allocating the buffer to store it.

Thus, we can actually save a syscall by picking some reasonable default
buffer size and skipping the NULL call to keyctl. If our default is big
enough, we're done and have saved a syscall! If not, then the first call
behaves essentially the same as the NULL call, and we use the size it
returns to reallocate the buffer appropriately.
2024-02-15 11:13:34 +00:00
Benjamin Franzke 614d09a37d nspawn: add support for owneridmap bind option
owneridmap bind option will map the target directory owner from inside the
container to the owner of the directory bound from the host filesystem.
This will ensure files and directories created in the container will be owned
by the directory owner of the host filesystem. All other users will remain
unmapped. Files to be written as other users in the container will not be
allowed.

Resolves: #27037
2024-02-15 11:49:54 +01:00
Yu Watanabe 4dcfdd210c log: reorder arguments of internal macro
To make the order matches with log_internal().

No functional change. Hopefully silence coverity issues like
CID#1534478, CID#1534479, CID#1534480, CID#1534482.
2024-02-15 18:16:33 +09:00
Yu Watanabe 7774a7ca79 test: fix cleanup function
Follow-up for 8349bbdfd8.
2024-02-15 09:37:10 +01:00
Adrian Vovk 058a84d113 homed: Pass in username and uid as Polkit details
This lets the Javascript polkit policies to decide whether to
allow/deny/authenticate based on the user that's being operated on.
2024-02-15 09:12:37 +01:00
Yu Watanabe 8c3f988880 vmspawn: fix alignment of merged initrd
Follow-up for 811ad9e6b2.

Fixes CID#1534481.
2024-02-15 09:11:55 +01:00
Daan De Meyer 9a07df3bcd Merge pull request #31330 from yuwata/sd-journal-trivial-cleanups
sd-journal: trivial cleanups
2024-02-15 08:56:56 +01:00
Yu Watanabe 0984c3d021 copy: rebreak comment and fix typo 2024-02-15 10:19:02 +09:00
Yu Watanabe a9c2e0f426 sd-journal: fix potential memory leak
Though, hopefully, the memory leak is hypothetical, as we always close
journal file with the timer by journal_file_offline_close().
2024-02-15 09:50:18 +09:00
Yu Watanabe da96afcd6c journal-file-util: drop unused template argument for journal_file_open_reliably()
I understand that the original motivation to introduce the template
argument here is to make journal_file_open() and _reliabrly() take the
same arguments. But, yeah, that's completely unused, not necessary to
complicate the code even the difference is not big.
2024-02-15 09:50:18 +09:00
Yu Watanabe 36c6b26c37 sd-journal: use -EBADF for journal_file_open() 2024-02-15 09:50:18 +09:00
Yu Watanabe 3f6c529cde sd-journal: shorten code a bit 2024-02-15 09:50:18 +09:00
Yu Watanabe 6854322483 test-network: show interface status again when wait-online failed
Fixes a bug in 10d670a3c1.

This also makes wait_online() show a short message when a requested
interface not found.
2024-02-15 00:37:03 +00:00
Yu Watanabe d5ff4b6d4c Merge pull request #31173 from yuwata/network-route-check-conflict
network/route: check if existing route can be updated
2024-02-15 08:12:42 +09:00
Yu Watanabe 4931b8e471 login: fix typo
Follow-up for 6e9bf0ad29.
2024-02-15 05:38:47 +09:00
Luca Boccassi 76995e7dc4 Merge pull request #31286 from poettering/bootctl-varlink
bootctl: add simple varlink IPC interface
2024-02-14 18:59:33 +00:00
Daan De Meyer dbb9a6ad69 meson-vcs-tag: Say version format specification
That's the official name so let's use it.
2024-02-14 19:58:19 +01:00
Luca Boccassi 32243272ff Merge pull request #31317 from fbuihuu/update-tests-for-suse
Update tests for SUSE
2024-02-14 17:31:40 +00:00
Winterhuman 6c6ec5f728 Improve IgnoreSIGPIPE description
Reword the description of the `IgnoreSIGPIPE=` service option to be more grammatical.
2024-02-14 17:31:18 +00:00
Mike Yuan 3725766266 systemctl: don't warn unit needs reload if --no-warn 2024-02-15 00:37:19 +08:00
Lennart Poettering a0437868d8 Merge pull request #30226 from poettering/homed-fallback-shell
homed: allow logging into home areas via ssh without unlocking them locally first
2024-02-14 17:08:04 +01:00
Yu Watanabe 29fbbb1389 test-network: add test for advertised hop limit
For issue #28437.
2024-02-15 00:43:12 +09:00
Matt MuggeridgeandYu Watanabe b15ed2be2f network/ndisc: also set sysctl hop_limit value
Otherwise, the hop limit set to the routes may not be used in some
situations.

Fixes #28437.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2024-02-15 00:43:12 +09:00
Yu Watanabe 9fbab82bef test-network: add test case for removing conflicting routes
For issue #28439.
2024-02-15 00:43:12 +09:00
Yu Watanabe e3cc2bd9c6 test-network: drop unnecessary IPv6SendRA=yes setting 2024-02-15 00:43:12 +09:00
Yu Watanabe 972f1d17ab network/ndisc: remove conflicting routes on configuring routes based on newly received RA
The linux kernel does not update several parameters, e.g. RTA_PREF.
Hence, when we configure routes based on a RA, we need to remove
existing conflicting routes.

Fixes #28426 and #28439.
2024-02-15 00:43:12 +09:00
Yu Watanabe 7027cdbd79 network/route: remove existing route if some property conflict with requested ones
Fixes #28853.
2024-02-15 00:43:12 +09:00
Yu Watanabe e09b758876 network: rename link_drop_managed_xyz() -> link_drop_static_xyz()
As networkd does not configure nexthops, neighbors, or routing policy rules
dynamically, this only changes link_drop_managed_addresses(). Previously
it also removed dynamic addresses, but with this commit, now it only
removes static addresses. Note, link_drop_managed_routes() has removed
only static routes, so this commit only changes its name.

Note. as commented in the code, the dynamic addresses will be removed
on lease expiration or stopping client, and link_drop_managed_xyz() are
called on reconfiguration or so, and at that time, all dynamic
addressing clients are stopped or restarted, so this should not
effective behavior change.
2024-02-15 00:43:12 +09:00
Yu Watanabe a86763c70b network/ndisc: also drop SLAAC addresses and routes on reconfiguring
Especially, this is important for routes, as link_drop_managed_routes()
removes only static routes, rather than non-foreign routes.
2024-02-15 00:43:12 +09:00
Yu Watanabe 95e1fbbac4 test-network: allow to specify multiple interfaces to wait_online() without square bracket 2024-02-15 00:42:43 +09:00
Lennart Poettering 79ec39958d bootctl: add a Varlink interface
For now, just super basic functionality: return the list of boot menu
entries, and read/write the reboot to firmware flag
2024-02-14 16:15:19 +01:00
Lennart Poettering f892954ba2 bootspec: split out helper that turns BootEntry into a JSON object
We can use that later for returning the boot loader entry list as JSON
via Varlink.
2024-02-14 16:12:43 +01:00
Daan De Meyer ea2a57bee3 meson: Start adding devel and rc suffixes to the project version
Let's make sure that versions generated by meson-vcs-tag.sh always
sort higher than official and stable releases. We achieve this by
immediately updating the meson version in meson.build after a new
release. To make sure this version always sorts lower than future
rcs, we suffix it with "~devel" which will sort lower than "~rcX".

The new release workflow is to update the version in meson.build
for each rc and the official release and to also update the version
number after a new release to the next development version.

The full version is exposed as PROJECT_VERSION_FULL and used where
it makes sense over PROJECT_VERSION.

We also switch to reading the version from a meson.version file in
the repo instead of hardcoding it in meson.build. This makes it
easier to access both inside and outside of the project.

The meson-vcs-tag.sh script is rewritten to query the version from
meson.version instead of passing it in via the command line. This
makes it easier to use outside of systemd since users don't have to
query the version themselves first.
2024-02-14 15:36:34 +01:00
Daan De Meyer c0561a05f5 docs: Use v255~rc1 instead of v255-rc1
This gets the point across better that we want the rc to sort lower
than the official release.
2024-02-14 15:36:33 +01:00
Lennart Poettering 2cda44c23e efi-loader: make efi_loader_get_entries() handling missing NUL termination gracefully
Our function so far assumed that the LoaderEntries's last string is or
is not NUL terminated. But if it was, then we'd debug log about this,
claiming there was an invalid id. sd-boot actually ends the list in a
properly NUL-terminated string, hence we should just accept that. Handle
that case gracefully, and add comments explaining why we have two ways
why we exit the loop.

This is cosmetic only, just suppresses a misleading debug log message.
2024-02-14 15:35:52 +01:00
Lennart Poettering 1c5d03c088 update TODO 2024-02-14 15:10:39 +01:00