Commit Graph

46579 Commits

Author SHA1 Message Date
Daan De Meyer
9ce4dad81f Merge pull request #30467 from poettering/loop-block-tweaks
various tweaks to block device ioctls, and loop device mgmt
2023-12-14 09:38:17 +01:00
Lennart Poettering
21c43631d7 rlimit-util: add pid_getrlimit() helper
This is gets the resource limits off a specified process, and is very
similar to prlimit() with a NULL new_rlimit argument. In fact, it tries
that first. However, it then falls back to use /proc/$PID/limits. Why?
Simply because Linux prohibits access to prlimit() for processes with a
different UID, but /proc/$PID/limits still works.

This is preparation to allow nspawn to run unprivileged.
2023-12-14 08:31:29 +00:00
Luca Boccassi
1845fccada Merge pull request #30469 from poettering/userdbd-tweaks2
userdb: some smaller userdb tweaks
2023-12-14 08:19:51 +00:00
Lennart Poettering
bb59b92256 mount-util: make sure mount_switch_root() works as clean NOP when '/' is specified as target 2023-12-14 13:13:45 +09:00
Lennart Poettering
3d33798803 userdbd: split out function to find listener fd
no actual code changes, just some refactoring and modernization
2023-12-13 18:25:10 +01:00
Lennart Poettering
523121d543 userbd: modernize process_connection() fd possession logic 2023-12-13 18:19:42 +01:00
Lennart Poettering
404a12e1d6 userdbd: realign table 2023-12-13 18:19:20 +01:00
Lennart Poettering
43185f5dc0 userdbd: drop redundant empty line 2023-12-13 18:19:00 +01:00
Lennart Poettering
0e3cb8cf88 userdbd: properly close the listener fd on exit 2023-12-13 18:18:39 +01:00
Lennart Poettering
7c695beadc userwork: port to pidref_set_parent() 2023-12-13 18:00:14 +01:00
Lennart Poettering
a1796e9bd8 pidref: add pidref_set_parent() for race-freely getting pidref on ppid 2023-12-13 18:00:14 +01:00
Lennart Poettering
64cd3d13ea dissect-tool: hide device column if it's a short-lived loopback device
It's pointless showing info that isn#t going to survive the current
invocation, hence hide it.

The "partition number" column is more useful since it kinda shows the
same information, but without the device node name prefixed that is
local to the currentl invocation.
2023-12-13 17:41:18 +01:00
Lennart Poettering
5b1b37c86a dissect-tool: show sector/image size from DissectedImage object
The information is provided to us already in the structure now, hence
use it.
2023-12-13 17:35:22 +01:00
Lennart Poettering
51778dea0d dissect-image: also store the image size in DissectedImage
That way we can easily access it the same way regardless if we operate
on a block device or on a regular file.
2023-12-13 17:35:22 +01:00
Lennart Poettering
6bc201343f loop-util: remember if we created the LoopDevice
Let's store in a bool whether a LoopDevice object was created via
loop_device_open() or loop_device_make().
2023-12-13 17:35:22 +01:00
Lennart Poettering
c961a8c605 loop-util: also store the device size in LoopDevice
That makes the field easily accessible, just as the sector size.
2023-12-13 17:35:22 +01:00
Lennart Poettering
01db9c85cf blockdev-util: add new helper blockdev_get_device_size()
This function is just a wrapper around the BLKGETSIZE64. Which is a
pretty simple ioctl. The only reason to wrap it, is that the headers we
need to call it are a bit messy (as "linux/fs.h" is incompatible with
certain glibc headers). Hence add the simple helper that wraps it and
allows us to do the header mess needed in one file only.

It's also nicely symmetric to blockdev_get_sector_size().
2023-12-13 17:35:22 +01:00
Luca Boccassi
b896058883 Merge pull request #30450 from poettering/cgroups-delegate-attr-update
cgroup: bring list of delegated cgroup attributes up-to-date with cur…
2023-12-13 13:50:41 +00:00
Zbigniew Jędrzejewski-Szmek
0b4cf0a540 Merge pull request #30232 from keszybz/ukify-imports
Use exec() to import ukify
2023-12-13 14:38:03 +01:00
Lennart Poettering
2c70a81de6 cgroup: bring list of delegated cgroup attributes up-to-date with current kernels
THis brings the list of attributes to delegate to managers of subcgroups
to the state of kernel 6.6.

We probably should unify this list, and maybe generate it automatically
from /sys/kernel/cgroup/delegate, but let's do that another time.
2023-12-13 09:58:45 +01:00
Lennart Poettering
f2ad89248b varlink: improve compat with varlink C reference implementation
The reference implementation seems to set the 'parameters' field for
method calls to 'null' if nothing is specified on its command line. We
so far only could deal if the parameters field was unset or set to the
empty object. Let's also accept the 'null' type.
2023-12-13 09:39:10 +01:00
Yu Watanabe
0977039bdc Merge pull request #30433 from yuwata/network-nexthop-cleanups
network: introduce ManageForeignNextHops=
2023-12-13 14:16:27 +09:00
Yu Watanabe
740539835a Merge pull request #30453 from poettering/dissect-fixes
dissect-image: various fixes
2023-12-13 14:15:05 +09:00
Lennart Poettering
748e87a791 dissect-tool: right-align the partition number
The right-alignment was applied to the wrong column, because neither
ee8e497d24 nor
1474d7ac2d updated the column count as
they should have.
2023-12-13 00:56:48 +00:00
David Tardon
38e1035bef openssl-util: avoid freeing invalid pointer 2023-12-13 07:28:30 +08:00
Lennart Poettering
3f8229fbb0 dissect-image: move comment to right place
The image name is extracted from the image path originally passed in,
i.e. not the contents of the image. And the image UUID is directly
retrieved from the partition table, hence also not from the contents.
Let's hence move the comment to separate out the stuff extract from the
file systems (and thus only available when mounting/with privs/with
block devices) from the data available without any of that.
2023-12-12 16:20:10 +01:00
Lennart Poettering
8d5e61db43 dissect-image: fix fd leak in dissected_image_acquire_metadata()
We have to go through the "finish" label to properly close all pipes in
the error path, so that we don't leak them.
2023-12-12 16:19:50 +01:00
Lennart Poettering
a8e8bcfb7d dissect-image: don't try to validate an extension release file with no image name
Otherwise we might validate the OS release file instead…
2023-12-12 16:19:31 +01:00
Lennart Poettering
29b4db7ede dissect-image: handle 'continue' event in metadata acquisition uniformly
Let's jump to the same label in all cases, that closes the associated
pipe, systematically.
2023-12-12 16:19:21 +01:00
Lennart Poettering
3ee413e632 dissect-image: path[] is now defined for all metadata fields
There's no point in handling a case that never can happen.
2023-12-12 16:19:05 +01:00
Lennart Poettering
026a8b022e execute: improve log message about TTY ownership reset failures 2023-12-12 16:06:08 +01:00
Yu Watanabe
bbc05bec98 network/nexthop: introduce ManageForeignNextHops= boolean setting
Closes #29034.
2023-12-12 23:51:10 +09:00
Lennart Poettering
f121efd392 execute: handle gracefully if we cannot lock /dev/console when resetting tty due to perms
This is the common case in --user instances, hence handle this
gracefully.

This should be safe since user instances won't get access to
/dev/console-related ttys anyway, but only their own ptys.
2023-12-12 22:02:12 +09:00
Yu Watanabe
1c860010ce Merge pull request #30441 from poettering/nspawn-fixlets
nspawn: two trivial nspawn tweaklets
2023-12-12 22:00:35 +09:00
Yu Watanabe
61738a1a92 Merge pull request #30437 from YHNdnzj/job-start-msg
core/job: emit job start message if we're only waiting for unit state
2023-12-12 21:59:34 +09:00
Mike Yuan
6cfce71b50 hibernate-resume: don't wait forever if hibernate info is from EFI 2023-12-12 12:36:58 +00:00
Lennart Poettering
af255804b2 nspawn: drop redundant assignments 2023-12-12 12:06:34 +01:00
Lennart Poettering
1f87cc8cd9 nspawn: suffix some paths in log messages with /, as per coding style 2023-12-12 12:06:21 +01:00
Yu Watanabe
2527b725ba Merge pull request #30156 from yuwata/network-mtu
network: accept arbitrary size of MTU in .network
2023-12-12 19:03:21 +09:00
Yu Watanabe
b0e2245219 Merge pull request #30426 from mrc0mmand/nft-shenanigans
network: show the reason why NFT operation failed
2023-12-12 18:56:57 +09:00
Frantisek Sumsal
b7d435925d network: actually show the unexpected flags
The original version would yield a slightly _unexpected_ message for
this [Address] section:

[Address]
Address=10.9.3.1/24
HomeAddress=yes
ManageTemporaryAddress=yes

systemd-networkd[68396]: /run/systemd/network/25-address-static.network: unexpected address flags "n/a" were configured. Ignoring [Address] section from line 144.

Let's instead show the unexpected flags:

systemd-networkd[69160]: /run/systemd/network/25-address-static.network: unexpected address flags "home-address,manage-temporary-address" were configured. Ignoring [Address] section from line 144.
2023-12-12 18:56:43 +09:00
Mike Yuan
d8deb18720 core/job: emit job start message if we're only waiting for unit state
Currently, start/stop messages for device units are not used, since
job_perform_on_unit() does nothing and we simply wait for unit status
change. I think we still want some nice log messages explaining what
the start jobs for devices are doing, so let's fix this.
2023-12-12 17:04:30 +08:00
Mike Yuan
3f4a7a472f core/device: add stopping job message
The use case for stopping a device unit is indeed narrow,
but we still want to show a clear message.

Preparation for later commits.
2023-12-12 16:45:30 +08:00
Yu Watanabe
60f4cfe4fc network: drop redundant 'struct' 2023-12-11 20:11:06 +00:00
Luca Boccassi
bf8726d1ee Merge pull request #30363 from yuwata/analyze-find-template
analyze: also find template unit when an instance is specified
2023-12-11 15:56:21 +00:00
Luca Boccassi
1eeaa93de3 executor: don't duplicate FD array to avoid double closing
Just use ExecParam directly, as these are all internal to sd-exec now
anyway. Avoids double close when execution fails after FDs are set up
for inheritance and were already re-arranged.

Fixes https://github.com/systemd/systemd/issues/30412
2023-12-11 15:55:50 +00:00
Yu Watanabe
a9235a9488 Merge pull request #30422 from yuwata/network-tiny-fixes
network: tiny fixes
2023-12-12 00:23:11 +09:00
Frantisek Sumsal
13b8fb98b9 network: show the reason why NFT operation failed 2023-12-11 15:28:02 +01:00
Frantisek Sumsal
4d9a30f14f network: add a missing space 2023-12-11 14:50:32 +01:00
Daan De Meyer
dbab005645 kernel-install: Fix inspect with --root= when no version is specified
Using the kernel version from the host is incorrect in this case, so
fix the logic so it handles no version being specified correctly with
--root=.
2023-12-11 12:06:51 +00:00