Pass the ID map to virtiofsd, which will run the suid `newuidmap`
binary for us.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_virtiofs.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
index 230f85c291..af51d58673 100644
--- a/src/qemu/qemu_virtiofs.c
+++ b/src/qemu/qemu_virtiofs.c
@@ -131,6 +131,7 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
{
g_autoptr(virCommand) cmd = NULL;
g_auto(virBuffer) opts = VIR_BUFFER_INITIALIZER;
+ size_t i = 4;
cmd = virCommandNew(fs->binary);
@@ -169,6 +170,20 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
if (cfg->virtiofsdDebug)
virCommandAddArg(cmd, "-d");
+ for (i = 0; i < fs->idmap.nuidmap; i++) {
+ virCommandAddArgFormat(cmd, "--uid-map=:%u:%u:%u:",
+ fs->idmap.uidmap[i].start,
+ fs->idmap.uidmap[i].target,
+ fs->idmap.uidmap[i].count);
+ }
+
+ for (i = 0; i < fs->idmap.ngidmap; i++) {
+ virCommandAddArgFormat(cmd, "--gid-map=:%u:%u:%u:",
+ fs->idmap.gidmap[i].start,
+ fs->idmap.gidmap[i].target,
+ fs->idmap.gidmap[i].count);
+ }
+
return g_steal_pointer(&cmd);
}
--
2.42.0