Commit Graph
9018 Commits
Author SHA1 Message Date
Mike Yuan f5dc74de2e shared/exec-util: modernize execute_strv() and friends a bit
do_spawn() is also called during execute_strv(), so rename
"direxec" to "exec-inner".
2024-10-15 01:16:57 +02:00
Mike Yuan 8e39ba3e5a shared/exec-util: minor rearrangement, drop unused EXEC_DIR_NONE 2024-10-15 01:16:57 +02:00
Yu Watanabe c9dea52941 Merge pull request #34743 from yuwata/bus-message-dump-fd
bus-message-util: introduce bus_message_dump_fd() and _string()
2024-10-15 05:58:03 +09:00
Yu Watanabe 40fbde9571 Merge pull request #34745 from yuwata/local-outbounds-prefsrc
local-addresses: honor RTA_PREFSRC field of gateway
2024-10-15 05:57:34 +09:00
Ivan Kruglov 7809bd3ba7 machine: introduce io.systemd.MachineImage.Update varlink method
io.systemd.MachineImage.Update implements the following dbus org.freedesktop.machine1.Manager interfaces:

- RenameImage
- MarkImageReadOnly
- SetImageLimit
2024-10-14 11:09:18 +02:00
Ivan Kruglov fb0ea6a6a3 machine: introduce io.systemd.MachineImage.List varlink method
io.systemd.MachineImage.List implements the following dbus org.freedesktop.machine1.Manager interfaces:

- GetImage
- ListImages
- GetImageHostname
- GetImageMachineID
- GetImageMachineInfo
- GetImageOSRelease
2024-10-14 10:57:36 +02:00
Ivan Kruglov 4439679892 machine: fix misnamed params in src/shared/discover-image.h 2024-10-14 10:42:47 +02:00
Yu Watanabe 4adf2653e2 local-addresses: honor RTA_PREFSRC field of gateway
Fixes #34739.
2024-10-13 06:56:41 +09:00
Yu Watanabe 418641f73f local-addresses: use FOREACH_ARRAY() macro 2024-10-13 06:30:58 +09:00
Yu Watanabe 058bccbecb bus-message-util: introduce bus_message_dump_fd() and _string()
Then, use them in analyze and oomctl.
2024-10-13 05:44:19 +09:00
Arthur ShauandMatteo Croce cc0ab8c810 timer: introduce DeferReactivation setting
By default, in instances where timers are running on a realtime schedule,
if a service takes longer to run than the interval of a timer, the
service will immediately start again when the previous invocation finishes.
This is caused by the fact that the next elapse is calculated based on
the last trigger time, which, combined with the fact that the interval
is shorter than the runtime of the service, causes that elapse to be in
the past, which in turn means the timer will trigger as soon as the
service finishes running.

This behavior can be changed by enabling the new DeferReactivation setting,
which will cause the next calendar elapse to be calculated based on when
the trigger unit enters inactivity, rather than the last trigger time.

Thus, if a timer is on an realtime interval, the trigger will always
adhere to that specified interval.
E.g. if you have a timer that runs on a minutely interval, the setting
guarantees that triggers will happen at *:*:00 times, whereas by default
this may skew depending on how long the service runs.

Co-authored-by: Matteo Croce <teknoraver@meta.com>
2024-10-11 22:54:16 +02:00
Yu Watanabe 8cde9f6c5a conf-parser: introduce config_parse_in_addr_prefix()
It is not used currently, but will be used later.
2024-10-12 03:26:04 +09:00
Lennart Poettering d00dd3d3c0 Merge pull request #34717 from anonymix007/fundamental-boot-changes
Fundamental and boot changes for multi-dt UKIs
2024-10-11 17:55:06 +02:00
Mike Yuan 8c9c8e304e shared/bus-util: re-break comment, insert missing newline before case
Follow-up for a178ffdfcd
2024-10-11 15:30:04 +02:00
Daan De Meyer 051441e559 Merge pull request #34686 from DaanDeMeyer/bus-fallback
Make sure bus_connect_transport_systemd() actually connects to the private manager bus
2024-10-11 15:16:54 +02:00
anonymix007 33af044178 fundamental: Add EFI_GUID userspace definition 2024-10-11 15:23:54 +03:00
Lennart Poettering 1fef1773c0 Merge pull request #34703 from poettering/pidref-varlink
Serialize "PidRef" in a reasonable way in Varlink interfaces
2024-10-11 13:33:44 +02:00
Lennart Poettering 373c810e04 Merge pull request #34681 from ikruglov/ikruglov/io-systemd-Machine-post-merge-review
machine: address post-merge review #34623
2024-10-11 12:15:56 +02:00
Lennart Poettering d693c483a2 seccomp: allowlist uretprobe() syscall
This is a new syscall provided by the kernel used to implement faster
uprobes. It's not supposed to be called by userspace, but only by kernel
generated uprobe code.

It should be fine to allow this, as the kernel authenticates the
invocation itself, and we shouldn't break compat with things.

Note that this allowlisting is not sufficient to make ureprobe() work.
libseccomp must be tought the syscall too, but this can happen
independently.

Fixes: #34615
2024-10-11 11:57:40 +02:00
Daan De Meyer a178ffdfcd bus-util: Move geteuid() check out of bus_connect_system_systemd()
Let's move this check to bus_connect_transport_systemd() so that
bus_connect_system_systemd() will only ever connect to the manager
private manager bus instance and fail otherwise.
2024-10-11 11:35:02 +02:00
Daan De Meyer a339495b1d bus-util: Drop fallback to system/user bus if manager bus doesn't work
We have various callsites that explicitly need the manager bus and
won't work with the system bus, like daemon-reexec and friends which
can't properly wait until the operation has finished unless using the
manager bus.

If we silently fall back to the system bus for these operations, we
can end up with rather hard to debug issues so let's remove the fallback
as it was added back in 2013 in a6aa89122d
without a clear explanation of why it was needed (I expect as a fallback
if kdbus wasn't available but that's not a thing anymore these days).
2024-10-11 11:35:02 +02:00
Lennart Poettering 755cb018c9 machined: also take new ProcessId structure when registering processes 2024-10-11 10:48:07 +02:00
Lennart Poettering 0fc530d157 machined: make List() varlink method return a full pidref JSON object for leader
This new call has not been released yet, hence we can still change the
encoding of the "leader" field.
2024-10-11 10:48:07 +02:00
Lennart Poettering 47bbcfff06 varlink-idl: introduce c/.h file for common varlink IDL structures
Some structures we'll use in various varlink interfaces, move them to a
common .c/.h file. For now this is only the dual timestamp object, but
there will be more soon.
2024-10-11 10:41:06 +02:00
Ivan Kruglov 5cdb5c17d3 machine: complete description of io.systemd.Machine.{List, Terminate, Kill, Unregister} methods 2024-10-10 12:34:45 +02:00
Daan De Meyer 46536e1d6c efi-loader: Add @ to valid characters
This is now a valid character with the introduction of multi UKI
profiles, so update the function to allow it.
2024-10-09 20:36:57 +02:00
Yu Watanabe af1a594b55 Merge pull request #34691 from poettering/polkit-varlink-field-macro
polkit: introduce common macro for generating polkit allowInteractive…
2024-10-10 00:44:29 +09:00
Lennart Poettering e47dbf5b4e polkit: introduce common macro for generating polkit allowInteractiveAuth varlink method call IDL field
We define the same field at many places, let's add a macro with it, that
also contains a suitable description comment.
2024-10-09 15:41:58 +02:00
Daan De Meyer 61808636a7 Merge pull request #34679 from DaanDeMeyer/bus-log
Various logging improvements
2024-10-09 11:42:26 +02:00
Daan De Meyer d8a77d55e6 bus-util: Log more information when connecting to a bus socket fails
Let's log about which bus we're trying to connect to and what transport
we're using to do it.
2024-10-09 10:27:53 +02:00
Yu Watanabe 223a67e572 tree-wide: replace reallocarray() with GREEDY_REALLOC() 2024-10-08 19:56:09 +09:00
Ivan Kruglov 144128d317 machine: extend io.systemd.Machine.List output with sshPrivateKeyPath field
Effectivelly, this is an implementation of GetMachineSSHInfo in dbus.
2024-10-07 14:50:16 +02:00
Ivan Kruglov 17d9f172eb machine: introduce io.systemd.Machine.Kill varlink method 2024-10-07 14:45:49 +02:00
Ivan Kruglov 6bb6354b4f machine: introduce io.systemd.Machine.Terminate varlink method 2024-10-07 14:45:49 +02:00
Ivan Kruglov 7999aa2c79 machine: introduce io.systemd.Machine.Unregister varlink method 2024-10-07 14:45:49 +02:00
Ivan Kruglov 1bd979dddb machine: io.systemd.Machine.List supports 'pid' filter 2024-10-07 14:45:48 +02:00
Yu Watanabe f769518c9a tree-wide: drop doubled empty lines 2024-10-07 09:51:37 +02:00
Lukas Nykryn da32cac8a0 core: warn if a generator is world-writable
... because that is obviously a security risk.
2024-10-07 11:02:37 +09:00
Mike Yuan feae34d64e path-lookup: move find_portable_profile() to portable-util 2024-10-06 19:27:11 +02:00
Mike Yuan 1a7627f4e1 unit-file: make unit_type_may_{alias_template} static inline 2024-10-06 19:27:11 +02:00
Mike Yuan 2bf5b262b5 basic/unit-file: move to shared/
Preparation for later commits, where path-lookup would be
moved into libsystemd.

Note that it currently includes sd-id128.h, hence shared/
seems more appropriate anyway.
2024-10-06 19:27:00 +02:00
Mike Yuan 3f8999a76e fs-util: rename laccess to access_nofollow
In order to distinguish it from libc function naming.
2024-10-05 01:30:43 +02:00
Mike Yuan 7c1dd9e288 various: correct laccess() error check
laccess is our own macro that uses RET_NERRNO.
2024-10-04 21:26:04 +02:00
Luca Boccassi ac799d64bd Merge pull request #34600 from poettering/varlink-idl-add-flags-everywhere
sd-varlink: maintain "more" flag support in the IDL structures
2024-10-03 21:02:22 +01:00
Daan De Meyer f02f8b3ca7 Merge pull request #34546 from ikruglov/ikruglov/refactor-GetMachineAddresses
machine: generalise logic of GetMachineAddresses/GetOsRelease to later use it in corresponding varlink interfaces
2024-10-02 10:24:59 +02:00
Lennart Poettering da01f7c246 sd-varlink: mark functions that can take 'more' flag in IDL structures with an explicit flag
Let's mark functions that accept the 'more' flag explicitly for that,
and validate for this explicitly.

This is preparation for
https://github.com/varlink/varlink.github.io/issues/26, if we get that
one day. Let's make sure that from day #1 we have this info available
even if we don't generate this in the IDL for now.

Also enables the two flags for all interfaces we export that use the
logic.
2024-10-02 09:22:52 +02:00
Lennart Poettering bd4beaa2eb tree-wide: always do dlopen() with RTLD_NOW + RTLD_NODELETE
Let's systematically use RTL_NOW|RLTD_NODELETE as flags passed to
dlopen(), across our codebase.

Various distros build with "-z now" anyway, hence it's weird to specify
RTLD_LAZY trying to override that (which it doesn't). Hence, let's
follow suit, and just do what everybody else does.

Also set RTLD_NODELETE, which is apparently what distros will probably
end up implying sooner or later anyway. Given that for pretty much all
our dlopen() calls we never call dlclose() anyway, let's just set this
everywhere too, to make things systematic.

This way, the flags we use by default match what distros such as fedora
do, there are no surprises, and read-only relocations can be a thing.

Fixes: #34537
2024-10-02 07:13:21 +02:00
Ivan Kruglov f1daf9fb74 machine: generalise logic GetMachineAddresses to later use it in varlink interface 2024-10-01 19:00:25 +02:00
Mike Yuan a48c1699eb Merge pull request #34564 from YHNdnzj/systemctl-status-job-id
systemctl: also show job id in status output
2024-09-30 17:39:19 +02:00
Yu Watanabe 82f2c33db5 tpm2-util: show loaded libraries in 'systemd-analyze has-tpm2'
After 3b16e9f419, even the libraries are
documented in the man page, it is useful to mention which libraries are
checked in the command output.

Of course, the dependencies are kind of implementation detail, and may
be changed in the future version, but that's especially why I think
showing the library deps in the output is useful.

systemd-analyze is a debugging tool, and already shows many internal
states. I think there is nothing to prevent from showing the deps.

Prompted by #34477.
2024-09-30 15:40:14 +02:00