]> git.ipfire.org Git - thirdparty/systemd.git/commit
discover-image: Follow symlinks in a given root
authorKai Lueke <kailuke@microsoft.com>
Thu, 20 Nov 2025 14:43:55 +0000 (23:43 +0900)
committerKai Lüke <kailueke@riseup.net>
Wed, 28 Jan 2026 11:24:57 +0000 (12:24 +0100)
commit5c6bb289990ba53898cbc62db6e732ecb9dc87ac
tree5b0751c99351e6b7698968b58d9a2de3d0317e70
parenta8b099d663e995fcea2490e6b132c953882b0649
discover-image: Follow symlinks in a given root

So far systemd-sysext with --root= specified didn't follow extension
symlinks (such as the "current" symlinks managed by systemd-sysupdate).
The main use case is running systemd-sysext --root=/sysroot for setting
up the overlay mounts already from the initrd.

Resolve symlinks correctly but don't defend against later symlink races
that would access a path outside of the given root. Malicous live
modifications are not a realistic threat model and anyway for that one
would need to rework how the image entry is passed over up to the point
when the loop device is set up. This change here does not introduce this
weakness nor does it expose it more than before. Thus, make it explicit
that setting up the extensions for a given --root= implies a certain
trust into this given root tree that it does not try do race conditions
with symlinks to trick systemd-sysext to mount a file outside --root=.
Without a strict --image-policy= set we would anyway mount filesystems
right away which is another attack vector but, again, the main use case
is to do this for the final system which is trusted at this stage.
src/shared/discover-image.c
src/shared/vpick.c