nspawn: make sure to chown() implicit source dirs for --bind= to container root UID
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Oct 2021 13:10:42 +0000 (15:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 29 Oct 2021 07:16:34 +0000 (09:16 +0200)
commit07bca16fc8b2e3de770a8d6d2910321091765efc
tree1b886a806d6c346e58759088e2f19bdea7971812
parentd36a343c52967a89926b3b0e525105382331dfba
nspawn: make sure to chown() implicit source dirs for --bind= to container root UID

This makes sure that a switch like --bind=:/foo does the right thing if
user namespacing is one: the backing dir should be owned by the
container's root UID not the host's. Thus, whenever the source path is
left empty and we automatically generate a source dir as temporary
directory, ensure it's owned by the right UID.

Fixes: #20869
src/nspawn/nspawn-mount.c