Luca Boccassi
e5cd8bc060
Merge pull request #29601 from yuwata/mmap-check-overflow
...
mmap: check offset and size more carefully
2023-10-24 12:20:04 +01:00
Zbigniew Jędrzejewski-Szmek
1dd33bf3e4
basic/iovec-util: use FOREACH_ARRAY in one more place
2023-10-23 22:30:37 +02:00
Zbigniew Jędrzejewski-Szmek
3c9783c7f4
basic/iovec-util: drop TAKE_IOVEC
...
As suggested in
https://github.com/systemd/systemd/pull/29679#discussion_r1368678932 .
2023-10-23 22:23:13 +02:00
Zbigniew Jędrzejewski-Szmek
7dc951ef91
basic/iovec-util: drop IOVEC_NULL
...
The macro isn't very useful, we can just use the direct setting to increase
readability.
2023-10-23 15:04:08 +02:00
Zbigniew Jędrzejewski-Szmek
1ca0b482b6
basic/iovec-util: always call the iovec "iovec"
...
We were using "i", "iov", and "iovec" in variuos places. Let's be
consistent.
2023-10-23 15:04:08 +02:00
Lennart Poettering
24aeaf4e7f
glyph-util: add 'full block' glyph
2023-10-23 11:24:35 +01:00
Lennart Poettering
4c4de97db8
sort-utils: add generic uint16_t comparison call
2023-10-20 15:57:58 +01:00
Luca Boccassi
055ca3cd0a
Merge pull request #29644 from poettering/json-iovec
...
add iovec/base64 json helpers and other iovec tweaks
2023-10-20 15:54:29 +01:00
Daan De Meyer
26204e1a4a
Merge pull request #29630 from DaanDeMeyer/manager-json
...
Various refactoring in preparation for adding JSON dump to pid 1
2023-10-20 16:42:12 +02:00
Luca Boccassi
f455365031
Merge pull request #29626 from bluca/auto_soft_reboot
...
systemctl: automatically softreboot/kexec if set up on reboot
2023-10-20 13:46:46 +01:00
Lennart Poettering
3a856171c2
iovec-util: add some useful helpers for dealing with iovecs that refer to dynamic memory
2023-10-20 14:38:16 +02:00
Daan De Meyer
b2e9d80956
hashmap: Add extra uncounted entry to returned array from hashmap_dump_sorted()
...
This allows using the returned array as a strv.
2023-10-20 14:09:32 +02:00
Daan De Meyer
1b17dd9099
Add unit_type_to_capitalized_string()
2023-10-20 13:30:11 +02:00
Luca Boccassi
beea591742
Merge pull request #29627 from poettering/io-split
...
split up io-util.[ch], and some clean-ups
2023-10-20 12:19:22 +01:00
Luca Boccassi
665a3d6d15
systemctl: automatically softreboot/kexec if set up on reboot
...
Automatically softreboot if the nextroot has been set up with an OS
tree, or automatically kexec if a kernel has been loaded with kexec
--load.
Add SYSTEMCTL_SKIP_AUTO_KEXEC and SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT to
skip the automated switchover.
2023-10-20 11:45:37 +01:00
Luca Boccassi
ed51ccf4b8
Merge pull request #29618 from bonktree/fchmodat2
...
seccomp: get `fchmodat2(2)` covered by `RestrictSUIDSGID=`
2023-10-20 10:49:46 +01:00
Lennart Poettering
ea1f38146a
io-util: split out iovw_xyz into iovec-wrapper.h
...
Let's split these APIs out, they are kinda their own thing.
2023-10-20 10:43:50 +02:00
Lennart Poettering
986235a99a
iovec-util: make IOVEC_INCREMENT a regular function too
...
Even more than with the previous commit, this is not a trivial function
and there's no reason to believe this will actually be inlined nor that
it would be beneficial.
2023-10-20 10:43:50 +02:00
Lennart Poettering
9599ea28b4
iovec-util: make IOVEC_MAKE_STRING() safer
...
Let's not accept arbitrary types, but only char* and const char*.
2023-10-20 10:43:50 +02:00
Lennart Poettering
e2a3bb22c8
iovec-util: make IOVEC_NULL const
...
compound initialized structs can be placed im immutable memory if const,
hence there's benefit in making this one const too
2023-10-20 10:43:50 +02:00
Lennart Poettering
c24e0dbea1
iovec-util: make IOVEC_TOTAL_SIZE() a regular function
...
The function isn't necessarily fast (it's O(n)), and there's no reason
to have it defined as inline function, since it's neither fast, nor
entirely trivial.
2023-10-20 10:43:50 +02:00
Lennart Poettering
bd1ae17833
io-util: split out "struct iovec" related calls into their own .c/.h files
...
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.
2023-10-20 10:34:33 +02:00
Lennart Poettering
9bb64f1b8d
pidref: make PIDREF_NULL const
...
That way compiler can put it in an immutable section
2023-10-19 18:59:51 +01:00
Mike Yuan
f65a40fb0b
cgroup-util: use RET_GATHER more, return first error
2023-10-19 21:37:33 +08:00
Yu Watanabe
be3b6b6fe5
cgroup-util: drop dead code block
...
Follow-up for 4d1b2df199 .
Fixes CID#1522888.
2023-10-19 20:24:54 +08:00
Arseny Maslennikov
3677364cc3
basic/missing_syscall: generate defs for fchmodat2(2)
...
We will need this to set seccomp filters on this system call regardless
of libseccomp or kernel support.
2023-10-19 14:07:54 +03:00
Arseny Maslennikov
c83f838193
Update system call tables for Linux 6.6
...
We are doing this to obtain the definition of fchmodat2.
2023-10-19 14:07:54 +03:00
Yu Watanabe
cbdac0c33a
tree-wide: check results of PAGE_ALIGN()
...
Fixes CID#1491282, CID#1491283, CID#1491285, CID#1491288.
2023-10-19 18:31:44 +09:00
Yu Watanabe
ffee7b97e3
macro: introduce u64_multiply_safe() to avoid overflow
...
Just a paranoia.
2023-10-19 18:31:44 +09:00
Yu Watanabe
2977904cad
macro: introduce several helper functions for alignment
...
Some of them are not used in this commit, but will be used later.
2023-10-19 18:31:44 +09:00
Yu Watanabe
86cbbc6d05
tree-wide: check if return value of lseek() and friends is negative
...
We usually check return value of syscalls or glibc functions by it is
negative or not, something like that `if (stat(path, &st) < 0)`.
Let's also use the same style for lseek() and friends even the type of
their return value is off_t.
Note, fseeko() returns int, instead of off_t.
2023-10-19 18:31:44 +09:00
Lennart Poettering
81c1c387fe
Merge pull request #29594 from poettering/cgroup-rename-ret-params
...
more pidfdification
2023-10-18 17:25:44 +02:00
Lennart Poettering
2d79017564
killall: port killing spree loop over to PidRef
2023-10-18 14:49:40 +02:00
Lennart Poettering
eefb7d22ce
process-util: add API for enumerating processes in /proc/ and pinning them via PidRef
2023-10-18 14:49:40 +02:00
Lennart Poettering
4d9f092b5e
process-util: add pidref_is_unwaited() and make pid_is_unwaited() return errors
2023-10-18 14:49:40 +02:00
Lennart Poettering
6774be4206
process-util: add pidref_is_my_child()
2023-10-18 14:49:40 +02:00
Lennart Poettering
becdfcb9f1
process-util: change pid_is_alive() to not eat up errors, and add pidref_is_alive()
...
Let's no eat up errors, but propagate unexpected ones.
2023-10-18 14:40:25 +02:00
Lennart Poettering
8b51341545
process-util: add pidref_get_uid() and rename get_process_uid() → pidref_get_uid()
2023-10-18 14:39:33 +02:00
Lennart Poettering
4d1b2df199
core: port unit/process kill logic to pidref
2023-10-18 14:39:33 +02:00
Lennart Poettering
a7a877697f
pidref: add new pidref_is_self() helper
...
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)
2023-10-18 14:39:33 +02:00
Lennart Poettering
d7d748548b
process-util: add pidref_get_comm() and rename get_process_comm() to pid_get_comm()
2023-10-18 14:39:33 +02:00
Lennart Poettering
fc87713bed
process-util: add pidref_is_kernel_thread()
2023-10-18 14:39:33 +02:00
Lennart Poettering
a034620f1a
process-util: add pidref_get_cmdline()
2023-10-18 14:39:33 +02:00
Lennart Poettering
3d7ba61a7b
pidref: we never have to verify PID 1
...
The process exists as long as the kernel/userns exists at all, hence we
don't have to verify a pidfd to it.
2023-10-18 14:39:33 +02:00
Lennart Poettering
f2a2e60be6
cgroup-util: make cg_pidref_get_path() PidRef parameter const
2023-10-18 14:39:33 +02:00
Lennart Poettering
44c55e5a3f
pidref: make signal sending calls take const PidRef
2023-10-18 14:38:07 +02:00
Lennart Poettering
cf45db5598
fd-util: use close_many() where appropriate
2023-10-18 14:03:47 +02:00
Lennart Poettering
d3eb74f8f8
fd-util: add new helper close_many_unset()
2023-10-18 14:03:36 +02:00
Lennart Poettering
3b444970e6
serialize: add serialize_fd_many() helper
2023-10-18 13:51:02 +02:00
Lennart Poettering
bd389293f0
pidref: make pidref_verify() parameter const
2023-10-18 10:32:03 +02:00