[CRIU] [PATCH 3/2->4] fsnotify: Open by handle via userns_call

Pavel Emelyanov xemul at parallels.com
Thu Feb 12 06:59:12 PST 2015


The syscall in question requires global CAP_DAC_READ_SEARCH.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 fsnotify.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fsnotify.c b/fsnotify.c
index 985edcf..f84252b 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -102,6 +102,11 @@ static void decode_handle(fh_t *handle, FhEntry *img)
 				sizeof(handle->__handle)));
 }
 
+static int open_by_handle(void *arg, int fd)
+{
+	return sys_open_by_handle_at(fd, arg, O_PATH);
+}
+
 static int open_handle(unsigned int s_dev, unsigned long i_ino,
 		FhEntry *f_handle)
 {
@@ -119,7 +124,7 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino,
 		goto out;
 	}
 
-	fd = sys_open_by_handle_at(mntfd, (void *)&handle, O_PATH);
+	fd = userns_call(open_by_handle, UNS_FDOUT, &handle, sizeof(handle), mntfd);
 	if (fd < 0) {
 		errno = -fd;
 		pr_perror("Can't open file handle for 0x%08x:0x%016lx",
-- 
1.8.4.2




More information about the CRIU mailing list