Lennart Poettering
6cbb864d37
Merge pull request #26443 from poettering/mempool-fixes
...
mempool tweaks
2023-02-17 17:15:35 +01:00
Lennart Poettering
c144696e12
tests: add test for mempool logic
2023-02-17 15:05:13 +01:00
Lennart Poettering
a2b052b29f
mempool: rework mempool_cleanup() to only release freed tiles
...
This substantially reworks mempool_cleanup() so that it releases pools
with all freed tiles only, but keeps all pools with still-allocated
tiles around.
This is more correct, as the previous implementation just released all
pools regardless if anything was still used or not. This would make
valgrind shut up but would just hide memory leaks altogether. Moreover
if called during regular runtime of a program would result in bad memory
accesses all over.
Hence, let's add a proper implementation and only trim pools we really
know are empty.
This way we can safely call these functions later, when under memory
pressure, at any time.
2023-02-17 15:03:53 +01:00
Lennart Poettering
4392b983b8
mempool: make mempool_free_tile() return NULL
...
To match how we usually do this current allocation code.
(Also, make it accept a NULL pointer, also in order to match behaviour
in the rest of our codebase)
2023-02-17 15:03:10 +01:00
Lennart Poettering
72381db942
mempool: introduce new helper pool_ptr()
...
This new helper returns the beginning of the usable area of the pool
object.
For now this is only used once, a later commit will use it more.
2023-02-17 15:02:18 +01:00
Dan Streetman
e8858f1104
tpm2: simplify tpm2_seal() blob creation
...
TPM2 marshalling will never increase the total size, only possibly decrease.
There is no need for checking for insufficient size if the buffer size
is set to the sizeof both objects to be marshalled.
2023-02-17 14:02:15 +00:00
Lennart Poettering
993a9314c4
mempool: rename local variable to match current coding style
2023-02-17 15:01:36 +01:00
Lennart Poettering
b6ff400ffb
mempool: use size_t for all memory object sizes and counts
2023-02-17 15:00:55 +01:00
Lennart Poettering
9a0f0ef557
hashmap: expose helper for releasing memory pools independently of valgrind
...
Let's clean this up and export this always, so that we can later call
when we are under memory pressure.
2023-02-17 14:59:54 +01:00
Daan De Meyer
a133d2c366
dissect-image: Return mount point fd if requested
2023-02-17 14:58:55 +01:00
Lennart Poettering
6aa90884a0
process-util: add helper get_process_threads()
...
Let's add a proper helper for querying the number of threads in a
process.
2023-02-17 14:27:58 +01:00
Luca Boccassi
ceecf3d45d
Merge pull request #26463 from DaanDeMeyer/hacking
...
Hacking
2023-02-17 11:58:13 +00:00
Lennart Poettering
6ac55dfb46
sync-util: port fsync_directory_of_file() to fd_is_opath()
...
As suggested here:
https://github.com/systemd/systemd/pull/26450#pullrequestreview-1302922404
2023-02-17 20:50:01 +09:00
Lennart Poettering
9857dc1117
Merge pull request #26438 from poettering/event-source-shorten
...
sd-event: reduce memory use of sd_event_source objects
2023-02-17 12:46:55 +01:00
Luca Boccassi
b8933fa843
Merge pull request #26341 from DaanDeMeyer/chase-fixes
...
chase-symlinks fixes
2023-02-17 11:44:47 +00:00
Lennart Poettering
fdc2ad76b4
Merge pull request #26447 from poettering/sigqueue
...
pid1/systemctl: add ability to enqueue POSIX RT sigs with associated value to service processes
2023-02-17 10:51:58 +01:00
Lennart Poettering
9a603dc251
socket-util: make connect_unix_path() work with a NULL path
2023-02-17 10:51:35 +01:00
Lennart Poettering
e940b2f371
Merge pull request #26343 from DaanDeMeyer/bus-debug
...
Bus debug
2023-02-17 10:50:19 +01:00
Lennart Poettering
48445827e3
Merge pull request #26450 from yuwata/fd-is-opath
...
util: introduce fd_is_opath() and use it in xsetxattr()
2023-02-17 10:28:32 +01:00
Lennart Poettering
a38cf9fb96
sd-event: allocate event source objects with the actually needed size
...
Currently we allocate fixed-size memory for event sources: the largest
any of the event source type needs. Discrepancy in the sizes needed for
the various event sources is quite major however: it's 144 bytes on
x86_64, i.e. more than two cache lines.
hence, let's be a tiny bit more careful, and allocate exactly as much as
we need, but not more.
2023-02-17 10:09:30 +01:00
Lennart Poettering
d6e9e8c7b9
macro: add macro for determining size of struct with trailing union
2023-02-17 10:09:30 +01:00
Lennart Poettering
dd131fcf8c
test: add test for new "systemctl --kill-value=" functionality
...
(as side-effect this also tests the new systemd-notify --exec switch)
2023-02-17 09:55:35 +01:00
Lennart Poettering
c4ef4df417
man: document new --exec switch for systemd-notify
2023-02-17 09:55:35 +01:00
Lennart Poettering
9175338e09
notify: add new --exec switch for chaining other commands to systemd-notify
...
This is useful in tests, so that we can first send a READY message and
then continue doing something else without changing PID.
2023-02-17 09:55:35 +01:00
Lennart Poettering
4ea517a6e0
strv: add strv_copy_n() helper for copying part of a n strv
2023-02-17 09:55:35 +01:00
Lennart Poettering
f4ff3e7149
man: document new --kill-value= switch to systemctl
2023-02-17 09:55:35 +01:00
Lennart Poettering
d06e61996d
systemctl: add --kill-value= argument to systemctl
...
This allows accompanying a signal with a value (as supported for Linux
Realtime signals). This is particularly useful as it allows us to do
stuff like this:
systemctl kill --kill-whom=main --kill-value=0x300 systemd-journald
In order to ask journald to flush its allocation caches and compact
memory.
2023-02-17 09:55:35 +01:00
Lennart Poettering
a721cd0016
pid1: add a new D-Bus method for enquing POSIX signals with values to unit processes
...
This augments the existing KillUnit() + Kill() methods with
QueueSignalUnit() + QueueSignal(), which are what sigqueue() is to
kill().
This is useful for sending our new SIGRTMIN+18 control signals to system
services.
2023-02-17 09:55:35 +01:00
Yu Watanabe
d51e31ac41
test-execute: also mount tmpfs on /dev/shm
...
Otherwise, if /dev/shm has a directory that cannot be accessible by
unprivileged user, then we cannot pick a dynamic user, and test service
may fail with unexpected error code:
---
Failed to enter shared memory directory /dev/shm/systemd-watch-bind-BqAGlN: Permission denied
exec-dynamicuser-supplementarygroups.service: Failed to update dynamic user credentials: Device or resource busy
exec-dynamicuser-supplementarygroups.service: Failed at step USER spawning /bin/sh: Device or resource busy
src/test/test-execute.c:885:test_exec_dynamicuser: exec-dynamicuser-supplementarygroups.service: can_unshare=no: exit status 217, expected 216
---
Follow-up for 4e032f654b
.
2023-02-17 09:55:05 +01:00
Yu Watanabe
8c2264abb9
cryptsetup: check the existence of salt by salt_size > 0
...
Follow-up for 504d0acf61
.
The function may be called with non-NULL salt and salt_size == 0.
2023-02-17 09:46:25 +01:00
Lennart Poettering
79c8e46d23
Merge pull request #26453 from yuwata/activate-main
...
activate: use DEFINE_MAIN_FUNCTION() macro
2023-02-17 09:45:52 +01:00
Lennart Poettering
2610de2f84
Merge pull request #26452 from yuwata/journalctl-main-func
...
journalctl: use DEFINE_MAIN_FUNCTION() macro
2023-02-17 09:44:19 +01:00
Yu Watanabe
d7e32d0558
test: add tests for xsetxattr()
2023-02-17 11:42:14 +09:00
Yu Watanabe
c56c26c906
test: use mkdtemp_open()
2023-02-17 11:18:49 +09:00
Yu Watanabe
9c9e1ceecc
activate: use _cleanup_close_ attribute
2023-02-17 09:49:51 +09:00
Yu Watanabe
a723521fd2
activate: use log_set_open_when_needed()
...
Otherwise, several error logs may not be shown.
2023-02-17 09:49:51 +09:00
Yu Watanabe
a601e702d5
activate: fix typo
2023-02-17 09:49:51 +09:00
Yu Watanabe
8f3d186549
activate: use DEFINE_MAIN_FUNC() macro
2023-02-17 09:49:51 +09:00
Yu Watanabe
d6467dc604
journalctl: fix fd leak
2023-02-17 09:13:22 +09:00
Yu Watanabe
9556e79be5
journalctl: use DEFINE_MAIN_FUNCTION() macro
2023-02-17 09:12:06 +09:00
Yu Watanabe
5f904eb751
xattr-util: check if fd has O_PATH and do not try setxattr() twice
...
Follow-up for a4d2461c46
.
2023-02-17 07:34:49 +09:00
Yu Watanabe
ea61e2e9bd
fd-util: introduce a simple helper to check a file descriptor has O_PATH
2023-02-17 07:18:42 +09:00
Frantisek Sumsal
ca8b1d68c5
test: avoid matching other fields than __SEQNUM=
...
The current unanchored grep sometimes matches MESSAGE=/_CMDLINE= fields
that contain "__SEQNUM=" instead of just the __SEQNUM= field, causing
spurious test fails:
[ 721.546372] testsuite-04.sh[1013]: ++ cut -d= -f2
[ 721.555858] testsuite-04.sh[1011]: ++ journalctl -o export -n 1
[ 721.573037] testsuite-04.sh[1012]: ++ grep -a __SEQNUM=
[ 721.767294] testsuite-04.sh[562]: + SEQNUM1='495773
[ 721.769671] testsuite-04.sh[562]: ++ grep -a __SEQNUM
[ 721.771323] testsuite-04.sh[562]: grep -a __SEQNUM'
[ 721.772938] testsuite-04.sh[562]: + systemd-cat echo yo
[ 721.921413] testsuite-04.sh[562]: + journalctl --sync
[ 722.088945] testsuite-04.sh[1018]: ++ journalctl -o export -n 1
[ 722.104040] testsuite-04.sh[1019]: ++ grep -a __SEQNUM=
[ 722.117239] testsuite-04.sh[1020]: ++ cut -d= -f2
[ 722.314936] testsuite-04.sh[562]: + SEQNUM2=495786
[ 722.317906] testsuite-04.sh[562]: + test 495786 -gt '495773
[ 722.319737] testsuite-04.sh[562]: ++ grep -a __SEQNUM
[ 722.321609] testsuite-04.sh[562]: grep -a __SEQNUM'
[ 722.323536] testsuite-04.sh[562]: /usr/lib/systemd/tests/testdata/units/testsuite-04.sh: line 276: test: 495773
[ 722.325744] testsuite-04.sh[562]: ++ grep -a __SEQNUM
[ 722.327498] testsuite-04.sh[562]: grep -a __SEQNUM: integer expression expected
[ 722.329528] testsuite-04.sh[562]: + journalctl --rotate --vacuum-size=16M
$ build/journalctl --file /var/tmp/systemd-test.0HpVjt/system.journal -o export | grep -a __SEQNUM=
...
__SEQNUM=214849
__SEQNUM=214850
MESSAGE=++ grep -a __SEQNUM=
_CMDLINE=grep -a __SEQNUM=
__SEQNUM=214851
...
__SEQNUM=214860
MESSAGE=++ grep -a __SEQNUM=
_CMDLINE=grep -a __SEQNUM=
__SEQNUM=214861
__SEQNUM=214862
__SEQNUM=214863
...
Let's anchor the expression to avoid this.
Follow-up to f28ed2c1be
.
2023-02-17 07:03:00 +09:00
Yu Watanabe
b038a44d44
Merge pull request #26271 from d-hatayama/fix_sulogin_shell
...
sulogin: fix control lost of the current terminal when default.target…
2023-02-17 06:52:03 +09:00
Jan Janssen
f92428eae5
boot: Fix assertion failure
...
The TPM code expects a description unless the PCR index indicates that
no measurements have to take place. The assert was preempting this
check from happening.
Fixes : #26428
2023-02-17 05:01:53 +09:00
Daan De Meyer
e9c47453d2
Drop mkosi + clang section from HACKING
...
We removed a few features that made this work, will be added back
in the future when we restructure the way mkosi does build images.
2023-02-16 20:06:27 +01:00
Daan De Meyer
2edcf8e7db
Update HACKING for latest mkosi
2023-02-16 20:05:55 +01:00
Samanta Navarro
2d5ccb0818
bootctl: Fix debug messages
...
Remove duplicate KERNEL_INSTALL_MACHINE_ID from message and also
specify the correct origin of layout variable.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2023-02-16 16:37:02 +00:00
Lennart Poettering
1e344c1dc7
log: add common helper log_set_target_and_open()
...
quite often we want to set a log target and immediately open it. Add a
common helper for that.
2023-02-16 16:32:41 +01:00
Luca Boccassi
05dd602e50
Merge pull request #26435 from poettering/pid1-seccomp-disable-fix
...
pid1: fix handling of SystemCallArchitectures= if seccomp is off
2023-02-16 14:49:52 +00:00