Commit graph

69571 commits

Author SHA1 Message Date
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
1fdab6c306 update TODO 2023-12-13 18:04:55 +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
Frantisek Sumsal
f9ba9d3eb7 test: install all necessary units & generators for LVM on Debian
And derivates.

Replaces: #30458
2023-12-13 23:56:14 +09: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
Richard Maw
0129395173 test: slacken plugged -> dead test
This test is for if devices transition from plugged -> dead -> plugged
on boot, but it is normal to see loop devices transition plugged -> dead
on first boot when systemd-repart adds the root partition.
2023-12-13 13:35:04 +00:00
Richard Maw
8f764b32ea test: Create analyze chroot with --rbind
The systemd-analyze integration test also tests chroots.
It builds its chroot by bind-mounting /,
but since /usr might be a separate mountpoint
it should create the chroot with --rbind.
2023-12-13 13:35:04 +00:00
Mike Yuan
3e5b96eed3
core/unit: clean up unit_log_resources
* Use a unified struct to store accounting fields/suffixes
* Use strextendf_with_separator where appropriate
* Don't mix stack and heap allocation for one iovec array
2023-12-13 20:42:06 +08:00
Mike Yuan
b1b84bc590
core/unit: raise log level for unit_log_resources on certain memory thresholds
We already do this for all other types of accountings. Let's
make this nicer for memory accounting too.
2023-12-13 20:42:06 +08:00
Mike Yuan
55b8f8100c
macro-fundamental: add U64_{K,M,G}B 2023-12-13 20:42:05 +08:00
Mike Yuan
ba354c164f
iovec-util: add missing assertion 2023-12-13 20:42:05 +08:00
Lennart Poettering
113defc76b test: test that delegation of some newer attrs that shall be delegated work 2023-12-13 10:10:56 +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
ee07fff03b test: add basic coverity tests for bootctl 2023-12-13 14:29:09 +09:00
Yu Watanabe
97bbb9cfbd test: create ESP and xbootldr partitions 2023-12-13 14:28:30 +09:00
Yu Watanabe
0f236e8cd6 test: mask mdmonitor when building image
Follow-up for 22e31655f3.
2023-12-13 14:28:03 +09:00
Yu Watanabe
4ed943e97b test: make install_mdadm() also install relevant kernel modules
Installing mdadm without kernel modules is mostly meaningless.
2023-12-13 14:19:28 +09:00
Yu Watanabe
5b4fa6f13c test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE 2023-12-13 14:19:28 +09:00
Yu Watanabe
997ba18af1 find-esp: do not skip fstype check even when --root= or --image= is specified
The check was introduced by 63105f33ed,
but there is no reason to skip the check even in such cases.
2023-12-13 14:19:28 +09:00
Yu Watanabe
9bbd3c699c find-esp: introduce verify_esp_flags_init() helper function
And split VERIFY_ESP_RELAX_CHECKS into two.

No functional change, just refactoring.
2023-12-13 14:19:28 +09:00
Yu Watanabe
5c831ddec8 find-esp: do not fail when /boot on btrfs RAID on searching ESP or xbootldr
When /boot or friends is on btrfs RAID, btrfs_get_block_device_at() will
succeed with 0 and provide zero devnum. Then,
- if we are previleged, devname_from_devnum() maps the devnum to
  /run/systemd/inaccessible/blk, and the subsequent verification by blkid
  will fail,
- if we are unprevileged, sd_device_new_from_devnum() will fail.

This makes
- when find_esp() or find_xbootldr() is called without any paths, that
  is, called with the searching mode, then returns -ENOKEY, which should
  be handled gracefully by the caller,
- when they are called with an input path, then they provide the proper
  error message and suggestion.

Fixes RHBZ#2251262 (https://bugzilla.redhat.com/show_bug.cgi?id=2251262).
2023-12-13 14:19:28 +09: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
Frantisek Sumsal
22e31655f3 test: mask the mdmonitor.service
It's pulled in by one of the udev rules (63-md-raid-arrays.rules) and it
fails every time, because there's no valid email address in
/etc/mdadm.conf:

[    5.778153] testsuite-64.sh[403]: mdadm: array /dev/md/mdmirror started.
[    5.819137] kernel: md/raid1:md127: not clean -- starting background reconstruction
[    5.819141] kernel: md/raid1:md127: active with 2 out of 2 mirrors
[    5.819159] kernel: md127: detected capacity change from 0 to 129024
[    5.821950] kernel: md: resync of RAID array md127
...
[    5.887192] mdadm[424]: mdadm: No mail address or alert command - not monitoring.
[    5.890772] systemd[1]: Starting mdmonitor.service...
[    5.891718] systemd[1]: Started mdmonitor.service.
[    5.892570] systemd[1]: mdmonitor.service: Main process exited, code=exited, status=1/FAILURE
[    5.892618] systemd[1]: mdmonitor.service: Failed with result 'exit-code'.

And as we (re)assemble the MD devices multiple times, this gets quite
noisy, especially since we later start hitting the service start rate
limit.

Fedora has the mdmonitor.service patched, so it won't start without
/etc/mdadm.conf being present, but Arch uses the upstream unit which
doesn't have such guard.

Let's just mask the service completely, which replaces all that noise
with one warning:

[    6.553583] testsuite-64.sh[294]: + udevadm wait --settle ...
[    6.580700] systemd[1]: sys-devices-virtual-block-md127.device: Failed to enqueue SYSTEMD_WANTS job, ignoring: Unit mdmonitor.service is masked.
2023-12-13 00:59:20 +00:00
Will Springer
e014a19420 man: make minor corrections to smbios-type-11(7)
- Correct initial version of io.systemd.credential* to 252
- Fix leftover copy-pasted heading
2023-12-13 00:58:23 +00: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
41231f2697 test-network: add test for ManageForeignNextHops=no 2023-12-13 00:02:36 +09:00
Yu Watanabe
e7660b9aff test-network: reduce indent for verification 2023-12-12 23:51:10 +09:00
Yu Watanabe
77633317ce test-network: drop redundant call of tearDown() 2023-12-12 23:51:10 +09:00
Yu Watanabe
bbc05bec98 network/nexthop: introduce ManageForeignNextHops= boolean setting
Closes #29034.
2023-12-12 23:51:10 +09:00