History

vfs: syscall: Add move_mount(2) to move mounts around

Add a move_mount() system call that will move a mount from one place to another and, in the next commit, allow to attach an unattached mount tree. The new system call looks like the following: int move_mount(int from_dfd, const char *from_path, int to_dfd, const char *to_path, unsigned int flags);

David Howells committed 8 years ago

Commit 2db154b1 parent a07b2008 files · +130 −32Browse files

Showing the changes to include/linux (3 of 8 files). Show all

Unified · Split

3 files
  1. include/linux/lsm_hooks.h +6 −0
  2. include/linux/security.h +7 −0
  3. include/linux/syscalls.h +3 −0
include/linux/lsm_hooks.h+6−0
@@ -160,6 +160,10 @@ · 159 unmodified lines
160160 * Parse a string of security data filling in the opts structure
161161 * @options string containing all mount options known by the LSM
162162 * @opts binary data structure usable by the LSM
163+ * @move_mount:
164+ * Check permission before a mount is moved.
165+ * @from_path indicates the mount that is going to be moved.
166+ * @to_path indicates the mountpoint that will be mounted upon.
163167 * @dentry_init_security:
164168 * Compute a context for a dentry as the inode is not yet available
165169 * since NFSv4 has no label backed by an EA anyway.
@@ -1501,6 +1505,7 @@ union security_list_options { · 1335 unmodified lines
15011505 unsigned long *set_kern_flags);
15021506 int (*sb_add_mnt_opt)(const char *option, const char *val, int len,
15031507 void **mnt_opts);
1508+ int (*move_mount)(const struct path *from_path, const struct path *to_path);
15041509 int (*dentry_init_security)(struct dentry *dentry, int mode,
15051510 const struct qstr *name, void **ctx,
15061511 u32 *ctxlen);
@@ -1835,6 +1840,7 @@ struct security_hook_heads { · 328 unmodified lines
18351840 struct hlist_head sb_set_mnt_opts;
18361841 struct hlist_head sb_clone_mnt_opts;
18371842 struct hlist_head sb_add_mnt_opt;
1843+ struct hlist_head move_mount;
18381844 struct hlist_head dentry_init_security;
18391845 struct hlist_head dentry_create_files_as;
18401846 #ifdef CONFIG_SECURITY_PATH
include/linux/security.h+7−0
@@ -250,6 +250,7 @@ int security_sb_clone_mnt_opts(const struct super_block *oldsb, · 249 unmodified lines
250250 unsigned long *set_kern_flags);
251251 int security_add_mnt_opt(const char *option, const char *val,
252252 int len, void **mnt_opts);
253+int security_move_mount(const struct path *from_path, const struct path *to_path);
253254 int security_dentry_init_security(struct dentry *dentry, int mode,
254255 const struct qstr *name, void **ctx,
255256 u32 *ctxlen);
@@ -611,6 +612,12 @@ static inline int security_add_mnt_opt(const char *option, const char *val, · 355 unmodified lines
611612 return 0;
612613 }
613614
615+static inline int security_move_mount(const struct path *from_path,
616+ const struct path *to_path)
617+{
618+ return 0;
619+}
620+
614621 static inline int security_inode_alloc(struct inode *inode)
615622 {
616623 return 0;
include/linux/syscalls.h+3−0
@@ -986,6 +986,9 @@ asmlinkage long sys_statx(int dfd, const char __user *path, unsigned flags, · 985 unmodified lines
986986 asmlinkage long sys_rseq(struct rseq __user *rseq, uint32_t rseq_len,
987987 int flags, uint32_t sig);
988988 asmlinkage long sys_open_tree(int dfd, const char __user *path, unsigned flags);
989+asmlinkage long sys_move_mount(int from_dfd, const char __user *from_path,
990+ int to_dfd, const char __user *to_path,
991+ unsigned int ms_flags);
989992 asmlinkage long sys_pidfd_send_signal(int pidfd, int sig,
990993 siginfo_t __user *info,
991994 unsigned int flags);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t