summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* io-util: split out "struct iovec" related calls into their own .c/.h filesLennart Poettering2023-10-2055-113/+143
| | | | | | | | | This is preparation for #28891, which adds a bunch more helpers around "struct iovec", at which point this really deserves its own .c/.h file. The idea is that we sooner or later can consider "struct iovec" as an entirely generic mechanism to reference some binary blob, and is the go-to type for this purpose whenever we need one.
* executor: return instead of assert on invalid command line argumentsLuca Boccassi2023-10-201-2/+8
| | | | | | Before the split, it made sense to assert, as checks were on setup. But now these come from deserialization, and the fuzzer hits the asserts, so simply return an error instead.
* test-recurse-dir: work around nftw() ignoring symlinks()Zbigniew Jędrzejewski-Szmek2023-10-191-7/+8
| | | | | | | | | | We have a test where we compare the results from nftw() and our own resurce_dit_at(). nftw() skips a dangling symlink when running under mkosi and the test fails. I don't understand why nftw() does that, but in our code we don't need to test and care about the details of nftw(), which we don't use, outside of the one test, so let's just skip symlinks in the test. Closes #29603.
* Merge pull request #29628 from mrc0mmand/systemd-executor-testLuca Boccassi2023-10-193-1/+88
|\ | | | | test: slightly improve sd-executor's coverage
| * core: properly cleanup ExecParameter's prefix arrayFrantisek Sumsal2023-10-191-1/+7
| |
| * test: add coverage for #29610Frantisek Sumsal2023-10-191-0/+7
| | | | | | | | | | | | | | | | As reproducing it is actually pretty easy, with the benefit of hindsight: ~# systemd-run -P -p MountImages="/this/should/definitely/not/exist.img:/run/img2\:3:nosuid" false Running as unit: run-u42.service free(): double free detected in tcache 2
| * test: add a real-world state to the corpusFrantisek Sumsal2023-10-191-0/+74
| | | | | | | | To give the fuzzer a nice head start.
* | pidref: make PIDREF_NULL constLennart Poettering2023-10-191-1/+1
| | | | | | | | That way compiler can put it in an immutable section
* | Merge pull request #29629 from bluca/mount_tunnel_pidrefLuca Boccassi2023-10-195-13/+17
|\ \ | | | | | | mount tunnel: use PidRef
| * | Update TODOLuca Boccassi2023-10-191-2/+0
| | |
| * | mount tunnel: use PidRefLuca Boccassi2023-10-194-11/+17
| | |
* | | Merge pull request #29623 from YHNdnzj/core-followupLuca Boccassi2023-10-194-30/+20
|\ \ \ | | | | | | | | Follow-ups for recent changes to core/
| * | | core/service: check error first and log about errnoMike Yuan2023-10-191-2/+2
| | | | | | | | | | | | | | | | Follow-up for becdfcb9f1cb555c50dcfe51894cb0b155f7f01e
| * | | cgroup-util: use RET_GATHER more, return first errorMike Yuan2023-10-191-20/+12
| | | |
| * | | core/exec-invoke: use correct exit statusMike Yuan2023-10-191-2/+2
| | | | | | | | | | | | | | | | These calls can fail not only due to OOM.
| * | | core/namespace: merge if blocksMike Yuan2023-10-191-6/+4
| |/ /
* | | test: skip Protect{Home,System}= tests with coverage buildsFrantisek Sumsal2023-10-191-18/+24
| | | | | | | | | | | | | | | | | | | | | With coverage builds we disable Protect{Home,System}= via a service.d dropin in /etc, which has, unfortunately, higher priority than our transient systemd-run stuff. Let's just skip the affected tests in that case instead of making the test setup even more complicated.
* | | pid1,vconsole-setup: lock /dev/console instead of the tty deviceZbigniew Jędrzejewski-Szmek2023-10-194-21/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As requested in https://github.com/systemd/systemd/pull/27867#pullrequestreview-1567161854. /dev/console, /dev/tty0, and /dev/ttyN are "different" device nodes that may point to a single underlying device. We want to use a single lock so that we don't get a race if different writers are using a different device path, so let's just always lock around /dev/console. This effectively makes the locking less granular. Fixup for a0043bfa51281c2374878e2a98cf2a3ee10fd92c. Fixes https://github.com/systemd/systemd/issues/28721. Maybe fixes https://github.com/systemd/systemd/issues/28778 and https://github.com/systemd/systemd/issues/28634.
* | | test: unify checking for user xattrs support in cgroupfsFrantisek Sumsal2023-10-195-23/+33
| | | | | | | | | | | | | | | Also, run the coredump forwarding test only if user xattrs are supported.
* | | meson: generate proper version tag when git fails on permission errorsZbigniew Jędrzejewski-Szmek2023-10-191-5/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with mkosi I would get the following: [1/477] Generating version.h with a custom command fatal: detected dubious ownership in repository at '/work/src' To add an exception for this directory, call: git config --global --add safe.directory /work/src and then the tag would be generated as 'v254-'. This is obviously some problem with the setup, but we should handle this gracefully. Let's fall back to 'v254' instead. In the case where we have a repo but no tags, use --dirty=^ too, as in the case with tags. I tested four cases: - normal checkout - checkout with .git removed - checkout with .git chowned to root - checkout wiht all tags removed
* | executor: fix double free of MountOptionsLuca Boccassi2023-10-191-5/+4
| | | | | | | | | | | | | | | | | | | | This list is owned by ExecContext, which is cleaned up when sd-executor fails, but it is also cleaned up when namespace setup exits, so we get a double free. Fixes https://github.com/systemd/systemd/issues/29610 Follow-up for bb5232b6a3
* | Merge pull request #29617 from keszybz/efi-no-xmalloc0Luca Boccassi2023-10-192-10/+3
|\ \ | | | | | | efi: drop duplicate initialization to 0
| * | efi: drop unused xmalloc0()Zbigniew Jędrzejewski-Szmek2023-10-191-6/+0
| | | | | | | | | | | | Keeping this separate to make it easy to revert if it's ever needed again.
| * | efi: do not memzero fields before initializing themZbigniew Jędrzejewski-Szmek2023-10-191-4/+3
| | | | | | | | | | | | | | | In all three cases we immediately overwrite the whole field anyway, so the call to memzero is not needed.
* | | cgroup-util: drop dead code blockYu Watanabe2023-10-191-7/+0
| | | | | | | | | | | | | | | | | | Follow-up for 4d1b2df199227ed4b934bbcb054364e92e93a1a6. Fixes CID#1522888.
* | | Merge pull request #29595 from YHNdnzj/systemctl-failed-systemLuca Boccassi2023-10-196-21/+49
|\ \ \ | | | | | | | | systemctl: is-failed: check if system is degraded when no unit given
| * | | systemctl: is-failed: check if system is degraded when no unit givenMike Yuan2023-10-184-10/+35
| | | | | | | | | | | | | | | | Closes #3335
| * | | systemctl: minor modernizationMike Yuan2023-10-183-11/+14
| | | |
* | | | varlink: Add new varlink_collect methodArthur Shau2023-10-193-5/+206
| | | | | | | | | | | | | | | | | | | | | | | | varlink_collect is meant to be used when the client is willing to wait for the reply from the varlink method, much like varlink_call. However, unlike varlink_call, it allows the client to collect all "more" replies that may be sent by method before the "final" reply is enqueued. It aggregates all of these replies into a json variant array that it returns to the client.
* | | | fuzz: unify logging setupFrantisek Sumsal2023-10-1943-99/+60
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | Make sure we don't log anything when running in "fuzzing" mode. Also, when at it, unify the setup logic into a helper, pretty similar to the test_setup_logging() one. Addresses: - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607 - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
* | | Merge pull request #29611 from mrc0mmand/execute-serialize-fuzzLuca Boccassi2023-10-198-16/+400
|\ \ \ | |/ / |/| | test: add a fuzzer for exec_{serialize,deserialize}_invocation()
| * | core: don't assert when serializing malformed stateFrantisek Sumsal2023-10-184-16/+28
| | |
| * | test: add a fuzzer for exec_{serialize,deserialize}_invocation()Frantisek Sumsal2023-10-184-0/+372
|/ /
* | Merge pull request #29594 from poettering/cgroup-rename-ret-paramsLennart Poettering2023-10-1849-424/+710
|\ \ | | | | | | more pidfdification
| * | update TODOLennart Poettering2023-10-181-7/+7
| | |
| * | test-cgroup: make test case a bit more robust towards previous aborted runsLennart Poettering2023-10-181-0/+4
| | |
| * | killall: port killing spree loop over to PidRefLennart Poettering2023-10-182-46/+47
| | |
| * | test: port tests over to new /proc/ enumeration APILennart Poettering2023-10-182-25/+24
| | |
| * | process-util: add API for enumerating processes in /proc/ and pinning them ↵Lennart Poettering2023-10-182-0/+73
| | | | | | | | | | | | via PidRef
| * | process-util: add pidref_is_unwaited() and make pid_is_unwaited() return errorsLennart Poettering2023-10-1810-15/+34
| | |
| * | process-util: add pidref_is_my_child()Lennart Poettering2023-10-184-3/+29
| | |
| * | process-util: change pid_is_alive() to not eat up errors, and add ↵Lennart Poettering2023-10-186-26/+52
| | | | | | | | | | | | | | | | | | pidref_is_alive() Let's no eat up errors, but propagate unexpected ones.
| * | process-util: add pidref_get_uid() and rename get_process_uid() → ↵Lennart Poettering2023-10-186-6/+28
| | | | | | | | | | | | pidref_get_uid()
| * | core: port unit/process kill logic to pidrefLennart Poettering2023-10-185-33/+44
| | |
| * | pidref: add new pidref_is_self() helperLennart Poettering2023-10-185-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | This simply checks if the specified PidRef refers to the process we are running in. (In case you wonder why this is not a static inline: to avoid cyclic header inclusion problems between pidref.h + process-util.h)
| * | process-util: add pidref_get_comm() and rename get_process_comm() to ↵Lennart Poettering2023-10-1828-60/+81
| | | | | | | | | | | | pid_get_comm()
| * | dbus-unit: make sure GetProcesses() D-Bus call internally uses pidfdLennart Poettering2023-10-181-15/+21
| | | | | | | | | | | | | | | This way we can be sure to provide an atomic view of the process tree of a unit.
| * | process-util: add pidref_is_kernel_thread()Lennart Poettering2023-10-1810-10/+28
| | |
| * | process-util: add pidref_get_cmdline()Lennart Poettering2023-10-1810-89/+136
| | |
| * | cgroup-show: use size_t for array sizesLennart Poettering2023-10-182-6/+6
| | |