summaryrefslogtreecommitdiff
path: root/src/basic
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #27659 from yuwata/memfd-sealMike Yuan2023-05-162-2/+17
|\ | | | | memfd-util: handle F_SEAL_EXEC flag
| * memfd-util: set F_SEAL_EXEC flag if supportedYu Watanabe2023-05-161-1/+7
| |
| * memfd-util: memfd may also have F_SEAL_EXEC flagYu Watanabe2023-05-161-1/+2
| | | | | | | | | | | | Follow-up for c29715a8f77d96cd731b4a3083b3a852b3b61eb8. Fixes #27608.
| * missing: add more F_SEAL_XYZ flagsYu Watanabe2023-05-161-0/+8
| |
* | unit-file: support UpheldBy= in [Install] settings (adding Upholds= depsMike Yuan2023-05-151-2/+3
|/ | | | | | from .upholds/) Closes #26896
* Merge pull request #27565 from yuwata/static-destructDaan De Meyer2023-05-122-29/+71
|\ | | | | static-destruct: support clearing array on exit
| * static-destruct: introduce STATIC_ARRAY_DESTRUCTOR_REGISTER()Yu Watanabe2023-05-091-4/+46
| |
| * static-destruct: several cleanupsYu Watanabe2023-05-091-21/+21
| | | | | | | | No functional changes, preparation for later commits.
| * memory-util: make ArrayCleanup passed to array_cleanup() constYu Watanabe2023-05-091-4/+4
| | | | | | | | Should not change any behavior, preparation for later commits.
* | tree-wide: drop _pure_ attribute from non-pure functionsYu Watanabe2023-05-101-1/+1
| | | | | | | | | | Prompted by #27595. Follow-ups for 6723c28f36ea566faf61d3610012cd89f95ee4a0.
* | dirent: conditionalize dirent assert based on dirent64 existenceSam James2023-05-101-0/+2
|/ | | | | | | | | | >=musl-1.2.4 doesn't define dirent64 and its LFS friends as its "native" functions are already LFS-aware. Check for dirent64 in meson.build and only assert if it exists. Bug: https://bugs.gentoo.org/905900 Closes: https://github.com/systemd/systemd/pull/25809
* nulstr-util: make ret_size in strv_make_nulstr() optionalYu Watanabe2023-05-081-3/+2
|
* parse-util: make parse_fd() return -EBADFYu Watanabe2023-05-081-1/+1
| | | | | | | | The previous error code -ERANGE is slightly ambiguous, and use more specific one. This also drops unnecessary error handlings. Follow-up for 754d8b9c330150fdb3767491e24975f7dfe2a203 and e652663a043cb80936bb12ad5c87766fc5150c24.
* basic/audit-util: make a test request before enabling use of auditNick Rosbrook2023-05-051-1/+60
| | | | | | | | | | | | | | | | | | If a container manager does not follow the guidance in https://systemd.io/CONTAINER_INTERFACE/ regarding audit capabilities, then the current check may not be sufficient to determine that audit will function properly. In particular, when calling bind() on the audit fd, we will get EPERM if running in a user-namespaced container. Expand the check to make an AUDIT_GET_FEATURE request on the audit fd to test if it is working. If this fails with ECONNREFUSED, we know it is because the kernel does not support the use of audit outside of the initial user namespace. Note that the approach of this patch was suggested here: https://github.com/systemd/systemd/pull/19443#issuecomment-829566659 Fixes: #6519
* tree-wide: use parse_fd()David Tardon2023-05-051-1/+2
|
* fd-util: introduce parse_fd()David Tardon2023-05-052-0/+16
| | | | | It's a simple wrapper for safe_atoi() that returns error if the parsed fd is < 0 .
* missing_fs: also define struct file_clone_rangeYu Watanabe2023-04-291-0/+6
| | | | | | Follow-up for b640e274a7c363a2b6394c9dce5671d9404d2e2a. Addresses https://github.com/systemd/systemd/commit/b640e274a7c363a2b6394c9dce5671d9404d2e2a#r110996661.
* Merge pull request #27440 from yuwata/reflink-follow-upsLuca Boccassi2023-04-281-3/+3
|\ | | | | copy: follow ups for reflink()
| * missing_fs: mention commit hash and version of ioctl commands introducedYu Watanabe2023-04-281-3/+3
| |
* | Merge pull request #27424 from dtardon/auto-cleanupYu Watanabe2023-04-282-45/+36
|\ \ | |/ |/| More automatic cleanup
| * path-util: use _cleanup_David Tardon2023-04-271-5/+3
| |
| * env-util: use more _cleanup_ in replace_env_argv()David Tardon2023-04-271-5/+4
| |
| * env-util: use _cleanup_ in replace_env_argv()David Tardon2023-04-271-7/+3
| |
| * env-util: rename variableDavid Tardon2023-04-271-26/+26
| |
| * env-util: use _cleanup_ in strv_env_delete()David Tardon2023-04-271-5/+3
| |
* | copy: Introduce reflink() and reflink_full()Daan De Meyer2023-04-281-0/+8
| | | | | | | | | | | | The kernel has had filesystem independent reflink ioctls for a while now, let's try to use them and fall back to the btrfs specific ones if they're not supported.
* | cgroup: rework how we validate/escape cgroupsLennart Poettering2023-04-272-45/+57
| | | | | | | | | | | | Let's clean up validation/escaping of cgroup names. i.e. split out code that tests if name needs escaping. Return proper error codes, and extend test a bit.
* | coredump filter: fix stack overflow with =allLuca Boccassi2023-04-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | We translate 'all' to UNIT64_MAX, which has a lot more 'f's. Use the helper macro, since a decimal uint64_t will always be >> than a hex representation. root@image:~# systemd-run -t --property CoredumpFilter=all ls /tmp Running as unit: run-u13.service Press ^] three times within 1s to disconnect TTY. *** stack smashing detected ***: terminated [137256.320511] systemd[1]: run-u13.service: Main process exited, code=dumped, status=6/ABRT [137256.320850] systemd[1]: run-u13.service: Failed with result 'core-dump'.
* | Merge pull request #26944 from ↵Zbigniew Jędrzejewski-Szmek2023-04-261-1/+1
|\ \ | | | | | | | | | | | | aafeijoo-suse/systemd-network-generator-initrd-fix network-generator: do not parse kernel command line more than once
| * | fs-util: fix typo in commentAntonio Alvarez Feijoo2023-03-241-1/+1
| | |
* | | Merge pull request #27347 from bluca/sd_bus_nonceLennart Poettering2023-04-251-0/+36
|\ \ \ | | | | | | | | sd: avoid closing sd-bus in a fork, store module-global id for sd-bus/sd-session/sd-journal
| * | | macro: add helper for module origin idLuca Boccassi2023-04-251-0/+36
| | | | | | | | | | | | | | | | | | | | These need to be redefined in every module that we need to guard, so add a macro
* | | | mountpoint-util: make path_get_mnt_id_at() work with a NULL pathLennart Poettering2023-04-251-3/+2
| | | |
* | | | fs-util: make sure open_mkdir_at() does something roughly sensible when ↵Lennart Poettering2023-04-251-13/+7
| | | | | | | | | | | | | | | | invoked with '/'
* | | | Merge pull request #27388 from poettering/assert-fdLennart Poettering2023-04-251-0/+8
|\ \ \ \ | |/ / / |/| | | add ASSERT_FD() similar to ASSERT_PTR(), but for fds
| * | | fd-util: add ASSERT_FD() that is similar to ASSERT_PTR() but for fdsLennart Poettering2023-04-241-0/+8
| | |/ | |/|
* | | Merge pull request #27113 from keszybz/variable-expansion-reworkZbigniew Jędrzejewski-Szmek2023-04-241-53/+0
|\ \ \ | | | | | | | | Rework serialization of command lines in pid1 and make run not expand variables
| * | | basic/logarithm: add popcount() wrapperZbigniew Jędrzejewski-Szmek2023-04-241-53/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __builtin_popcount() is a bit of a mouthful, so let's provide a helper. Using _Generic has the advantage that if a type other then the ones on the list is given, compilation will fail. This is nice, because if by any change we pass a wider type, it is rejected immediately instead of being truncated. log.h is also needed. It is included transitively, but let's include it directly. macro.h is *not* needed.
* | | | parse-util: allow parse_pid() to work with NULL return parameterLennart Poettering2023-04-251-2/+2
| |/ / |/| | | | | | | | | | | That way the function becomes useful for validating pids formatted as strings.
* | | Merge pull request #27349 from mrc0mmand/codespellLuca Boccassi2023-04-202-3/+3
|\ \ \ | | | | | | | | tree-wide: code spelling fixes
| * | | tree-wide: code spelling fixesFrantisek Sumsal2023-04-202-3/+3
| | | | | | | | | | | | | | | | As reported by Fossies.
* | | | detect-virt: add message at debug levelZbigniew Jędrzejewski-Szmek2023-04-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normal users do not have permissions to access /proc/1/root, so 'systemd-detect-virt -r' fails, but the output, even at debug level is cryptic: $ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r Failed to check for chroot() environment: Permission denied Let's make this a bit easier to figure out: $ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r Cannot stat /proc/1/root: Permission denied Failed to check for chroot() environment: Permission denied I looked over other users of files_same(), and I think in general the message at debug level is OK for them too.
* | | | Merge pull request #27327 from DaanDeMeyer/hotplugLennart Poettering2023-04-204-14/+43
|\ \ \ \ | | | | | | | | | | kmod-setup: Add early loading for virtio_console
| * | | | string-util: Add startswith_strv()Daan De Meyer2023-04-203-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the function version of STARTSWITH_SET(). We also move STARTSWITH_SET() to string-util.h as it fits more there than in strv.h and reimplement it using startswith_strv().
| * | | | log: Log when kmsg is being ratelimitedDaan De Meyer2023-04-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's avoid confusing developers and users when log messages suddenly stop getting logged to kmsg because of ratelimiting by logging an additional message if we start ratelimiting log messages to kmsg.
| * | | | log: Add knob to disable kmsg ratelimitingDaan De Meyer2023-04-201-1/+21
| |/ / / | | | | | | | | | | | | | | | | This allows us to disable kmsg ratelimiting in the integration tests and mkosi for easier debugging.
* | | | ratelimit: handle counter overflows somewhat sanelyLennart Poettering2023-04-201-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | An overflow here (i.e. the counter reaching 2^32 within a ratelimit time window) is not so unlikely. Let's handle this somewhat sanely and simply stop counting, while remaining in the "limit is hit" state until the time window has passed.
* | | | list: fix double evaluationYu Watanabe2023-04-201-3/+6
| | | |
* | | | chase: replace path_prefix_root_cwd() with chaseat_prefix_root()Yu Watanabe2023-04-195-31/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function path_prefix_root_cwd() was introduced for prefixing the result from chaseat() with root, but - it is named slightly generic, - the logic is different from what chase() does. This makes the name more explanative and specific for the result of the chaseat(), and make the logic consistent with chase(). Fixes https://github.com/systemd/systemd/pull/27199#issuecomment-1511387731. Follow-up for #27199.
* | | | fd-util: skip to check mount ID if kernel is too old and /proc is not mountedYu Watanabe2023-04-191-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, dir_fd_is_root() is heavily used in chaseat(), which is used at various places. If the kernel is too old and /proc is not mounted, then there is no way to get the mount ID of a directory. In that case, let's silently skip the mount ID check. Fixes https://github.com/systemd/systemd/pull/27299#issuecomment-1511403680.