History

introduce cloning of fs_context

new primitive: vfs_dup_fs_context(). Comes with fs_context method (->dup()) for copying the filesystem-specific parts of fs_context, along with LSM one (->fs_context_dup()) for doing the same to LSM parts. [needs better commit message, and change of Author:, anyway]

Al Viro committed 7 years ago

Commit 0b520751 parent cb50b347 files · +175 −0Browse files

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

Unified · Split

3 files
  1. include/linux/fs_context.h +2 −0
  2. include/linux/lsm_hooks.h +7 −0
  3. include/linux/security.h +6 −0
include/linux/fs_context.h+2−0
@@ -94,6 +94,7 @@ struct fs_context { · 93 unmodified lines
9494
9595 struct fs_context_operations {
9696 void (*free)(struct fs_context *fc);
97+ int (*dup)(struct fs_context *fc, struct fs_context *src_fc);
9798 int (*parse_param)(struct fs_context *fc, struct fs_parameter *param);
9899 int (*parse_monolithic)(struct fs_context *fc, void *data);
99100 int (*get_tree)(struct fs_context *fc);
@@ -111,6 +112,7 @@ extern struct fs_context *fs_context_for_reconfigure(struct dentry *dentry, · 11 unmodified lines
111112 extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_type,
112113 struct dentry *reference);
113114
115+extern struct fs_context *vfs_dup_fs_context(struct fs_context *fc);
114116 extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);
115117 extern int vfs_parse_fs_string(struct fs_context *fc, const char *key,
116118 const char *value, size_t v_size);
include/linux/lsm_hooks.h+7−0
@@ -79,6 +79,11 @@ · 78 unmodified lines
7979 * Security hooks for mount using fs_context.
8080 * [See also Documentation/filesystems/mounting.txt]
8181 *
82+ * @fs_context_dup:
83+ * Allocate and attach a security structure to sc->security. This pointer
84+ * is initialised to NULL by the caller.
85+ * @fc indicates the new filesystem context.
86+ * @src_fc indicates the original filesystem context.
8287 * @fs_context_parse_param:
8388 * Userspace provided a parameter to configure a superblock. The LSM may
8489 * reject it with an error and may use it for itself, in which case it
@@ -1470,6 +1475,7 @@ union security_list_options { · 1385 unmodified lines
14701475 void (*bprm_committing_creds)(struct linux_binprm *bprm);
14711476 void (*bprm_committed_creds)(struct linux_binprm *bprm);
14721477
1478+ int (*fs_context_dup)(struct fs_context *fc, struct fs_context *src_sc);
14731479 int (*fs_context_parse_param)(struct fs_context *fc, struct fs_parameter *param);
14741480
14751481 int (*sb_alloc_security)(struct super_block *sb);
@@ -1813,6 +1819,7 @@ struct security_hook_heads { · 337 unmodified lines
18131819 struct hlist_head bprm_check_security;
18141820 struct hlist_head bprm_committing_creds;
18151821 struct hlist_head bprm_committed_creds;
1822+ struct hlist_head fs_context_dup;
18161823 struct hlist_head fs_context_parse_param;
18171824 struct hlist_head sb_alloc_security;
18181825 struct hlist_head sb_free_security;
include/linux/security.h+6−0
@@ -223,6 +223,7 @@ int security_bprm_set_creds(struct linux_binprm *bprm); · 222 unmodified lines
223223 int security_bprm_check(struct linux_binprm *bprm);
224224 void security_bprm_committing_creds(struct linux_binprm *bprm);
225225 void security_bprm_committed_creds(struct linux_binprm *bprm);
226+int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc);
226227 int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param);
227228 int security_sb_alloc(struct super_block *sb);
228229 void security_sb_free(struct super_block *sb);
@@ -521,6 +522,11 @@ static inline void security_bprm_committed_creds(struct linux_binprm *bprm) · 292 unmodified lines
521522 {
522523 }
523524
525+static inline int security_fs_context_dup(struct fs_context *fc,
526+ struct fs_context *src_fc)
527+{
528+ return 0;
529+}
524530 static inline int security_fs_context_parse_param(struct fs_context *fc,
525531 struct fs_parameter *param)
526532 {

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