Commit graph

61298 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek a5fac1df27 manager: define a string constant for LONG_MAX and use that for sysctl
This moves the formatting of the constant to compilation time and let's us
avoid asprintf() in the very hot path of initial boot.
2022-12-03 11:59:03 +01:00
Zbigniew Jędrzejewski-Szmek b47e0fac03 manager: do not append '\n' when writing sysctl settings
When booting with debug logs, we print:

   Setting '/proc/sys/fs/file-max' to '9223372036854775807
   '
   Setting '/proc/sys/fs/nr_open' to '2147483640
   '
   Couldn't write fs.nr_open as 2147483640, halving it.
   Setting '/proc/sys/fs/nr_open' to '1073741816
   '
   Successfully bumped fs.nr_open to 1073741816

The strange formatting is because we explicitly appended a newline in those two
places. It seems that the kernel doesn't care. In fact, we have a few dozen other
writes to sysctl where we don't append a newline. So let's just drop those here
too, to make the code a bit simpler and avoid strange output in the logs.
2022-12-03 11:59:03 +01:00
Lennart Poettering f6484e8503
Merge pull request #25570 from yuwata/dissect-rootless-image
dissect: support to unmount image without root partition
2022-12-02 18:25:53 +01:00
Lennart Poettering 1fe6e5c112 Revert "basic: add fallback in chase_symlinks_and_opendir() for cases when /proc is not mounted"
This reverts commit 3e22dfc235.
2022-12-02 17:57:10 +01:00
Michal Sekletar 3e22dfc235 basic: add fallback in chase_symlinks_and_opendir() for cases when /proc is not mounted
https://bugzilla.redhat.com/show_bug.cgi?id=2136916
2022-12-02 17:45:33 +01:00
Zbigniew Jędrzejewski-Szmek 6accdcc547
Merge pull request #25541 from medhefgo/boot-reconnect
boot: Fix huge boot delay
2022-12-02 14:37:17 +01:00
Frantisek Sumsal d19e5540f2 test: check if we can use SHA1 MD for signing before using it
Some distributions have started phasing out SHA1, which breaks
the systemd-measure test case in its current form. Let's make sure we
can use SHA1 for signing beforehand to mitigate this.

Spotted on RHEL 9, where SHA1 signatures are disallowed by [0]:
```
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out "/tmp/pcrsign-private.pem"
...
openssl rsa -pubout -in "/tmp/pcrsign-private.pem" -out "/tmp/pcrsign-public.pem"
writing RSA key
/usr/lib/systemd/systemd-measure sign --current --bank=sha1 --private-key="/tmp/pcrsign-private.pem" --public-key="/tmp/pcrsign-public.pem"
Failed to initialize signature context.
```

[0] https://gitlab.com/redhat/centos-stream/rpms/openssl/-/blob/c9s/0049-Selectively-disallow-SHA1-signatures.patch
2022-12-02 14:33:05 +01:00
Zbigniew Jędrzejewski-Szmek f323cac4a1
Merge pull request #25603 from DaanDeMeyer/mkosi
mkosi config changes
2022-12-02 14:27:16 +01:00
Yu Watanabe a52efa813d dissect-image: log expected UUID for /var
Closes #25443.
2022-12-02 14:25:48 +01:00
Yu Watanabe 46dc071985 bootspec: fix null-dereference-read
Fixes [oss-fuzz#53578](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53578).
Fixes #25450.
2022-12-02 14:23:45 +01:00
Yu Watanabe 719b7d4dc2 fuzz-systemctl: limit the size of input
Fixes [oss-fuzz#53552](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53552).
Fixes #25445.
2022-12-02 14:22:25 +01:00
Daan De Meyer d3a8471754 mkosi: Drop HostonlyInitrd=yes
This option will be removed in the upcoming version of mkosi so let's
stop using it in our config.
2022-12-02 10:46:32 +01:00
Daan De Meyer 6263e0a2c0 mkosi: Drop explicit Format=
Once mkosi migrates to systemd-repart, only "disk" will be supported
for making disk images with mkosi and the filesystem will have to be
specified in repart partition definition files. To accomodate this
change, let's remove the explicit Format= assignment which means we'll
default to a disk image with ext4 until we add our own mkosi.repart/
directory.
2022-12-02 10:44:56 +01:00
Yu Watanabe 6c2d70ce9f tree-wide: fix typo 2022-12-02 13:27:08 +09:00
rogg 9b9798483a hwdb: add Dell Inspiron N4010 touchpad corrections 2022-12-02 13:20:07 +09:00
Neil Moore d833ed781f virt: Support detection of LMHS SRE guests 2022-12-02 10:29:14 +09:00
Yu Watanabe ef6636fd18
Merge pull request #25591 from poettering/dissect-probe-offset
dissect-image: probe file system via main block device fd/image file fd
2022-12-02 09:15:20 +09:00
Phaedrus Leeds c85c2f7930 nspawn: Use "Ctrl-" rather than "^" in info msg
Maybe most people know that "^]" means "Ctrl + ]" but for those that
don't, this should be more clear.
2022-12-02 08:28:04 +09:00
Yu Watanabe d9a95033bf network: unset Link.ndisc_configured only when a new address or route is requested
This fixes an issue introduced by af2aea8bb6.

When an outdated address or route is passed to link_request_address()/route(),
then they return 0 and the address or route will not be assigned. Such
situation can happen when we receive RA with zero lifetime. In that
case, we should not unset Link.ndisc_configured flag, otherwise even
no new address nor route will assigned, the interface will enter to the
configuring state, and unnecessary DBus property change is emit and the state
file will be updated. That makes resolved or timesyncd triggered to
reconfigure the interface.

Fixes #25456.
2022-12-01 23:15:09 +01:00
Luca Boccassi f7031144da
Merge pull request #25568 from yuwata/network-tiny-cleanups
network: tiny cleanups
2022-12-01 23:12:26 +01:00
Lennart Poettering c80c9079c8 dissect-image: probe file system via main block device fd/image file fd
let's make sure we can probe file systems also when unprivileged:
instead of probing the partition block devices for file system
signatures, let's go via the original "whole" fd.

libblkid makes this easy actually, as it allows us to specify the
offset/size of the area to probe. And we have the partition
offsets/sizes anyway, so it's trivial for us to make use of.

This thus enables fs probing also when lacking privs and operating on
naked regular files without loopback devices or anything like this.
2022-12-01 22:09:30 +01:00
Lennart Poettering 59a4c0d7e3 test-loop-block: let's explicitly flush buffer cache on whole block device
Let's explicitly flush the kernel's buffer cache on the whole block
device once we ran "mkfs". This is necessary, because partition and
whole block devices maintain separate buffer caches, and thus writing
to one will not be visible on the other if cached there already, until
the latter's cache is explicitly flushed.

This is preparation for later adding support for probing file sytems
also if we have no open partition block devices, and hence want to use
the whole block device instead.
2022-12-01 22:07:36 +01:00
Lennart Poettering 9f2d9a4aab test-loop-block: also test dissection without ADD/PIN of partition block devices
Let's extend the test further, and try the codepaths where we do not
pin/add the partition block devices (i.e. which is the codepaths we use
when running without privs)
2022-12-01 22:07:36 +01:00
Lennart Poettering 02c15120a1 test-loop-block: tighten tests a bit - check fstype, too
Let's verify that we properly created the file systems once we did so.
And tets this way that our dissector works correctly.
2022-12-01 22:07:36 +01:00
Lennart Poettering 4f0fafb6f0
Merge pull request #25593 from poettering/blkid-safeprobe-enum
define symbolic enum for blkid_do_safeprobe() return values
2022-12-01 22:07:00 +01:00
Yu Watanabe 41a95b18bd dissect: support to unmount image without root partition
Fixes #25480.
2022-12-02 02:58:44 +09:00
Yu Watanabe 040d343903 dissect: use sd-device to find and open loopback block device 2022-12-02 02:52:06 +09:00
Lennart Poettering b62a45d89b update TODO 2022-12-01 17:35:33 +01:00
Lennart Poettering 2e3944b872 blkid-util: define enum for blkid_do_safeprobe() return values
libblkid really should define an enum for this on its own, but it
currently doesn't and returns literal numeric values. Lets make this
more readable by adding our own symbolic names via an enum.
2022-12-01 15:43:26 +01:00
Lennart Poettering ef1f0a14fa tree-wide: use errno_or_else() more, instead of homegrown checks 2022-12-01 15:42:46 +01:00
Daan De Meyer 003cb0e046
Merge pull request #25579 from DaanDeMeyer/copy-graceful-symlinks
repart: Ignore copy failures for unsupported file types
2022-12-01 13:47:14 +01:00
dependabot[bot] 054f47defc build(deps): bump ninja from 1.10.2.4 to 1.11.1 in /.github/workflows
Bumps [ninja](https://github.com/ninja-build/ninja) from 1.10.2.4 to 1.11.1.
- [Release notes](https://github.com/ninja-build/ninja/releases)
- [Commits](https://github.com/ninja-build/ninja/commits/v1.11.1)

---
updated-dependencies:
- dependency-name: ninja
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 11:59:45 +00:00
Daan De Meyer 336ae0e71d repart: Ignore copy failures for unsupported file types
e.g. vfat doesn't support symlinks, sockets, fifos, etc so let's ignore
any copy failures related to unsupported file types when populating
filesystems.
2022-12-01 12:14:35 +01:00
Lennart Poettering f0c24a0ed8
Merge pull request #25554 from enr0n/follow-on-25509
oomd: only check prefix_uid when uid != 0
2022-12-01 12:04:23 +01:00
Lennart Poettering 73d88b806b dissect: rework DISSECT_IMAGE_ADD_PARTITION_DEVICES + DISSECT_IMAGE_OPEN_PARTITION_DEVICES
Curently, these two flags were implied by dissect_loop_device(), but
that's not right, because this means systemd-gpt-auto-generator will
dissect the root block device with these flags set and that's not
desirable: the generator should not cause the partition devices to be
created (we don't intend to use them right-away after all, but expect
udev to find/probe them first, and then mount them though .mount units).
And there's no point in opening the partition devices, since we do not
intend to mount them via fds either.

Hence, rework this: instead of implying the flags, specify them
explicitly.

While we are at it, let's also rename the flags to make them more
descriptive:

DISSECT_IMAGE_MANAGE_PARTITION_DEVICES becomes
DISSECT_IMAGE_ADD_PARTITION_DEVICES, since that's really all this does:
add the partition devices via BLKPG.

DISSECT_IMAGE_OPEN_PARTITION_DEVICES becomes
DISSECT_IMAGE_PIN_PARTITION_DEVICES, since we not only open the devices,
but keep the devices open continously (i.e. we "pin" them).

Also, drop the DISSECT_IMAGE_BLOCK_DEVICE combination flag, since it is
misleading, i.e. it suggests it was appropriate to specify on all
dissected blocking devices, but that's precisely not the case, see the
systemd-gpt-auto-generator case. My guess is that the confusion around
this was actually the cause for this bug we are addressing here.

Fixes: #25528
2022-12-01 11:32:30 +01:00
Ray Strode 9fe26523a1 terminal-util: Set OPOST when setting ONLCR
reset_terminal_fd sets certain minimum required terminal attributes
that systemd relies on.

One of those attributes is `ONLCR` which ensures that when a new line
is sent to the terminal, that the cursor not only moves to the next
line, but also moves to the very beginning of that line.

In order for `ONLCR` to work, the terminal needs to perform output
post-processing. That requires an additional attribute, `OPOST`,
which reset_terminal_fd currently fails to ensure is set.

In most cases `OPOST` (and `ONLCR` actually) are both set anyway, so
it's not an issue, but it could be a problem if, e.g., the terminal was
put in raw mode by a program and the program unexpectedly died before
restoring settings.

This commit ensures when `ONLCR` is set `OPOST` is set too, which is
the only thing that really makes sense to do.
2022-12-01 11:29:21 +01:00
dependabot[bot] 80dd9e2de7 build(deps): bump meson from 0.63.3 to 0.64.1 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 0.63.3 to 0.64.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/0.63.3...0.64.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 10:28:47 +00:00
dependabot[bot] 58a1485fa9 build(deps): bump redhat-plumbers-in-action/differential-shellcheck
Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 3.1.1 to 3.2.1.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/CHANGELOG.md)
- [Commits](1b1b75e42f...f3cd08fcf1)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 10:03:09 +00:00
dependabot[bot] 690e7bfe8f build(deps): bump actions/upload-artifact from 3.1.0 to 3.1.1
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3.1.0...83fd05a356d7e2593de66fc9913b3002723633cb)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 10:02:00 +00:00
dependabot[bot] 073747028b build(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
Bumps [redhat-plumbers-in-action/advanced-issue-labeler](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](fe9c43b7d7...88209aef58)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/advanced-issue-labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 10:01:10 +00:00
Christian Brauner 3734fec727 TODO: add unprivileged nspawn item
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-01 10:42:47 +01:00
Christian Brauner 3922f98212 TODO: add socket reduction entry for nspawn
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-01 10:42:47 +01:00
Christian Brauner fdeabf571a TODO: add CLONE_PARENT entry for nspawn
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-01 10:42:47 +01:00
Christian Brauner 71b77f0689 TODO: consolidate nspawn items
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-01 10:42:47 +01:00
Daan De Meyer 494f7fc096 copy: Add COPY_GRACEFUL_WARN
When copying between filesystems, sometimes the target filesystem
might not support symlinks/fifos/sockets/... and we want to log and
ignore  any failures to copy such files when copying. Let's introduce
a new flag to enable this behavior.
2022-12-01 10:03:31 +01:00
Yu Watanabe 28db63445c
Merge pull request #25578 from mrc0mmand/test-shutdown-tweaks
test: give the container time to properly shut down on exception
2022-12-01 16:37:16 +09:00
Lennart Poettering d25c24d493 update TODO 2022-11-30 17:26:11 +01:00
Frantisek Sumsal 55f7c96c8d test: a couple of pylint-related tweaks 2022-11-30 16:18:50 +01:00
Frantisek Sumsal 8a7032cfb1 test: give the container time to properly shut down on exception
Otherwise the `terminate()` method sends SIGKILL rather quickly (~0.3s),
which then leaves a dangling scope on the host system, breaking further
test executions.
2022-11-30 16:13:19 +01:00
Daan De Meyer 98eb99b7e8
Merge pull request #25574 from bluca/gh_wf
actions: restrict development_freeze to main repo and disable codeql on security repo
2022-11-30 14:28:05 +01:00