summaryrefslogtreecommitdiffstats
path: root/src/hibernate-resume (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-10-31coredump: make check that all argv[] meta data fields are passed strictLennart Poettering1-3/+4
Otherwise, if some field is not supplied we might end up parsing a NULL string later. Let's catch that early.
2024-10-31coredump: use memory_startswith() when looking at a data blobLennart Poettering1-1/+1
2024-10-31iovw: normalize destructorsLennart Poettering2-17/+15
instead of passing a boolean picking the destruction method just have different functions. That's much nicer in context of _cleanup_, and how we usually do things.
2024-10-31iovw: add simpler iovw_done() destructorLennart Poettering2-2/+6
2024-10-31coredump: move to _cleanup_ for destroying iovw objectLennart Poettering2-43/+25
2024-10-31coredump: parse rlimit field at same place as other fieldsLennart Poettering1-7/+8
2024-10-31coredump: parse signal number at the same time as parsing other fieldsLennart Poettering3-31/+40
2024-10-31coredump: rename save_context() → context_parse_iovw()Lennart Poettering1-6/+6
The function doesn't "save" anything, it just parses iovw into the individual fields, hence name the function accordingly.
2024-10-31coredump: acquire some process fields via pidrefLennart Poettering1-3/+3
Use pidref to acquire some fields. This just makes use of the pidref helpers we already have. We acquire a lot of other data via classic pids still, but for that we first have to write race-free pidref getters, hence leave that for another time.
2024-10-31coredump: rework protocol between coredump pattern handler and processing ↵Lennart Poettering1-77/+124
service In 68511cebe58977ea68ae4f57c6462e979efd1cff the ability to pass the coredump's mount namespace fd from the coredump patter handler was added to systemd-coredump. For this the protocol was augmented, in attempt to provide both forward and backward compatibility. The protocol as of v256: one or more datagrams with journal log fields about the coredump are sent via an SOCK_SEQPACKET connection. It is finished with a zero length datagram which carries the coredump fd (this last datagram is called "sentinel" sometimes). The protocol after 68511cebe58977ea68ae4f57c6462e979efd1cff is extended so that after the sentinal a 2nd sentinel is sent, with a pair of fds: the coredump fd *again* and a mount fd (acquired via open_tree()) of the container's mount tree. It's a bit ugly to send the coredump fd a 2nd time, but what's more important the implementation didn't work: since on SOCK_SEQPACKET a zero sized datagram cannot be distinguished from EOF (which is a Linux API design mistake), an early EOF would be misunderstood as a zero size datagram lacking any fd, which resulted in protocol termination. Moreover, I think if we touch the protocol we should make the move to pidfs at the same time. All of the above is what this protocol rework addresses. 1. A pidfd is now sent as well 2. The protocol is now payload, followed by the coredump fd datagram (as before). But now followed by a second empty datagram with a pidfd, and a third empty datagram with the mount tree fd. Of this the latter two or last are optional. Thus, it's now a stream of payload datagrams with one, two or three fd-laden datagrams as sentinel. If we read the 2nd or 3rd sentinel without an attached fd we assume this is actually an EOF (whether it actually is one or not doesn't matter here). This should provide nice up and down compatibility. 3. The mount_tree_fd is moved into the Context object. The pidfd is placed there too, as a PidRef. Thus the data we pass around is now the coredump fd plus the context, which is simpler and makes a lot more semantical sense I think. 4. The "first" boolean is replaced by an explicit state engine enum Fixes: #34130
2024-10-31coredump: correct debug log messageLennart Poettering1-1/+1
2024-10-31coredump: minor modernizationsLennart Poettering1-10/+17
2024-10-31coredump: rename pid → leader_pidLennart Poettering1-6/+6
Let's rename this local variable, since we are not operating on the coredump process here after all, but on the leader of the namespace the coredump process in, which is quite different, hence let's make this very clear via the name.
2024-10-31update TODOLennart Poettering1-0/+10
2024-10-31sd-varlink: suppress one log message when callback already successfully ↵Yu Watanabe1-7/+5
enqueued an error response Follow-up for d2ebf5cc1d59e29139f06efaa3a9b2c184cdaa25. The detailed error response is already logged, hence not necessary to log again with the errno converted from the error response, which typically less informative, e.g. === varlink-26-26: Setting state idle-server varlink-26-26: Received message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"service":""}} varlink-26-26: Changing state idle-server → processing-method varlink-26-26: Sending message: {"error":"io.systemd.UserDatabase.BadService","parameters":{}} varlink-26-26: Changing state processing-method → processed-method varlink-26-26: Callback for io.systemd.UserDatabase.GetUserRecord returned error: Invalid request descriptor varlink-26-26: Changing state processed-method → idle-server varlink-26-26: Got POLLHUP from socket. ===
2024-10-31meson: add separate option for sysupdated, disable in release buildsZbigniew Jędrzejewski-Szmek8-13/+32
This commit introduces a build-time option to enable/disable sysupdated separately from sysupdate. 'auto' translated to enabled by default in developer builds.
2024-10-31sd-json: don't accidentally convert between unsigned/signed when parsing signalLennart Poettering1-4/+3
2024-10-31posix_spawn_wrapper: do not set POSIX_SPAWN_SETSIGDEF flagMike Gilbert1-1/+1
Setting this flag is a noop without a corresponding call to posix_spawnattr_setsigdefault. If we call posix_spawnattr_setsigdefault with a full signal set, it causes glibc's posix_spawn implementation to call sigaction 63 times, once for each signal. That seems wasteful. This feature is really only useful for signals which have their disposition set to SIG_IGN. Otherwise the dispostion gets set to SIG_DFL automatically, either by clone(CLONE_CLEAR_SIGHAND) or the subsequent execve. As far as I can tell, systemd does not have any signals set to SIG_IGN under normal operating conditions.
2024-10-31bus-common-errors: use more appropriate errno for ↵Mike Yuan1-2/+1
BUS_ERROR_DESIGNATED_MAINTENANCE_TIME_NOT_SCHEDULED Fixes #33429
2024-10-31systemctl: don't fall back to immediate shutdown silently if we cannot ↵Mike Yuan1-6/+9
schedule one The previous behavior of systemctl --when= seems absurd, i.e. if we fail to schedule shutdown in the future it's performed immediately. Let's instead hard fail, which also removes the need of specializing on certain errnos (preparation for later commits).
2024-10-31logind-dbus: return appropriate errno for unexpected errorsMike Yuan1-5/+5
Follow-up for 0e10c3d8724b0a5d07871c9de71565ac91dd55b7
2024-10-31systemctl: use the retval of must_be_root()Mike Yuan1-4/+3
2024-10-31boot: stop appending NUL to .sdmagic and .sbat sectionsZbigniew Jędrzejewski-Szmek2-3/+2
Those text sections had a trailing NUL byte. It's debatable whether this is a good idea or not. Correctly written consumers will look at the section size so they wouldn't need this. Shim doesn't use a trailing NUL, so let's follow suit. Fixes https://github.com/systemd/systemd/issues/33731. 898e9edc469f87fdb6018128bac29eef0a5fe698 reworked this code, but didn't actually change the logic. We have always been appending the trailing zero by using a NUL-terminated string as the section contents. (I checked this with v253.18 from before the elf2efi rework.) .sdmagic contains a string like "#### LoaderInfo: systemd-boot 257~devel ####", which changes with each version, so previous versions would compare unequal anyway, so we don't need to worry about backwards compatibility.
2024-10-31mkosi: Install gdb in centos/fedora build imageDaan De Meyer1-0/+1
Lack of gdb-add-index has become a fatal error in Rawhide/c10s so let's install gdb to make rpmbuild happy.
2024-10-31resolve: do not try to send varlink error more than onceYu Watanabe1-70/+36
After d2ebf5cc1d59e29139f06efaa3a9b2c184cdaa25, sd_varlink_error() and friends return negative errno. Fixes https://github.com/systemd/systemd/pull/34946#discussion_r1823703636.
2024-10-31machine: lookup_machine_by_name_or_pidref() returns negative errno on failureYu Watanabe2-5/+3
This effectively reverts d2c1451b7398f13439b694450a23def3cf31c8db. After the commit d2ebf5cc1d59e29139f06efaa3a9b2c184cdaa25, sd_varlink_error() returns negative errno, hence the function always return negative errno on failure.
2024-10-31machine: use JSON_BUILD_PAIR_STRV_ENV_PAIR_NON_EMPTY()Yu Watanabe1-4/+4
Also use JSON_BUILD_PAIR_UNSIGNED_NOT_EQUAL().
2024-10-31sd-json: introduce JSON_BUILD_PAIR_STRV_ENV_PAIR_NON_EMPTY() macroYu Watanabe2-2/+13
It is similar to JSON_BUILD_PAIR_STRV_NON_EMPTY, but takes the list of environment variables.
2024-10-31sd-json: use strv_env_get_merged()Yu Watanabe1-12/+4
2024-10-31env-util: introduce strv_env_get_merged()Yu Watanabe3-0/+40
2024-10-31env-util: replace 'char **' with 'char**'Yu Watanabe2-4/+4
2024-10-31TEST-13-NSPAWN: add test cases for listing multiple machinesYu Watanabe1-1/+17
2024-10-31TEST-13-NSPAWN: trivially kill all processes in the container on terminationYu Watanabe1-4/+4
Follow-up for 841988f80d2440501a3baddba712cdb955225ab7. No functional change, as $PID is 0 when the trap is inserted.
2024-10-31TEST-13-NSPAWN: check returned machine listYu Watanabe1-1/+15
2024-10-31TEST-13-NSPAWN: fix race between container exit and varlink callYu Watanabe1-0/+19
Follow-up for 3cb72c7862d8950bc2a963aaa3ca3255eea374b6. The test container exits shortly, hence when varlinkctl is called, the container may be already terminated. Let's make the container live infinitely. Also, this makes the os-release files removed after the container is started.
2024-10-31machined: ACQUIRE_METADATA_NO is zeroYu Watanabe1-2/+1
Follow-ups for a94fbcaa35dc63f32fbf86d25f63f6ac40a0d8b0 and 9de215219c8783e3239af27baf62275730ab51a8.
2024-10-31machine: use sd_json_variant_append_arraybo() and ↵Yu Watanabe1-24/+17
JSON_BUILD_PAIR_VARIANT_NON_NULL() Follow-up for 45755275e5ae747bf79e6c7bdd9a055711ebc71f.
2024-10-31NEWS: fix typoYu Watanabe1-6/+6
2024-10-31sd-varlink: update commentYu Watanabe2-2/+2
2024-10-31sd-varlink: change sd_varlink_error() to always return an errorLennart Poettering2-13/+35
Let's make sure that sd_varlink_error() always returns an error code, so that we can use it in a style "return sd_varlink_error(…);" everywhere, which has two effects: return a good error reply to clients, and exit the current stack frame with a failure code. Interestingly sd_varlink_error_invalid_parameter() already worked like this in some cases, but sd_varlink_error() itself didn't. This is an alternative to the error handling tweak proposed in #34882, but I think is a lot more generically useful, since it establishes a pattern. I checked our codebase, and this change should generally be OK without breaking callsites, since the current callers (with exception of the machined case from #34882) called sd_varlink_error() in the outermost varlink method call dispatch stack frame, where this behaviour change does not alter anything. This is similar btw, how sd_bus_error_setf() and friends always return error codes too, synthesized from its parameters.
2024-10-31sd-varlink: add helper VARLINK_STATE_WANTS_REPLY()Lennart Poettering2-4/+12
Let's add a helper that detects whether we still need to reply to a state. This should make the logic easier to follow.
2024-10-31sd-varlink: don't show error code we already decoded as part of the log messageLennart Poettering1-1/+1
2024-10-31sd-varlink: if we reply to errors without passing to callback, go through ↵Lennart Poettering1-4/+4
regular error path If replying with an error fails, we should failt the whole connection, and not leave the connection in a weird state.
2024-10-30sd-json: don't use C99 bool in public headersLennart Poettering2-3/+1
All our public headers strive to C90 compatibility with a few extensions, and thus avoided stdbool.h and bool. The sd_json_format_enabled() helper seems like a poor place to start requiring stdbool.h now. Also drop __extension__ since we are not using it anywhere else in very similar inline functions. (And we probably should drop any _sd_const declarations on inline functions. Given that the compiler has the function implementation around always, because it's in the header there's really no reason to specify this manually, the compiler can trivially figure this out on its own. But that's for another time.)
2024-10-30man: update documentation for 'networkctl reload'Yu Watanabe1-7/+16
2024-10-30test-network: test for reload of .netdev file of stacked netdevYu Watanabe1-10/+214
For issue #9627, #27177, and #34907.
2024-10-30network/netdev: replace old NetDev object with newer one on reloadYu Watanabe3-2/+80
Then, when a .netdev file of a stacked netdev is modified, the netdev can be reconfigured with the updated setting by something like the following way: ``` ip link del vlan99 networkctl reload ``` Note, removing the vlan interface in the above example may not be necessary, e.g. when only VLAN flags, egress mapping, or ingress mapping are updated. But, it is necessary when VLAN ID is updated. Closes #9627. Closes #27177. Closes #34907. Replaces #22557.
2024-10-30network/netdev: reconfigure netdev if possibleYu Watanabe1-8/+5
Some netdev configs can be modified after the interface is created. Let's allow to reconfigure existing interfaces.
2024-10-30network/netdev: move calls of netdev_attach() and netdev_request_to_create() ↵Yu Watanabe3-22/+24
to netdev_load() No functional change, preparation for later commits.
2024-10-30mkosi: Ensure we build with debuginfoDaan De Meyer4-4/+4