diff options
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index fd96e7f8a6f9..80c4d002864c 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -46,8 +46,8 @@ struct audit_krule; | |||
46 | */ | 46 | */ |
47 | extern int cap_capable(struct task_struct *tsk, int cap); | 47 | extern int cap_capable(struct task_struct *tsk, int cap); |
48 | extern int cap_settime(struct timespec *ts, struct timezone *tz); | 48 | extern int cap_settime(struct timespec *ts, struct timezone *tz); |
49 | extern int cap_ptrace(struct task_struct *parent, struct task_struct *child, | 49 | extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); |
50 | unsigned int mode); | 50 | extern int cap_ptrace_traceme(struct task_struct *parent); |
51 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 51 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
52 | extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 52 | extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
53 | extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 53 | extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
@@ -1157,17 +1157,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1157 | * @alter contains the flag indicating whether changes are to be made. | 1157 | * @alter contains the flag indicating whether changes are to be made. |
1158 | * Return 0 if permission is granted. | 1158 | * Return 0 if permission is granted. |
1159 | * | 1159 | * |
1160 | * @ptrace: | 1160 | * @ptrace_may_access: |
1161 | * Check permission before allowing the @parent process to trace the | 1161 | * Check permission before allowing the current process to trace the |
1162 | * @child process. | 1162 | * @child process. |
1163 | * Security modules may also want to perform a process tracing check | 1163 | * Security modules may also want to perform a process tracing check |
1164 | * during an execve in the set_security or apply_creds hooks of | 1164 | * during an execve in the set_security or apply_creds hooks of |
1165 | * binprm_security_ops if the process is being traced and its security | 1165 | * binprm_security_ops if the process is being traced and its security |
1166 | * attributes would be changed by the execve. | 1166 | * attributes would be changed by the execve. |
1167 | * @parent contains the task_struct structure for parent process. | 1167 | * @child contains the task_struct structure for the target process. |
1168 | * @child contains the task_struct structure for child process. | ||
1169 | * @mode contains the PTRACE_MODE flags indicating the form of access. | 1168 | * @mode contains the PTRACE_MODE flags indicating the form of access. |
1170 | * Return 0 if permission is granted. | 1169 | * Return 0 if permission is granted. |
1170 | * @ptrace_traceme: | ||
1171 | * Check that the @parent process has sufficient permission to trace the | ||
1172 | * current process before allowing the current process to present itself | ||
1173 | * to the @parent process for tracing. | ||
1174 | * The parent process will still have to undergo the ptrace_may_access | ||
1175 | * checks before it is allowed to trace this one. | ||
1176 | * @parent contains the task_struct structure for debugger process. | ||
1177 | * Return 0 if permission is granted. | ||
1171 | * @capget: | 1178 | * @capget: |
1172 | * Get the @effective, @inheritable, and @permitted capability sets for | 1179 | * Get the @effective, @inheritable, and @permitted capability sets for |
1173 | * the @target process. The hook may also perform permission checking to | 1180 | * the @target process. The hook may also perform permission checking to |
@@ -1287,8 +1294,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1287 | struct security_operations { | 1294 | struct security_operations { |
1288 | char name[SECURITY_NAME_MAX + 1]; | 1295 | char name[SECURITY_NAME_MAX + 1]; |
1289 | 1296 | ||
1290 | int (*ptrace) (struct task_struct *parent, struct task_struct *child, | 1297 | int (*ptrace_may_access) (struct task_struct *child, unsigned int mode); |
1291 | unsigned int mode); | 1298 | int (*ptrace_traceme) (struct task_struct *parent); |
1292 | int (*capget) (struct task_struct *target, | 1299 | int (*capget) (struct task_struct *target, |
1293 | kernel_cap_t *effective, | 1300 | kernel_cap_t *effective, |
1294 | kernel_cap_t *inheritable, kernel_cap_t *permitted); | 1301 | kernel_cap_t *inheritable, kernel_cap_t *permitted); |
@@ -1560,8 +1567,8 @@ extern struct dentry *securityfs_create_dir(const char *name, struct dentry *par | |||
1560 | extern void securityfs_remove(struct dentry *dentry); | 1567 | extern void securityfs_remove(struct dentry *dentry); |
1561 | 1568 | ||
1562 | /* Security operations */ | 1569 | /* Security operations */ |
1563 | int security_ptrace(struct task_struct *parent, struct task_struct *child, | 1570 | int security_ptrace_may_access(struct task_struct *child, unsigned int mode); |
1564 | unsigned int mode); | 1571 | int security_ptrace_traceme(struct task_struct *parent); |
1565 | int security_capget(struct task_struct *target, | 1572 | int security_capget(struct task_struct *target, |
1566 | kernel_cap_t *effective, | 1573 | kernel_cap_t *effective, |
1567 | kernel_cap_t *inheritable, | 1574 | kernel_cap_t *inheritable, |
@@ -1742,11 +1749,15 @@ static inline int security_init(void) | |||
1742 | return 0; | 1749 | return 0; |
1743 | } | 1750 | } |
1744 | 1751 | ||
1745 | static inline int security_ptrace(struct task_struct *parent, | 1752 | static inline int security_ptrace_may_access(struct task_struct *child, |
1746 | struct task_struct *child, | 1753 | unsigned int mode) |
1747 | unsigned int mode) | 1754 | { |
1755 | return cap_ptrace_may_access(child, mode); | ||
1756 | } | ||
1757 | |||
1758 | static inline int security_ptrace_traceme(struct task_struct *parent) | ||
1748 | { | 1759 | { |
1749 | return cap_ptrace(parent, child, mode); | 1760 | return cap_ptrace_traceme(parent); |
1750 | } | 1761 | } |
1751 | 1762 | ||
1752 | static inline int security_capget(struct task_struct *target, | 1763 | static inline int security_capget(struct task_struct *target, |