lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu,  5 Apr 2018 12:45:47 +0200
From:   Christian Brauner <christian.brauner@...ntu.com>
To:     ebiederm@...ssion.com, torvalds@...ux-foundation.o,
        viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org
Cc:     Christian Brauner <christian.brauner@...ntu.com>
Subject: [PATCH 1/3] namei: add follow_up_bind()

This adds a new helper for resolving bind-mounts.

Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
---
 fs/namei.c            | 10 ++++++++++
 include/linux/namei.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/fs/namei.c b/fs/namei.c
index a09419379f5d..4fa56ec78f63 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1085,6 +1085,16 @@ int follow_up(struct path *path)
 }
 EXPORT_SYMBOL(follow_up);
 
+/*
+ * follow_up_bind - Resolve bind-mounts to mountpoint of path's vfsmount
+ */
+inline void follow_up_bind(struct path *path)
+{
+	while (path->mnt->mnt_root == path->dentry && follow_up(path))
+		;
+}
+EXPORT_SYMBOL(follow_up_bind);
+
 /*
  * Perform an automount
  * - return -EISDIR to tell follow_managed() to stop and return the path we
diff --git a/include/linux/namei.h b/include/linux/namei.h
index a982bb7cd480..ea93127be26c 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -87,6 +87,7 @@ extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int
 extern int follow_down_one(struct path *);
 extern int follow_down(struct path *);
 extern int follow_up(struct path *);
+extern void follow_up_bind(struct path *path);
 
 extern struct dentry *lock_rename(struct dentry *, struct dentry *);
 extern void unlock_rename(struct dentry *, struct dentry *);
-- 
2.15.1

Powered by blists - more mailing lists