aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lsm_hooks.h
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2016-07-13 11:13:56 -0400
committerPaul Moore <paul@paul-moore.com>2016-08-08 20:06:53 -0400
commitd8ad8b49618410ddeafd78465b63a6cedd6c9484 (patch)
tree7e03ed05fdfae31da74e34856d2f9c718f896c6e /include/linux/lsm_hooks.h
parent8b31f456c72e53ee97474a538bcd91bfb1b93fb7 (diff)
security, overlayfs: provide copy up security hook for unioned files
Provide a security hook to label new file correctly when a file is copied up from lower layer to upper layer of a overlay/union mount. This hook can prepare a new set of creds which are suitable for new file creation during copy up. Caller will use new creds to create file and then revert back to old creds and release new creds. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> [PM: whitespace cleanup to appease checkpatch.pl] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'include/linux/lsm_hooks.h')
-rw-r--r--include/linux/lsm_hooks.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 101bf19c0f41..cb69fc829053 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -401,6 +401,15 @@
401 * @inode contains a pointer to the inode. 401 * @inode contains a pointer to the inode.
402 * @secid contains a pointer to the location where result will be saved. 402 * @secid contains a pointer to the location where result will be saved.
403 * In case of failure, @secid will be set to zero. 403 * In case of failure, @secid will be set to zero.
404 * @inode_copy_up:
405 * A file is about to be copied up from lower layer to upper layer of
406 * overlay filesystem. Security module can prepare a set of new creds
407 * and modify as need be and return new creds. Caller will switch to
408 * new creds temporarily to create new file and release newly allocated
409 * creds.
410 * @src indicates the union dentry of file that is being copied up.
411 * @new pointer to pointer to return newly allocated creds.
412 * Returns 0 on success or a negative error code on error.
404 * 413 *
405 * Security hooks for file operations 414 * Security hooks for file operations
406 * 415 *
@@ -1425,6 +1434,7 @@ union security_list_options {
1425 int (*inode_listsecurity)(struct inode *inode, char *buffer, 1434 int (*inode_listsecurity)(struct inode *inode, char *buffer,
1426 size_t buffer_size); 1435 size_t buffer_size);
1427 void (*inode_getsecid)(struct inode *inode, u32 *secid); 1436 void (*inode_getsecid)(struct inode *inode, u32 *secid);
1437 int (*inode_copy_up)(struct dentry *src, struct cred **new);
1428 1438
1429 int (*file_permission)(struct file *file, int mask); 1439 int (*file_permission)(struct file *file, int mask);
1430 int (*file_alloc_security)(struct file *file); 1440 int (*file_alloc_security)(struct file *file);
@@ -1696,6 +1706,7 @@ struct security_hook_heads {
1696 struct list_head inode_setsecurity; 1706 struct list_head inode_setsecurity;
1697 struct list_head inode_listsecurity; 1707 struct list_head inode_listsecurity;
1698 struct list_head inode_getsecid; 1708 struct list_head inode_getsecid;
1709 struct list_head inode_copy_up;
1699 struct list_head file_permission; 1710 struct list_head file_permission;
1700 struct list_head file_alloc_security; 1711 struct list_head file_alloc_security;
1701 struct list_head file_free_security; 1712 struct list_head file_free_security;