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]
Showing the changes to include/linux (3 of 7 files). Show all
Unified · Split
| @@ -94,6 +94,7 @@ struct fs_context { · 93 unmodified lines | |||
| 94 | 94 | ||
| 95 | struct fs_context_operations { | 95 | struct 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 | |||
| 111 | extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_type, | 112 | extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_type, |
| 112 | struct dentry *reference); | 113 | struct dentry *reference); |
| 113 | 114 | ||
| 115 | extern struct fs_context *vfs_dup_fs_context(struct fs_context *fc); | ||
| 114 | extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param); | 116 | extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param); |
| 115 | extern int vfs_parse_fs_string(struct fs_context *fc, const char *key, | 117 | extern 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); |
| @@ -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 may | 88 | * 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 it | 89 | * 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; |
| @@ -223,6 +223,7 @@ int security_bprm_set_creds(struct linux_binprm *bprm); · 222 unmodified lines | |||
| 223 | int security_bprm_check(struct linux_binprm *bprm); | 223 | int security_bprm_check(struct linux_binprm *bprm); |
| 224 | void security_bprm_committing_creds(struct linux_binprm *bprm); | 224 | void security_bprm_committing_creds(struct linux_binprm *bprm); |
| 225 | void security_bprm_committed_creds(struct linux_binprm *bprm); | 225 | void security_bprm_committed_creds(struct linux_binprm *bprm); |
| 226 | int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc); | ||
| 226 | int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param); | 227 | int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param); |
| 227 | int security_sb_alloc(struct super_block *sb); | 228 | int security_sb_alloc(struct super_block *sb); |
| 228 | void security_sb_free(struct super_block *sb); | 229 | 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 | |||
| 521 | { | 522 | { |
| 522 | } | 523 | } |
| 523 | 524 | ||
| 525 | static inline int security_fs_context_dup(struct fs_context *fc, | ||
| 526 | struct fs_context *src_fc) | ||
| 527 | { | ||
| 528 | return 0; | ||
| 529 | } | ||
| 524 | static inline int security_fs_context_parse_param(struct fs_context *fc, | 530 | static inline int security_fs_context_parse_param(struct fs_context *fc, |
| 525 | struct fs_parameter *param) | 531 | struct fs_parameter *param) |
| 526 | { | 532 | { |