diff options
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 239e40d0450b..2c627d361c02 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -95,8 +95,13 @@ struct seq_file; | |||
95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
97 | 97 | ||
98 | #ifdef CONFIG_MMU | ||
98 | extern unsigned long mmap_min_addr; | 99 | extern unsigned long mmap_min_addr; |
99 | extern unsigned long dac_mmap_min_addr; | 100 | extern unsigned long dac_mmap_min_addr; |
101 | #else | ||
102 | #define dac_mmap_min_addr 0UL | ||
103 | #endif | ||
104 | |||
100 | /* | 105 | /* |
101 | * Values used in the task_security_ops calls | 106 | * Values used in the task_security_ops calls |
102 | */ | 107 | */ |
@@ -121,6 +126,7 @@ struct request_sock; | |||
121 | #define LSM_UNSAFE_PTRACE 2 | 126 | #define LSM_UNSAFE_PTRACE 2 |
122 | #define LSM_UNSAFE_PTRACE_CAP 4 | 127 | #define LSM_UNSAFE_PTRACE_CAP 4 |
123 | 128 | ||
129 | #ifdef CONFIG_MMU | ||
124 | /* | 130 | /* |
125 | * If a hint addr is less than mmap_min_addr change hint to be as | 131 | * If a hint addr is less than mmap_min_addr change hint to be as |
126 | * low as possible but still greater than mmap_min_addr | 132 | * low as possible but still greater than mmap_min_addr |
@@ -135,6 +141,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint) | |||
135 | } | 141 | } |
136 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, | 142 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, |
137 | void __user *buffer, size_t *lenp, loff_t *ppos); | 143 | void __user *buffer, size_t *lenp, loff_t *ppos); |
144 | #endif | ||
138 | 145 | ||
139 | #ifdef CONFIG_SECURITY | 146 | #ifdef CONFIG_SECURITY |
140 | 147 | ||
@@ -447,6 +454,22 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
447 | * @new_dir contains the path structure for parent of the new link. | 454 | * @new_dir contains the path structure for parent of the new link. |
448 | * @new_dentry contains the dentry structure of the new link. | 455 | * @new_dentry contains the dentry structure of the new link. |
449 | * Return 0 if permission is granted. | 456 | * Return 0 if permission is granted. |
457 | * @path_chmod: | ||
458 | * Check for permission to change DAC's permission of a file or directory. | ||
459 | * @dentry contains the dentry structure. | ||
460 | * @mnt contains the vfsmnt structure. | ||
461 | * @mode contains DAC's mode. | ||
462 | * Return 0 if permission is granted. | ||
463 | * @path_chown: | ||
464 | * Check for permission to change owner/group of a file or directory. | ||
465 | * @path contains the path structure. | ||
466 | * @uid contains new owner's ID. | ||
467 | * @gid contains new group's ID. | ||
468 | * Return 0 if permission is granted. | ||
469 | * @path_chroot: | ||
470 | * Check for permission to change root directory. | ||
471 | * @path contains the path structure. | ||
472 | * Return 0 if permission is granted. | ||
450 | * @inode_readlink: | 473 | * @inode_readlink: |
451 | * Check the permission to read the symbolic link. | 474 | * Check the permission to read the symbolic link. |
452 | * @dentry contains the dentry structure for the file link. | 475 | * @dentry contains the dentry structure for the file link. |
@@ -690,6 +713,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
690 | * @kernel_module_request: | 713 | * @kernel_module_request: |
691 | * Ability to trigger the kernel to automatically upcall to userspace for | 714 | * Ability to trigger the kernel to automatically upcall to userspace for |
692 | * userspace to load a kernel module with the given name. | 715 | * userspace to load a kernel module with the given name. |
716 | * @kmod_name name of the module requested by the kernel | ||
693 | * Return 0 if successful. | 717 | * Return 0 if successful. |
694 | * @task_setuid: | 718 | * @task_setuid: |
695 | * Check permission before setting one or more of the user identity | 719 | * Check permission before setting one or more of the user identity |
@@ -1488,6 +1512,10 @@ struct security_operations { | |||
1488 | struct dentry *new_dentry); | 1512 | struct dentry *new_dentry); |
1489 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, | 1513 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, |
1490 | struct path *new_dir, struct dentry *new_dentry); | 1514 | struct path *new_dir, struct dentry *new_dentry); |
1515 | int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, | ||
1516 | mode_t mode); | ||
1517 | int (*path_chown) (struct path *path, uid_t uid, gid_t gid); | ||
1518 | int (*path_chroot) (struct path *path); | ||
1491 | #endif | 1519 | #endif |
1492 | 1520 | ||
1493 | int (*inode_alloc_security) (struct inode *inode); | 1521 | int (*inode_alloc_security) (struct inode *inode); |
@@ -1557,7 +1585,7 @@ struct security_operations { | |||
1557 | void (*cred_transfer)(struct cred *new, const struct cred *old); | 1585 | void (*cred_transfer)(struct cred *new, const struct cred *old); |
1558 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1586 | int (*kernel_act_as)(struct cred *new, u32 secid); |
1559 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1587 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
1560 | int (*kernel_module_request)(void); | 1588 | int (*kernel_module_request)(char *kmod_name); |
1561 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); | 1589 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); |
1562 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, | 1590 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, |
1563 | int flags); | 1591 | int flags); |
@@ -1822,7 +1850,7 @@ void security_commit_creds(struct cred *new, const struct cred *old); | |||
1822 | void security_transfer_creds(struct cred *new, const struct cred *old); | 1850 | void security_transfer_creds(struct cred *new, const struct cred *old); |
1823 | int security_kernel_act_as(struct cred *new, u32 secid); | 1851 | int security_kernel_act_as(struct cred *new, u32 secid); |
1824 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); | 1852 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); |
1825 | int security_kernel_module_request(void); | 1853 | int security_kernel_module_request(char *kmod_name); |
1826 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); | 1854 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); |
1827 | int security_task_fix_setuid(struct cred *new, const struct cred *old, | 1855 | int security_task_fix_setuid(struct cred *new, const struct cred *old, |
1828 | int flags); | 1856 | int flags); |
@@ -2387,7 +2415,7 @@ static inline int security_kernel_create_files_as(struct cred *cred, | |||
2387 | return 0; | 2415 | return 0; |
2388 | } | 2416 | } |
2389 | 2417 | ||
2390 | static inline int security_kernel_module_request(void) | 2418 | static inline int security_kernel_module_request(char *kmod_name) |
2391 | { | 2419 | { |
2392 | return 0; | 2420 | return 0; |
2393 | } | 2421 | } |
@@ -2952,6 +2980,10 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, | |||
2952 | struct dentry *new_dentry); | 2980 | struct dentry *new_dentry); |
2953 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | 2981 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, |
2954 | struct path *new_dir, struct dentry *new_dentry); | 2982 | struct path *new_dir, struct dentry *new_dentry); |
2983 | int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, | ||
2984 | mode_t mode); | ||
2985 | int security_path_chown(struct path *path, uid_t uid, gid_t gid); | ||
2986 | int security_path_chroot(struct path *path); | ||
2955 | #else /* CONFIG_SECURITY_PATH */ | 2987 | #else /* CONFIG_SECURITY_PATH */ |
2956 | static inline int security_path_unlink(struct path *dir, struct dentry *dentry) | 2988 | static inline int security_path_unlink(struct path *dir, struct dentry *dentry) |
2957 | { | 2989 | { |
@@ -3001,6 +3033,23 @@ static inline int security_path_rename(struct path *old_dir, | |||
3001 | { | 3033 | { |
3002 | return 0; | 3034 | return 0; |
3003 | } | 3035 | } |
3036 | |||
3037 | static inline int security_path_chmod(struct dentry *dentry, | ||
3038 | struct vfsmount *mnt, | ||
3039 | mode_t mode) | ||
3040 | { | ||
3041 | return 0; | ||
3042 | } | ||
3043 | |||
3044 | static inline int security_path_chown(struct path *path, uid_t uid, gid_t gid) | ||
3045 | { | ||
3046 | return 0; | ||
3047 | } | ||
3048 | |||
3049 | static inline int security_path_chroot(struct path *path) | ||
3050 | { | ||
3051 | return 0; | ||
3052 | } | ||
3004 | #endif /* CONFIG_SECURITY_PATH */ | 3053 | #endif /* CONFIG_SECURITY_PATH */ |
3005 | 3054 | ||
3006 | #ifdef CONFIG_KEYS | 3055 | #ifdef CONFIG_KEYS |