Skip to content

Commit

Permalink
cmd/snap-confine: fix exploding homedirs bug
Browse files Browse the repository at this point in the history
The combination of snap set system homedirs=/var/lib/ and a snap that causes a
mimic to be created over /var/lib is sufficient to leak over to the initial
mount namespace.

Fixes: https://warthogs.atlassian.net/browse/SNAPDENG-17066

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
  • Loading branch information
zyga authored and bboozzoo committed Mar 1, 2024
1 parent a910533 commit 1aaf325
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/snap-confine/mount-support.c
Expand Up @@ -927,7 +927,8 @@ static struct sc_mount *sc_homedir_mounts(const struct sc_invocation *inv)
for (int i = 0; i < inv->num_homedirs; i++) {
debug("Adding homedir: %s", inv->homedirs[i]);
mounts[i].path = sc_strdup(inv->homedirs[i]);
mounts[i].is_bidirectional = true;
// Note that we are not setting bidirectional flag, so anything mounted
// here will not propagate to the host.
}
return mounts;
}
Expand Down

0 comments on commit 1aaf325

Please sign in to comment.