Commit Graph
8191 Commits
Author SHA1 Message Date
Lennart Poettering 07f314575b format-table: add new table_get_current_column() helper 2023-10-20 15:57:25 +01:00
Lennart Poettering f4ae435bec format-table: add new uint32_t hex field type 2023-10-20 15:55:15 +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
Lennart Poettering 0342772031 json: add helpers for dispatching/building JSON with base64 struct iovecs 2023-10-20 14:38:16 +02:00
Lennart Poettering f7ad4376c5 tpm2-util: add line break where appropriate 2023-10-20 14:34:11 +02:00
Lennart Poettering 2216c27c7d tpm2-util: add a bunch of line breaks for an overly long bitmask 2023-10-20 14:33:55 +02:00
Daan De Meyer 8eb735b800 json: Introduce JSON_BUILD_CALLBACK 2023-10-20 14:09:32 +02:00
Daan De Meyer a636a058f1 json: Introduce JSON_BUILD_STRING_SET 2023-10-20 14:09:32 +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
Daan De Meyer 6bbb893b90 rm-rf: Make sure we rewinddir() before readdir()
We don't know what state the passed in file descriptor is in. Let's
make sure we rewind it before iterating over it.

Fixes #29606
2023-10-20 11:55:53 +01:00
Yu Watanabe af7417ac7b netif-naming-scheme: disable NAMING_BRIDGE_MULTIFUNCTION_SLOT
This effectively reverts 66425daf2c.

The commit assumes that if the network interface has multifunctions,
then the function fields of the pci devices under the same PCI bridge
device are unique.
But it seems not, at least on some setups. See issue #28929.
Let's revert the change, and always refuse to set slot base naming if
a PCI bridge is detected.

Fixes #28929.
2023-10-20 10:56:48 +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 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
Luca Boccassi 759cca0348 Merge pull request #29629 from bluca/mount_tunnel_pidref
mount tunnel: use PidRef
2023-10-19 18:59:22 +01:00
Zbigniew Jędrzejewski-Szmek af189d7b50 pid1,vconsole-setup: lock /dev/console instead of the tty device
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 a0043bfa51.
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.
2023-10-19 18:03:21 +01:00
Luca Boccassi 5f48198af8 mount tunnel: use PidRef 2023-10-19 16:31:05 +01:00
Arseny Maslennikov 8b45281daa seccomp: also check the mode parameter of fchmodat2(2)
If there is no libseccomp support, just ban the entire syscall instead
so wrappers will fall back to older, supported syscalls.
Also reflect all of this in `test-seccomp.c`.
2023-10-19 15:53:58 +03:00
Arseny Maslennikov 6e10405aa2 seccomp: include fchmodat2 in @file-system 2023-10-19 15:53:45 +03:00
Arseny Maslennikov a539314a87 seccomp: fix debug logging typo
Fixes: da4dc9a674 ("seccomp: rework how the S[UG]ID filter is installed")
2023-10-19 14:07:54 +03:00
Arthur Shau 1bd0b9c053 varlink: Add new varlink_collect method
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.
2023-10-19 11:52:09 +02: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
Frantisek Sumsal 892eb4d795 core: don't assert when serializing malformed state 2023-10-18 22:44:16 +02: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 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 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 6f25a110ad cgroup-show: use size_t for array sizes 2023-10-18 14:39:33 +02:00
Lennart Poettering 3b444970e6 serialize: add serialize_fd_many() helper 2023-10-18 13:51:02 +02:00
Lennart Poettering c2e42d4b88 serialize: change order of deserialize_strv() parameters
The other deserializers put value first, and return parameter second,
let's do so here too.
2023-10-18 12:54:20 +02:00
Lennart Poettering af6321857d serialize: modernize deserialize_{usec|dual_timestamp}() a bit
Rename the return parameters "ret", and use compound initialization. Add
an assert() on input.
2023-10-18 12:54:20 +02:00
Lennart Poettering dff9808a62 serialize: add new helper deserialize_fd()
Currently, when we deserialize an fd we do a lot of manual work. Add a
common helper that makes this more robust and uniform.

Note that this sometimes changes behaviour slightly, but in ways that
shouldn't really matter: if we fail to deserialize an fd correctly we'll
unset (i.e. set to -EBADF) the fd in the deserialized data structure.
Previously, we'd leave the old value in place.

This should not change effective result (as in either case we'll be in a
bad state afterwards, just once we mix old/invalidated state with new
state, while now we'll reset the state explicitly to invalidated state
on failure). In particular as deserialization starts from an empty
structure generally, hence the old value should be unset anyway.

Another slight change is that if we fail to deserialize some object half
way, and we already have taken out one fd from the serialized fdset
we'll now just close it instead of returning it to/leaving it in the
fdset. Given that such "orphaned" fds are blanket closed after
deserialization finishes this also shouldn't change behaviour IRL.

Also, the idle_pipe was previously incorrectly serialized: we'd
serialize invalidated fds, which would fail, but because parsing errors
on this were ignored on the deserializatin noone noticed. This is fixed.
2023-10-18 12:54:20 +02:00
Lennart Poettering 0ff6ff2b29 tree-wide: port various parsers over to read_stripped_line() 2023-10-17 14:36:54 +02:00
Zbigniew Jędrzejewski-Szmek 386256e699 test: make sure that the default naming scheme name maps back to itself
We were testing the that C constant is defined, but we weren't actually testing
that the string name maps back to itself. This would catch the issue fixed by
the grandparent commit.

The test for the default name is moved to the test file to keep the tests
together. The define is renamed to not have "_TEST" in the name. The issue here
is complicated by the fact that we allow downstreams to inject additional
fields, so we don't know the name of the default scheme if it not set with
-Ddefault-net-naming-scheme=, so _DEFAULT_NET_NAMING_SCHEME[_TEST] is not
defined in all cases, but at least in principle it could be used in other
places. If it exists, it is fully valid.
2023-10-16 21:21:54 +02:00
Zbigniew Jędrzejewski-Szmek 8b01831950 shared/netif-naming-scheme: align tables 2023-10-16 21:21:54 +02:00
Zbigniew Jędrzejewski-Szmek 64f2cf77d1 NEWS, man: move description of SR-IOV-R net naming to v255
https://github.com/systemd/systemd/pull/29582 adds the "v254" name. This also
changes what the default is and what "latest" refers to. Without the name, the
code could be enabled via runtime configuration. Nevertheless, it could be
enabled at compilation time. In other words:
  meson setup build -Ddefault-net-naming-scheme=v254
would work, but
  net.naming-scheme=v254
would fail.

It is possible that people were using the compile-time override, so I think
we should allow "v254" scheme to stay and clearly document that it wasn't the
default.

Unfortunately, unless people manually introduced the compile-time override, we
were never actually testing the new code too. So all the pull request testing
was not useful.
2023-10-16 21:21:54 +02:00
Antonio Alvarez Feijoo acd3f69217 net_id: add missing naming scheme name for v254
Follow up to 88d2bda812
2023-10-16 21:19:54 +02:00
Lennart Poettering cde8cc946b Merge pull request #29272 from enr0n/coredump-container
coredump: support forwarding coredumps to containers
2023-10-16 16:13:16 +02:00
Luca Boccassi 7c83d42ef8 mount-util: use mount beneath to replace previous namespace mount
Instead of mounting over, do an atomic swap using mount beneath, if
available. This way assets can be mounted again and again (e.g.:
updates) without leaking mounts.
2023-10-16 14:33:47 +01:00
Lennart Poettering f5151fb459 sysext: make some calls available via varlink 2023-10-16 12:08:39 +02:00
Daan De Meyer 36d87065f2 Merge pull request #29558 from mrc0mmand/varlinkctl-tests
varlink: add a couple of tests + accompanying fixes
2023-10-16 09:49:42 +02:00
Zbigniew Jędrzejewski-Szmek 80788a0bd4 shared/pretty-print: drop unused flag
0895e87348 removed the last (only?) use of
CAT_MAIN_FILE_OPTIONAL, except for tests. All callers first check if the main
file exists on their own, so this code was effectively dead.

I want to repopulate the enum in later commits, so a dummy flag is added
to allow the code to compile.
2023-10-14 18:36:10 +02:00
Frantisek Sumsal e97f2dfde4 varlink: drop dead code
'#' is never part of either allowed_chars or allowed_delimiters when we
parse structs/enums.
2023-10-14 17:40:07 +02:00
Frantisek Sumsal a972870ea2 varlink: use int for log level 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 779e7b4410 varlink: don't panic on malformed method definition 2023-10-14 17:40:07 +02:00
Luca Boccassi 0e3986bc1c Merge pull request #29525 from poettering/confext-sysext-multimodal
dissect: make sure we can dissect and inspect DDIs that are both confext *and* sysext
2023-10-14 00:28:47 +01:00
Luca Boccassi ccba67f494 Merge pull request #27890 from bluca/executor
core: add systemd-executor binary
2023-10-13 22:01:16 +01:00