aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/security.h16
2 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 0f1950181102..b313ba1dd5d1 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -521,6 +521,8 @@ extern const kernel_cap_t __cap_init_eff_set;
521 521
522kernel_cap_t cap_set_effective(const kernel_cap_t pE_new); 522kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
523 523
524extern int security_capable(struct task_struct *t, int cap);
525extern int security_capable_noaudit(struct task_struct *t, int cap);
524/** 526/**
525 * has_capability - Determine if a task has a superior capability available 527 * has_capability - Determine if a task has a superior capability available
526 * @t: The task in question 528 * @t: The task in question
@@ -532,6 +534,7 @@ kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
532 * Note that this does not set PF_SUPERPRIV on the task. 534 * Note that this does not set PF_SUPERPRIV on the task.
533 */ 535 */
534#define has_capability(t, cap) (security_capable((t), (cap)) == 0) 536#define has_capability(t, cap) (security_capable((t), (cap)) == 0)
537#define has_capability_noaudit(t, cap) (security_capable_noaudit((t), (cap)) == 0)
535 538
536extern int capable(int cap); 539extern int capable(int cap);
537 540
diff --git a/include/linux/security.h b/include/linux/security.h
index c13f1cec9abb..5fe28a671cd3 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -37,6 +37,10 @@
37/* Maximum number of letters for an LSM name string */ 37/* Maximum number of letters for an LSM name string */
38#define SECURITY_NAME_MAX 10 38#define SECURITY_NAME_MAX 10
39 39
40/* If capable should audit the security request */
41#define SECURITY_CAP_NOAUDIT 0
42#define SECURITY_CAP_AUDIT 1
43
40struct ctl_table; 44struct ctl_table;
41struct audit_krule; 45struct audit_krule;
42 46
@@ -44,7 +48,7 @@ struct audit_krule;
44 * These functions are in security/capability.c and are used 48 * These functions are in security/capability.c and are used
45 * as the default capabilities functions 49 * as the default capabilities functions
46 */ 50 */
47extern int cap_capable(struct task_struct *tsk, int cap); 51extern int cap_capable(struct task_struct *tsk, int cap, int audit);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 52extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 53extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
50extern int cap_ptrace_traceme(struct task_struct *parent); 54extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -1307,7 +1311,7 @@ struct security_operations {
1307 kernel_cap_t *effective, 1311 kernel_cap_t *effective,
1308 kernel_cap_t *inheritable, 1312 kernel_cap_t *inheritable,
1309 kernel_cap_t *permitted); 1313 kernel_cap_t *permitted);
1310 int (*capable) (struct task_struct *tsk, int cap); 1314 int (*capable) (struct task_struct *tsk, int cap, int audit);
1311 int (*acct) (struct file *file); 1315 int (*acct) (struct file *file);
1312 int (*sysctl) (struct ctl_table *table, int op); 1316 int (*sysctl) (struct ctl_table *table, int op);
1313 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1317 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
@@ -1577,6 +1581,7 @@ void security_capset_set(struct task_struct *target,
1577 kernel_cap_t *inheritable, 1581 kernel_cap_t *inheritable,
1578 kernel_cap_t *permitted); 1582 kernel_cap_t *permitted);
1579int security_capable(struct task_struct *tsk, int cap); 1583int security_capable(struct task_struct *tsk, int cap);
1584int security_capable_noaudit(struct task_struct *tsk, int cap);
1580int security_acct(struct file *file); 1585int security_acct(struct file *file);
1581int security_sysctl(struct ctl_table *table, int op); 1586int security_sysctl(struct ctl_table *table, int op);
1582int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1587int security_quotactl(int cmds, int type, int id, struct super_block *sb);
@@ -1782,7 +1787,12 @@ static inline void security_capset_set(struct task_struct *target,
1782 1787
1783static inline int security_capable(struct task_struct *tsk, int cap) 1788static inline int security_capable(struct task_struct *tsk, int cap)
1784{ 1789{
1785 return cap_capable(tsk, cap); 1790 return cap_capable(tsk, cap, SECURITY_CAP_AUDIT);
1791}
1792
1793static inline int security_capable_noaudit(struct task_struct *tsk, int cap)
1794{
1795 return cap_capable(tsk, cap, SECURITY_CAP_NOAUDIT);
1786} 1796}
1787 1797
1788static inline int security_acct(struct file *file) 1798static inline int security_acct(struct file *file)