aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/security.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/security.h')
-rw-r--r--include/linux/security.h64
1 files changed, 16 insertions, 48 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index 98112cf93884..83c18e8c846d 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -54,8 +54,8 @@ struct user_namespace;
54 * These functions are in security/capability.c and are used 54 * These functions are in security/capability.c and are used
55 * as the default capabilities functions 55 * as the default capabilities functions
56 */ 56 */
57extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 57extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
58 struct user_namespace *ns, int cap, int audit); 58 int cap, int audit);
59extern int cap_settime(const struct timespec *ts, const struct timezone *tz); 59extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
60extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 60extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
61extern int cap_ptrace_traceme(struct task_struct *parent); 61extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -96,7 +96,6 @@ struct xfrm_user_sec_ctx;
96struct seq_file; 96struct seq_file;
97 97
98extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 98extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
99extern int cap_netlink_recv(struct sk_buff *skb, int cap);
100 99
101void reset_security_ops(void); 100void reset_security_ops(void);
102 101
@@ -590,6 +589,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
590 * @reqprot contains the protection requested by the application. 589 * @reqprot contains the protection requested by the application.
591 * @prot contains the protection that will be applied by the kernel. 590 * @prot contains the protection that will be applied by the kernel.
592 * @flags contains the operational flags. 591 * @flags contains the operational flags.
592 * @addr contains virtual address that will be used for the operation.
593 * @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1.
593 * Return 0 if permission is granted. 594 * Return 0 if permission is granted.
594 * @file_mprotect: 595 * @file_mprotect:
595 * Check permissions before changing memory access permissions. 596 * Check permissions before changing memory access permissions.
@@ -797,12 +798,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
797 * @skb contains the sk_buff structure for the netlink message. 798 * @skb contains the sk_buff structure for the netlink message.
798 * Return 0 if the information was successfully saved and message 799 * Return 0 if the information was successfully saved and message
799 * is allowed to be transmitted. 800 * is allowed to be transmitted.
800 * @netlink_recv:
801 * Check permission before processing the received netlink message in
802 * @skb.
803 * @skb contains the sk_buff structure for the netlink message.
804 * @cap indicates the capability required
805 * Return 0 if permission is granted.
806 * 801 *
807 * Security hooks for Unix domain networking. 802 * Security hooks for Unix domain networking.
808 * 803 *
@@ -1266,7 +1261,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1266 * @capable: 1261 * @capable:
1267 * Check whether the @tsk process has the @cap capability in the indicated 1262 * Check whether the @tsk process has the @cap capability in the indicated
1268 * credentials. 1263 * credentials.
1269 * @tsk contains the task_struct for the process.
1270 * @cred contains the credentials to use. 1264 * @cred contains the credentials to use.
1271 * @ns contains the user namespace we want the capability in 1265 * @ns contains the user namespace we want the capability in
1272 * @cap contains the capability <include/linux/capability.h>. 1266 * @cap contains the capability <include/linux/capability.h>.
@@ -1390,8 +1384,8 @@ struct security_operations {
1390 const kernel_cap_t *effective, 1384 const kernel_cap_t *effective,
1391 const kernel_cap_t *inheritable, 1385 const kernel_cap_t *inheritable,
1392 const kernel_cap_t *permitted); 1386 const kernel_cap_t *permitted);
1393 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1387 int (*capable) (const struct cred *cred, struct user_namespace *ns,
1394 struct user_namespace *ns, int cap, int audit); 1388 int cap, int audit);
1395 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1389 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1396 int (*quota_on) (struct dentry *dentry); 1390 int (*quota_on) (struct dentry *dentry);
1397 int (*syslog) (int type); 1391 int (*syslog) (int type);
@@ -1561,7 +1555,6 @@ struct security_operations {
1561 struct sembuf *sops, unsigned nsops, int alter); 1555 struct sembuf *sops, unsigned nsops, int alter);
1562 1556
1563 int (*netlink_send) (struct sock *sk, struct sk_buff *skb); 1557 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1564 int (*netlink_recv) (struct sk_buff *skb, int cap);
1565 1558
1566 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1559 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1567 1560
@@ -1673,12 +1666,10 @@ int security_capset(struct cred *new, const struct cred *old,
1673 const kernel_cap_t *effective, 1666 const kernel_cap_t *effective,
1674 const kernel_cap_t *inheritable, 1667 const kernel_cap_t *inheritable,
1675 const kernel_cap_t *permitted); 1668 const kernel_cap_t *permitted);
1676int security_capable(struct user_namespace *ns, const struct cred *cred, 1669int security_capable(const struct cred *cred, struct user_namespace *ns,
1677 int cap);
1678int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
1679 int cap); 1670 int cap);
1680int security_real_capable_noaudit(struct task_struct *tsk, 1671int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
1681 struct user_namespace *ns, int cap); 1672 int cap);
1682int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1673int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1683int security_quota_on(struct dentry *dentry); 1674int security_quota_on(struct dentry *dentry);
1684int security_syslog(int type); 1675int security_syslog(int type);
@@ -1815,7 +1806,6 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1815int security_getprocattr(struct task_struct *p, char *name, char **value); 1806int security_getprocattr(struct task_struct *p, char *name, char **value);
1816int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1807int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1817int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1808int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1818int security_netlink_recv(struct sk_buff *skb, int cap);
1819int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1809int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1820int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1810int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1821void security_release_secctx(char *secdata, u32 seclen); 1811void security_release_secctx(char *secdata, u32 seclen);
@@ -1873,32 +1863,15 @@ static inline int security_capset(struct cred *new,
1873 return cap_capset(new, old, effective, inheritable, permitted); 1863 return cap_capset(new, old, effective, inheritable, permitted);
1874} 1864}
1875 1865
1876static inline int security_capable(struct user_namespace *ns, 1866static inline int security_capable(const struct cred *cred,
1877 const struct cred *cred, int cap) 1867 struct user_namespace *ns, int cap)
1878{
1879 return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
1880}
1881
1882static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
1883{ 1868{
1884 int ret; 1869 return cap_capable(cred, ns, cap, SECURITY_CAP_AUDIT);
1885
1886 rcu_read_lock();
1887 ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
1888 rcu_read_unlock();
1889 return ret;
1890} 1870}
1891 1871
1892static inline 1872static inline int security_capable_noaudit(const struct cred *cred,
1893int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap) 1873 struct user_namespace *ns, int cap) {
1894{ 1874 return cap_capable(cred, ns, cap, SECURITY_CAP_NOAUDIT);
1895 int ret;
1896
1897 rcu_read_lock();
1898 ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
1899 SECURITY_CAP_NOAUDIT);
1900 rcu_read_unlock();
1901 return ret;
1902} 1875}
1903 1876
1904static inline int security_quotactl(int cmds, int type, int id, 1877static inline int security_quotactl(int cmds, int type, int id,
@@ -2043,7 +2016,7 @@ static inline void security_inode_free(struct inode *inode)
2043static inline int security_inode_init_security(struct inode *inode, 2016static inline int security_inode_init_security(struct inode *inode,
2044 struct inode *dir, 2017 struct inode *dir,
2045 const struct qstr *qstr, 2018 const struct qstr *qstr,
2046 initxattrs initxattrs, 2019 const initxattrs initxattrs,
2047 void *fs_data) 2020 void *fs_data)
2048{ 2021{
2049 return 0; 2022 return 0;
@@ -2515,11 +2488,6 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2515 return cap_netlink_send(sk, skb); 2488 return cap_netlink_send(sk, skb);
2516} 2489}
2517 2490
2518static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2519{
2520 return cap_netlink_recv(skb, cap);
2521}
2522
2523static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2491static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2524{ 2492{
2525 return -EOPNOTSUPP; 2493 return -EOPNOTSUPP;