From 33dfc944ce35d9274ec27ea60831f3e1e2318b61 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Mon, 25 Aug 2008 21:57:57 +0000 Subject: [PATCH] Handle read-only bind-mounts the new way. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2774 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- src/secure-mount.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/secure-mount.c b/src/secure-mount.c index a76f7a0..6dc2c41 100644 --- a/src/secure-mount.c +++ b/src/secure-mount.c @@ -436,6 +436,20 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt) perror("secure-mount: mount()"); return false; } + if ((mnt->flag & MS_BIND) && + (mnt->flag & ~(MS_BIND|MS_REC))) { + /* This is needed to put us in the new mountpoint */ + if (!secureChdir(mnt->dst, opt)) + return false; + if (mount(mnt->src, ".", + mnt->type ? mnt->type : "", + ((mnt->flag & ~(MS_BIND|MS_REC)) | + MS_REMOUNT), NULL) == -1 && + errno != EBUSY) { /* Returned on older kernels */ + perror("secure-mount: mount()"); + return false; + } + } } else if (!callExternalMount(mnt)) return false; -- 1.8.1.5