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
94 94
95struct fs_context_operations {95struct fs_context_operations {
96 void (*free)(struct fs_context *fc);96 void (*free)(struct fs_context *fc);
97 int (*dup)(struct fs_context *fc, struct fs_context *src_fc);
97 int (*parse_param)(struct fs_context *fc, struct fs_parameter *param);98 int (*parse_param)(struct fs_context *fc, struct fs_parameter *param);
98 int (*parse_monolithic)(struct fs_context *fc, void *data);99 int (*parse_monolithic)(struct fs_context *fc, void *data);
99 int (*get_tree)(struct fs_context *fc);100 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
111extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_type,112extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_type,
112 struct dentry *reference);113 struct dentry *reference);
113 114
115extern struct fs_context *vfs_dup_fs_context(struct fs_context *fc);
114extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);116extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);
115extern int vfs_parse_fs_string(struct fs_context *fc, const char *key,117extern int vfs_parse_fs_string(struct fs_context *fc, const char *key,
116 const char *value, size_t v_size);118 const char *value, size_t v_size);
include/linux/lsm_hooks.h+7−0
@@ -79,6 +79,11 @@ · 78 unmodified lines
79 * Security hooks for mount using fs_context.79 * Security hooks for mount using fs_context.
80 * [See also Documentation/filesystems/mounting.txt]80 * [See also Documentation/filesystems/mounting.txt]
81 *81 *
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.
82 * @fs_context_parse_param:87 * @fs_context_parse_param:
83 * Userspace provided a parameter to configure a superblock. The LSM may88 * Userspace provided a parameter to configure a superblock. The LSM may
84 * reject it with an error and may use it for itself, in which case it89 * 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
1470 void (*bprm_committing_creds)(struct linux_binprm *bprm);1475 void (*bprm_committing_creds)(struct linux_binprm *bprm);
1471 void (*bprm_committed_creds)(struct linux_binprm *bprm);1476 void (*bprm_committed_creds)(struct linux_binprm *bprm);
1472 1477
1478 int (*fs_context_dup)(struct fs_context *fc, struct fs_context *src_sc);
1473 int (*fs_context_parse_param)(struct fs_context *fc, struct fs_parameter *param);1479 int (*fs_context_parse_param)(struct fs_context *fc, struct fs_parameter *param);
1474 1480
1475 int (*sb_alloc_security)(struct super_block *sb);1481 int (*sb_alloc_security)(struct super_block *sb);
@@ -1813,6 +1819,7 @@ struct security_hook_heads { · 337 unmodified lines
1813 struct hlist_head bprm_check_security;1819 struct hlist_head bprm_check_security;
1814 struct hlist_head bprm_committing_creds;1820 struct hlist_head bprm_committing_creds;
1815 struct hlist_head bprm_committed_creds;1821 struct hlist_head bprm_committed_creds;
1822 struct hlist_head fs_context_dup;
1816 struct hlist_head fs_context_parse_param;1823 struct hlist_head fs_context_parse_param;
1817 struct hlist_head sb_alloc_security;1824 struct hlist_head sb_alloc_security;
1818 struct hlist_head sb_free_security;1825 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
223int security_bprm_check(struct linux_binprm *bprm);223int security_bprm_check(struct linux_binprm *bprm);
224void security_bprm_committing_creds(struct linux_binprm *bprm);224void security_bprm_committing_creds(struct linux_binprm *bprm);
225void security_bprm_committed_creds(struct linux_binprm *bprm);225void security_bprm_committed_creds(struct linux_binprm *bprm);
226int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc);
226int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param);227int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param);
227int security_sb_alloc(struct super_block *sb);228int security_sb_alloc(struct super_block *sb);
228void security_sb_free(struct super_block *sb);229void 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
521{522{
522}523}
523 524
525static inline int security_fs_context_dup(struct fs_context *fc,
526 struct fs_context *src_fc)
527{
528 return 0;
529}
524static inline int security_fs_context_parse_param(struct fs_context *fc,530static inline int security_fs_context_parse_param(struct fs_context *fc,
525 struct fs_parameter *param)531 struct fs_parameter *param)
526{532{

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