diff options
Diffstat (limited to 'security/commoncap.c')
| -rw-r--r-- | security/commoncap.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 48b7e0228fa3..fe30751a6cd9 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
| @@ -101,7 +101,7 @@ int cap_settime(struct timespec *ts, struct timezone *tz) | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /** | 103 | /** |
| 104 | * cap_ptrace_may_access - Determine whether the current process may access | 104 | * cap_ptrace_access_check - Determine whether the current process may access |
| 105 | * another | 105 | * another |
| 106 | * @child: The process to be accessed | 106 | * @child: The process to be accessed |
| 107 | * @mode: The mode of attachment. | 107 | * @mode: The mode of attachment. |
| @@ -109,7 +109,7 @@ int cap_settime(struct timespec *ts, struct timezone *tz) | |||
| 109 | * Determine whether a process may access another, returning 0 if permission | 109 | * Determine whether a process may access another, returning 0 if permission |
| 110 | * granted, -ve if denied. | 110 | * granted, -ve if denied. |
| 111 | */ | 111 | */ |
| 112 | int cap_ptrace_may_access(struct task_struct *child, unsigned int mode) | 112 | int cap_ptrace_access_check(struct task_struct *child, unsigned int mode) |
| 113 | { | 113 | { |
| 114 | int ret = 0; | 114 | int ret = 0; |
| 115 | 115 | ||
| @@ -984,3 +984,33 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages) | |||
| 984 | cap_sys_admin = 1; | 984 | cap_sys_admin = 1; |
| 985 | return __vm_enough_memory(mm, pages, cap_sys_admin); | 985 | return __vm_enough_memory(mm, pages, cap_sys_admin); |
| 986 | } | 986 | } |
| 987 | |||
| 988 | /* | ||
| 989 | * cap_file_mmap - check if able to map given addr | ||
| 990 | * @file: unused | ||
| 991 | * @reqprot: unused | ||
| 992 | * @prot: unused | ||
| 993 | * @flags: unused | ||
| 994 | * @addr: address attempting to be mapped | ||
| 995 | * @addr_only: unused | ||
| 996 | * | ||
| 997 | * If the process is attempting to map memory below mmap_min_addr they need | ||
| 998 | * CAP_SYS_RAWIO. The other parameters to this function are unused by the | ||
| 999 | * capability security module. Returns 0 if this mapping should be allowed | ||
| 1000 | * -EPERM if not. | ||
| 1001 | */ | ||
| 1002 | int cap_file_mmap(struct file *file, unsigned long reqprot, | ||
| 1003 | unsigned long prot, unsigned long flags, | ||
| 1004 | unsigned long addr, unsigned long addr_only) | ||
| 1005 | { | ||
| 1006 | int ret = 0; | ||
| 1007 | |||
| 1008 | if (addr < dac_mmap_min_addr) { | ||
| 1009 | ret = cap_capable(current, current_cred(), CAP_SYS_RAWIO, | ||
| 1010 | SECURITY_CAP_AUDIT); | ||
| 1011 | /* set PF_SUPERPRIV if it turns out we allow the low mmap */ | ||
| 1012 | if (ret == 0) | ||
| 1013 | current->flags |= PF_SUPERPRIV; | ||
| 1014 | } | ||
| 1015 | return ret; | ||
| 1016 | } | ||
