repart: Ensure files end up owned by root in generated filesystems
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 10 Oct 2022 21:34:04 +0000 (23:34 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 15 Nov 2022 19:23:51 +0000 (20:23 +0100)
commite59678b2cf42e4206ddabc959d3cf9a5a865ecdc
tree642586af7da65432b6d4398a8187e411e477e2b6
parentcf2ed23cd23d1236086280db1947fe7099caba9a
repart: Ensure files end up owned by root in generated filesystems

By forking off a user namespace before running mkfs and ID mapping
the user running repart to root in the user namespace, we can make
sure that files in the generated filesystems are all owned by root
instead of the user running repart.

To make this work we have to make sure that all the files in the
root directory that's passed to the mkfs binary are owned by the
user running repart, so we have to drop the shortcut for only a
single root directory in partition_populate_directory().
src/partition/repart.c
src/shared/mkfs-util.c