diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/security.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 161 |
1 files changed, 101 insertions, 60 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index a22219afff09..8ce59ef3e5af 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/fsnotify.h> | 26 | #include <linux/fsnotify.h> |
27 | #include <linux/binfmts.h> | 27 | #include <linux/binfmts.h> |
28 | #include <linux/dcache.h> | ||
28 | #include <linux/signal.h> | 29 | #include <linux/signal.h> |
29 | #include <linux/resource.h> | 30 | #include <linux/resource.h> |
30 | #include <linux/sem.h> | 31 | #include <linux/sem.h> |
@@ -46,14 +47,15 @@ | |||
46 | 47 | ||
47 | struct ctl_table; | 48 | struct ctl_table; |
48 | struct audit_krule; | 49 | struct audit_krule; |
50 | struct user_namespace; | ||
49 | 51 | ||
50 | /* | 52 | /* |
51 | * These functions are in security/capability.c and are used | 53 | * These functions are in security/capability.c and are used |
52 | * as the default capabilities functions | 54 | * as the default capabilities functions |
53 | */ | 55 | */ |
54 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, | 56 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, |
55 | int cap, int audit); | 57 | struct user_namespace *ns, int cap, int audit); |
56 | extern int cap_settime(struct timespec *ts, struct timezone *tz); | 58 | extern int cap_settime(const struct timespec *ts, const struct timezone *tz); |
57 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); | 59 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); |
58 | extern int cap_ptrace_traceme(struct task_struct *parent); | 60 | extern int cap_ptrace_traceme(struct task_struct *parent); |
59 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 61 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
@@ -74,10 +76,9 @@ extern int cap_file_mmap(struct file *file, unsigned long reqprot, | |||
74 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); | 76 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); |
75 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, | 77 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
76 | unsigned long arg4, unsigned long arg5); | 78 | unsigned long arg4, unsigned long arg5); |
77 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); | 79 | extern int cap_task_setscheduler(struct task_struct *p); |
78 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); | 80 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); |
79 | extern int cap_task_setnice(struct task_struct *p, int nice); | 81 | extern int cap_task_setnice(struct task_struct *p, int nice); |
80 | extern int cap_syslog(int type, bool from_file); | ||
81 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); | 82 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); |
82 | 83 | ||
83 | struct msghdr; | 84 | struct msghdr; |
@@ -268,6 +269,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
268 | * @orig the original mount data copied from userspace. | 269 | * @orig the original mount data copied from userspace. |
269 | * @copy copied data which will be passed to the security module. | 270 | * @copy copied data which will be passed to the security module. |
270 | * Returns 0 if the copy was successful. | 271 | * Returns 0 if the copy was successful. |
272 | * @sb_remount: | ||
273 | * Extracts security system specifc mount options and verifys no changes | ||
274 | * are being made to those options. | ||
275 | * @sb superblock being remounted | ||
276 | * @data contains the filesystem-specific data. | ||
277 | * Return 0 if permission is granted. | ||
271 | * @sb_umount: | 278 | * @sb_umount: |
272 | * Check permission before the @mnt file system is unmounted. | 279 | * Check permission before the @mnt file system is unmounted. |
273 | * @mnt contains the mounted file system. | 280 | * @mnt contains the mounted file system. |
@@ -316,6 +323,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
316 | * then it should return -EOPNOTSUPP to skip this processing. | 323 | * then it should return -EOPNOTSUPP to skip this processing. |
317 | * @inode contains the inode structure of the newly created inode. | 324 | * @inode contains the inode structure of the newly created inode. |
318 | * @dir contains the inode structure of the parent directory. | 325 | * @dir contains the inode structure of the parent directory. |
326 | * @qstr contains the last path component of the new object | ||
319 | * @name will be set to the allocated name suffix (e.g. selinux). | 327 | * @name will be set to the allocated name suffix (e.g. selinux). |
320 | * @value will be set to the allocated attribute value. | 328 | * @value will be set to the allocated attribute value. |
321 | * @len will be set to the length of the value. | 329 | * @len will be set to the length of the value. |
@@ -458,7 +466,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
458 | * called when the actual read/write operations are performed. | 466 | * called when the actual read/write operations are performed. |
459 | * @inode contains the inode structure to check. | 467 | * @inode contains the inode structure to check. |
460 | * @mask contains the permission mask. | 468 | * @mask contains the permission mask. |
461 | * @nd contains the nameidata (may be NULL). | ||
462 | * Return 0 if permission is granted. | 469 | * Return 0 if permission is granted. |
463 | * @inode_setattr: | 470 | * @inode_setattr: |
464 | * Check permission before setting file attributes. Note that the kernel | 471 | * Check permission before setting file attributes. Note that the kernel |
@@ -797,8 +804,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
797 | * @unix_stream_connect: | 804 | * @unix_stream_connect: |
798 | * Check permissions before establishing a Unix domain stream connection | 805 | * Check permissions before establishing a Unix domain stream connection |
799 | * between @sock and @other. | 806 | * between @sock and @other. |
800 | * @sock contains the socket structure. | 807 | * @sock contains the sock structure. |
801 | * @other contains the peer socket structure. | 808 | * @other contains the peer sock structure. |
809 | * @newsk contains the new sock structure. | ||
802 | * Return 0 if permission is granted. | 810 | * Return 0 if permission is granted. |
803 | * @unix_may_send: | 811 | * @unix_may_send: |
804 | * Check permissions before connecting or sending datagrams from @sock to | 812 | * Check permissions before connecting or sending datagrams from @sock to |
@@ -959,6 +967,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
959 | * Sets the new child socket's sid to the openreq sid. | 967 | * Sets the new child socket's sid to the openreq sid. |
960 | * @inet_conn_established: | 968 | * @inet_conn_established: |
961 | * Sets the connection's peersid to the secmark on skb. | 969 | * Sets the connection's peersid to the secmark on skb. |
970 | * @secmark_relabel_packet: | ||
971 | * check if the process should be allowed to relabel packets to the given secid | ||
972 | * @security_secmark_refcount_inc | ||
973 | * tells the LSM to increment the number of secmark labeling rules loaded | ||
974 | * @security_secmark_refcount_dec | ||
975 | * tells the LSM to decrement the number of secmark labeling rules loaded | ||
962 | * @req_classify_flow: | 976 | * @req_classify_flow: |
963 | * Sets the flow's sid to the openreq sid. | 977 | * Sets the flow's sid to the openreq sid. |
964 | * @tun_dev_create: | 978 | * @tun_dev_create: |
@@ -1053,8 +1067,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1053 | * @cred points to the credentials to provide the context against which to | 1067 | * @cred points to the credentials to provide the context against which to |
1054 | * evaluate the security data on the key. | 1068 | * evaluate the security data on the key. |
1055 | * @perm describes the combination of permissions required of this key. | 1069 | * @perm describes the combination of permissions required of this key. |
1056 | * Return 1 if permission granted, 0 if permission denied and -ve it the | 1070 | * Return 0 if permission is granted, -ve error otherwise. |
1057 | * normal permissions model should be effected. | ||
1058 | * @key_getsecurity: | 1071 | * @key_getsecurity: |
1059 | * Get a textual representation of the security context attached to a key | 1072 | * Get a textual representation of the security context attached to a key |
1060 | * for the purposes of honouring KEYCTL_GETSECURITY. This function | 1073 | * for the purposes of honouring KEYCTL_GETSECURITY. This function |
@@ -1250,15 +1263,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1250 | * credentials. | 1263 | * credentials. |
1251 | * @tsk contains the task_struct for the process. | 1264 | * @tsk contains the task_struct for the process. |
1252 | * @cred contains the credentials to use. | 1265 | * @cred contains the credentials to use. |
1266 | * @ns contains the user namespace we want the capability in | ||
1253 | * @cap contains the capability <include/linux/capability.h>. | 1267 | * @cap contains the capability <include/linux/capability.h>. |
1254 | * @audit: Whether to write an audit message or not | 1268 | * @audit: Whether to write an audit message or not |
1255 | * Return 0 if the capability is granted for @tsk. | 1269 | * Return 0 if the capability is granted for @tsk. |
1256 | * @sysctl: | ||
1257 | * Check permission before accessing the @table sysctl variable in the | ||
1258 | * manner specified by @op. | ||
1259 | * @table contains the ctl_table structure for the sysctl variable. | ||
1260 | * @op contains the operation (001 = search, 002 = write, 004 = read). | ||
1261 | * Return 0 if permission is granted. | ||
1262 | * @syslog: | 1270 | * @syslog: |
1263 | * Check permission before accessing the kernel message ring or changing | 1271 | * Check permission before accessing the kernel message ring or changing |
1264 | * logging to the console. | 1272 | * logging to the console. |
@@ -1279,9 +1287,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1279 | * Return 0 if permission is granted. | 1287 | * Return 0 if permission is granted. |
1280 | * | 1288 | * |
1281 | * @secid_to_secctx: | 1289 | * @secid_to_secctx: |
1282 | * Convert secid to security context. | 1290 | * Convert secid to security context. If secdata is NULL the length of |
1291 | * the result will be returned in seclen, but no secdata will be returned. | ||
1292 | * This does mean that the length could change between calls to check the | ||
1293 | * length and the next call which actually allocates and returns the secdata. | ||
1283 | * @secid contains the security ID. | 1294 | * @secid contains the security ID. |
1284 | * @secdata contains the pointer that stores the converted security context. | 1295 | * @secdata contains the pointer that stores the converted security context. |
1296 | * @seclen pointer which contains the length of the data | ||
1285 | * @secctx_to_secid: | 1297 | * @secctx_to_secid: |
1286 | * Convert security context to secid. | 1298 | * Convert security context to secid. |
1287 | * @secid contains the pointer to the generated security ID. | 1299 | * @secid contains the pointer to the generated security ID. |
@@ -1374,12 +1386,11 @@ struct security_operations { | |||
1374 | const kernel_cap_t *inheritable, | 1386 | const kernel_cap_t *inheritable, |
1375 | const kernel_cap_t *permitted); | 1387 | const kernel_cap_t *permitted); |
1376 | int (*capable) (struct task_struct *tsk, const struct cred *cred, | 1388 | int (*capable) (struct task_struct *tsk, const struct cred *cred, |
1377 | int cap, int audit); | 1389 | struct user_namespace *ns, int cap, int audit); |
1378 | int (*sysctl) (struct ctl_table *table, int op); | ||
1379 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); | 1390 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
1380 | int (*quota_on) (struct dentry *dentry); | 1391 | int (*quota_on) (struct dentry *dentry); |
1381 | int (*syslog) (int type, bool from_file); | 1392 | int (*syslog) (int type); |
1382 | int (*settime) (struct timespec *ts, struct timezone *tz); | 1393 | int (*settime) (const struct timespec *ts, const struct timezone *tz); |
1383 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); | 1394 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); |
1384 | 1395 | ||
1385 | int (*bprm_set_creds) (struct linux_binprm *bprm); | 1396 | int (*bprm_set_creds) (struct linux_binprm *bprm); |
@@ -1391,6 +1402,7 @@ struct security_operations { | |||
1391 | int (*sb_alloc_security) (struct super_block *sb); | 1402 | int (*sb_alloc_security) (struct super_block *sb); |
1392 | void (*sb_free_security) (struct super_block *sb); | 1403 | void (*sb_free_security) (struct super_block *sb); |
1393 | int (*sb_copy_data) (char *orig, char *copy); | 1404 | int (*sb_copy_data) (char *orig, char *copy); |
1405 | int (*sb_remount) (struct super_block *sb, void *data); | ||
1394 | int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); | 1406 | int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); |
1395 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); | 1407 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); |
1396 | int (*sb_statfs) (struct dentry *dentry); | 1408 | int (*sb_statfs) (struct dentry *dentry); |
@@ -1427,7 +1439,8 @@ struct security_operations { | |||
1427 | int (*inode_alloc_security) (struct inode *inode); | 1439 | int (*inode_alloc_security) (struct inode *inode); |
1428 | void (*inode_free_security) (struct inode *inode); | 1440 | void (*inode_free_security) (struct inode *inode); |
1429 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | 1441 | int (*inode_init_security) (struct inode *inode, struct inode *dir, |
1430 | char **name, void **value, size_t *len); | 1442 | const struct qstr *qstr, char **name, |
1443 | void **value, size_t *len); | ||
1431 | int (*inode_create) (struct inode *dir, | 1444 | int (*inode_create) (struct inode *dir, |
1432 | struct dentry *dentry, int mode); | 1445 | struct dentry *dentry, int mode); |
1433 | int (*inode_link) (struct dentry *old_dentry, | 1446 | int (*inode_link) (struct dentry *old_dentry, |
@@ -1443,7 +1456,7 @@ struct security_operations { | |||
1443 | struct inode *new_dir, struct dentry *new_dentry); | 1456 | struct inode *new_dir, struct dentry *new_dentry); |
1444 | int (*inode_readlink) (struct dentry *dentry); | 1457 | int (*inode_readlink) (struct dentry *dentry); |
1445 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1458 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
1446 | int (*inode_permission) (struct inode *inode, int mask); | 1459 | int (*inode_permission) (struct inode *inode, int mask, unsigned flags); |
1447 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); | 1460 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); |
1448 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); | 1461 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); |
1449 | int (*inode_setxattr) (struct dentry *dentry, const char *name, | 1462 | int (*inode_setxattr) (struct dentry *dentry, const char *name, |
@@ -1501,8 +1514,7 @@ struct security_operations { | |||
1501 | int (*task_getioprio) (struct task_struct *p); | 1514 | int (*task_getioprio) (struct task_struct *p); |
1502 | int (*task_setrlimit) (struct task_struct *p, unsigned int resource, | 1515 | int (*task_setrlimit) (struct task_struct *p, unsigned int resource, |
1503 | struct rlimit *new_rlim); | 1516 | struct rlimit *new_rlim); |
1504 | int (*task_setscheduler) (struct task_struct *p, int policy, | 1517 | int (*task_setscheduler) (struct task_struct *p); |
1505 | struct sched_param *lp); | ||
1506 | int (*task_getscheduler) (struct task_struct *p); | 1518 | int (*task_getscheduler) (struct task_struct *p); |
1507 | int (*task_movememory) (struct task_struct *p); | 1519 | int (*task_movememory) (struct task_struct *p); |
1508 | int (*task_kill) (struct task_struct *p, | 1520 | int (*task_kill) (struct task_struct *p, |
@@ -1560,8 +1572,7 @@ struct security_operations { | |||
1560 | int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); | 1572 | int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); |
1561 | 1573 | ||
1562 | #ifdef CONFIG_SECURITY_NETWORK | 1574 | #ifdef CONFIG_SECURITY_NETWORK |
1563 | int (*unix_stream_connect) (struct socket *sock, | 1575 | int (*unix_stream_connect) (struct sock *sock, struct sock *other, struct sock *newsk); |
1564 | struct socket *other, struct sock *newsk); | ||
1565 | int (*unix_may_send) (struct socket *sock, struct socket *other); | 1576 | int (*unix_may_send) (struct socket *sock, struct socket *other); |
1566 | 1577 | ||
1567 | int (*socket_create) (int family, int type, int protocol, int kern); | 1578 | int (*socket_create) (int family, int type, int protocol, int kern); |
@@ -1594,6 +1605,9 @@ struct security_operations { | |||
1594 | struct request_sock *req); | 1605 | struct request_sock *req); |
1595 | void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); | 1606 | void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); |
1596 | void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); | 1607 | void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); |
1608 | int (*secmark_relabel_packet) (u32 secid); | ||
1609 | void (*secmark_refcount_inc) (void); | ||
1610 | void (*secmark_refcount_dec) (void); | ||
1597 | void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); | 1611 | void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); |
1598 | int (*tun_dev_create)(void); | 1612 | int (*tun_dev_create)(void); |
1599 | void (*tun_dev_post_create)(struct sock *sk); | 1613 | void (*tun_dev_post_create)(struct sock *sk); |
@@ -1614,7 +1628,7 @@ struct security_operations { | |||
1614 | int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); | 1628 | int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
1615 | int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, | 1629 | int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, |
1616 | struct xfrm_policy *xp, | 1630 | struct xfrm_policy *xp, |
1617 | struct flowi *fl); | 1631 | const struct flowi *fl); |
1618 | int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); | 1632 | int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); |
1619 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 1633 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
1620 | 1634 | ||
@@ -1653,14 +1667,16 @@ int security_capset(struct cred *new, const struct cred *old, | |||
1653 | const kernel_cap_t *effective, | 1667 | const kernel_cap_t *effective, |
1654 | const kernel_cap_t *inheritable, | 1668 | const kernel_cap_t *inheritable, |
1655 | const kernel_cap_t *permitted); | 1669 | const kernel_cap_t *permitted); |
1656 | int security_capable(int cap); | 1670 | int security_capable(struct user_namespace *ns, const struct cred *cred, |
1657 | int security_real_capable(struct task_struct *tsk, int cap); | 1671 | int cap); |
1658 | int security_real_capable_noaudit(struct task_struct *tsk, int cap); | 1672 | int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, |
1659 | int security_sysctl(struct ctl_table *table, int op); | 1673 | int cap); |
1674 | int security_real_capable_noaudit(struct task_struct *tsk, | ||
1675 | struct user_namespace *ns, int cap); | ||
1660 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); | 1676 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); |
1661 | int security_quota_on(struct dentry *dentry); | 1677 | int security_quota_on(struct dentry *dentry); |
1662 | int security_syslog(int type, bool from_file); | 1678 | int security_syslog(int type); |
1663 | int security_settime(struct timespec *ts, struct timezone *tz); | 1679 | int security_settime(const struct timespec *ts, const struct timezone *tz); |
1664 | int security_vm_enough_memory(long pages); | 1680 | int security_vm_enough_memory(long pages); |
1665 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1681 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
1666 | int security_vm_enough_memory_kern(long pages); | 1682 | int security_vm_enough_memory_kern(long pages); |
@@ -1672,6 +1688,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm); | |||
1672 | int security_sb_alloc(struct super_block *sb); | 1688 | int security_sb_alloc(struct super_block *sb); |
1673 | void security_sb_free(struct super_block *sb); | 1689 | void security_sb_free(struct super_block *sb); |
1674 | int security_sb_copy_data(char *orig, char *copy); | 1690 | int security_sb_copy_data(char *orig, char *copy); |
1691 | int security_sb_remount(struct super_block *sb, void *data); | ||
1675 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data); | 1692 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data); |
1676 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); | 1693 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); |
1677 | int security_sb_statfs(struct dentry *dentry); | 1694 | int security_sb_statfs(struct dentry *dentry); |
@@ -1687,7 +1704,8 @@ int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | |||
1687 | int security_inode_alloc(struct inode *inode); | 1704 | int security_inode_alloc(struct inode *inode); |
1688 | void security_inode_free(struct inode *inode); | 1705 | void security_inode_free(struct inode *inode); |
1689 | int security_inode_init_security(struct inode *inode, struct inode *dir, | 1706 | int security_inode_init_security(struct inode *inode, struct inode *dir, |
1690 | char **name, void **value, size_t *len); | 1707 | const struct qstr *qstr, char **name, |
1708 | void **value, size_t *len); | ||
1691 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); | 1709 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); |
1692 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, | 1710 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, |
1693 | struct dentry *new_dentry); | 1711 | struct dentry *new_dentry); |
@@ -1702,6 +1720,7 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1702 | int security_inode_readlink(struct dentry *dentry); | 1720 | int security_inode_readlink(struct dentry *dentry); |
1703 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); | 1721 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); |
1704 | int security_inode_permission(struct inode *inode, int mask); | 1722 | int security_inode_permission(struct inode *inode, int mask); |
1723 | int security_inode_exec_permission(struct inode *inode, unsigned int flags); | ||
1705 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); | 1724 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); |
1706 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); | 1725 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); |
1707 | int security_inode_setxattr(struct dentry *dentry, const char *name, | 1726 | int security_inode_setxattr(struct dentry *dentry, const char *name, |
@@ -1752,8 +1771,7 @@ int security_task_setioprio(struct task_struct *p, int ioprio); | |||
1752 | int security_task_getioprio(struct task_struct *p); | 1771 | int security_task_getioprio(struct task_struct *p); |
1753 | int security_task_setrlimit(struct task_struct *p, unsigned int resource, | 1772 | int security_task_setrlimit(struct task_struct *p, unsigned int resource, |
1754 | struct rlimit *new_rlim); | 1773 | struct rlimit *new_rlim); |
1755 | int security_task_setscheduler(struct task_struct *p, | 1774 | int security_task_setscheduler(struct task_struct *p); |
1756 | int policy, struct sched_param *lp); | ||
1757 | int security_task_getscheduler(struct task_struct *p); | 1775 | int security_task_getscheduler(struct task_struct *p); |
1758 | int security_task_movememory(struct task_struct *p); | 1776 | int security_task_movememory(struct task_struct *p); |
1759 | int security_task_kill(struct task_struct *p, struct siginfo *info, | 1777 | int security_task_kill(struct task_struct *p, struct siginfo *info, |
@@ -1847,38 +1865,34 @@ static inline int security_capset(struct cred *new, | |||
1847 | return cap_capset(new, old, effective, inheritable, permitted); | 1865 | return cap_capset(new, old, effective, inheritable, permitted); |
1848 | } | 1866 | } |
1849 | 1867 | ||
1850 | static inline int security_capable(int cap) | 1868 | static inline int security_capable(struct user_namespace *ns, |
1869 | const struct cred *cred, int cap) | ||
1851 | { | 1870 | { |
1852 | return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT); | 1871 | return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT); |
1853 | } | 1872 | } |
1854 | 1873 | ||
1855 | static inline int security_real_capable(struct task_struct *tsk, int cap) | 1874 | static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap) |
1856 | { | 1875 | { |
1857 | int ret; | 1876 | int ret; |
1858 | 1877 | ||
1859 | rcu_read_lock(); | 1878 | rcu_read_lock(); |
1860 | ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT); | 1879 | ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT); |
1861 | rcu_read_unlock(); | 1880 | rcu_read_unlock(); |
1862 | return ret; | 1881 | return ret; |
1863 | } | 1882 | } |
1864 | 1883 | ||
1865 | static inline | 1884 | static inline |
1866 | int security_real_capable_noaudit(struct task_struct *tsk, int cap) | 1885 | int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap) |
1867 | { | 1886 | { |
1868 | int ret; | 1887 | int ret; |
1869 | 1888 | ||
1870 | rcu_read_lock(); | 1889 | rcu_read_lock(); |
1871 | ret = cap_capable(tsk, __task_cred(tsk), cap, | 1890 | ret = cap_capable(tsk, __task_cred(tsk), ns, cap, |
1872 | SECURITY_CAP_NOAUDIT); | 1891 | SECURITY_CAP_NOAUDIT); |
1873 | rcu_read_unlock(); | 1892 | rcu_read_unlock(); |
1874 | return ret; | 1893 | return ret; |
1875 | } | 1894 | } |
1876 | 1895 | ||
1877 | static inline int security_sysctl(struct ctl_table *table, int op) | ||
1878 | { | ||
1879 | return 0; | ||
1880 | } | ||
1881 | |||
1882 | static inline int security_quotactl(int cmds, int type, int id, | 1896 | static inline int security_quotactl(int cmds, int type, int id, |
1883 | struct super_block *sb) | 1897 | struct super_block *sb) |
1884 | { | 1898 | { |
@@ -1890,12 +1904,13 @@ static inline int security_quota_on(struct dentry *dentry) | |||
1890 | return 0; | 1904 | return 0; |
1891 | } | 1905 | } |
1892 | 1906 | ||
1893 | static inline int security_syslog(int type, bool from_file) | 1907 | static inline int security_syslog(int type) |
1894 | { | 1908 | { |
1895 | return cap_syslog(type, from_file); | 1909 | return 0; |
1896 | } | 1910 | } |
1897 | 1911 | ||
1898 | static inline int security_settime(struct timespec *ts, struct timezone *tz) | 1912 | static inline int security_settime(const struct timespec *ts, |
1913 | const struct timezone *tz) | ||
1899 | { | 1914 | { |
1900 | return cap_settime(ts, tz); | 1915 | return cap_settime(ts, tz); |
1901 | } | 1916 | } |
@@ -1955,6 +1970,11 @@ static inline int security_sb_copy_data(char *orig, char *copy) | |||
1955 | return 0; | 1970 | return 0; |
1956 | } | 1971 | } |
1957 | 1972 | ||
1973 | static inline int security_sb_remount(struct super_block *sb, void *data) | ||
1974 | { | ||
1975 | return 0; | ||
1976 | } | ||
1977 | |||
1958 | static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) | 1978 | static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) |
1959 | { | 1979 | { |
1960 | return 0; | 1980 | return 0; |
@@ -2014,6 +2034,7 @@ static inline void security_inode_free(struct inode *inode) | |||
2014 | 2034 | ||
2015 | static inline int security_inode_init_security(struct inode *inode, | 2035 | static inline int security_inode_init_security(struct inode *inode, |
2016 | struct inode *dir, | 2036 | struct inode *dir, |
2037 | const struct qstr *qstr, | ||
2017 | char **name, | 2038 | char **name, |
2018 | void **value, | 2039 | void **value, |
2019 | size_t *len) | 2040 | size_t *len) |
@@ -2092,6 +2113,12 @@ static inline int security_inode_permission(struct inode *inode, int mask) | |||
2092 | return 0; | 2113 | return 0; |
2093 | } | 2114 | } |
2094 | 2115 | ||
2116 | static inline int security_inode_exec_permission(struct inode *inode, | ||
2117 | unsigned int flags) | ||
2118 | { | ||
2119 | return 0; | ||
2120 | } | ||
2121 | |||
2095 | static inline int security_inode_setattr(struct dentry *dentry, | 2122 | static inline int security_inode_setattr(struct dentry *dentry, |
2096 | struct iattr *attr) | 2123 | struct iattr *attr) |
2097 | { | 2124 | { |
@@ -2320,11 +2347,9 @@ static inline int security_task_setrlimit(struct task_struct *p, | |||
2320 | return 0; | 2347 | return 0; |
2321 | } | 2348 | } |
2322 | 2349 | ||
2323 | static inline int security_task_setscheduler(struct task_struct *p, | 2350 | static inline int security_task_setscheduler(struct task_struct *p) |
2324 | int policy, | ||
2325 | struct sched_param *lp) | ||
2326 | { | 2351 | { |
2327 | return cap_task_setscheduler(p, policy, lp); | 2352 | return cap_task_setscheduler(p); |
2328 | } | 2353 | } |
2329 | 2354 | ||
2330 | static inline int security_task_getscheduler(struct task_struct *p) | 2355 | static inline int security_task_getscheduler(struct task_struct *p) |
@@ -2517,8 +2542,7 @@ static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 | |||
2517 | 2542 | ||
2518 | #ifdef CONFIG_SECURITY_NETWORK | 2543 | #ifdef CONFIG_SECURITY_NETWORK |
2519 | 2544 | ||
2520 | int security_unix_stream_connect(struct socket *sock, struct socket *other, | 2545 | int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk); |
2521 | struct sock *newsk); | ||
2522 | int security_unix_may_send(struct socket *sock, struct socket *other); | 2546 | int security_unix_may_send(struct socket *sock, struct socket *other); |
2523 | int security_socket_create(int family, int type, int protocol, int kern); | 2547 | int security_socket_create(int family, int type, int protocol, int kern); |
2524 | int security_socket_post_create(struct socket *sock, int family, | 2548 | int security_socket_post_create(struct socket *sock, int family, |
@@ -2551,13 +2575,16 @@ void security_inet_csk_clone(struct sock *newsk, | |||
2551 | const struct request_sock *req); | 2575 | const struct request_sock *req); |
2552 | void security_inet_conn_established(struct sock *sk, | 2576 | void security_inet_conn_established(struct sock *sk, |
2553 | struct sk_buff *skb); | 2577 | struct sk_buff *skb); |
2578 | int security_secmark_relabel_packet(u32 secid); | ||
2579 | void security_secmark_refcount_inc(void); | ||
2580 | void security_secmark_refcount_dec(void); | ||
2554 | int security_tun_dev_create(void); | 2581 | int security_tun_dev_create(void); |
2555 | void security_tun_dev_post_create(struct sock *sk); | 2582 | void security_tun_dev_post_create(struct sock *sk); |
2556 | int security_tun_dev_attach(struct sock *sk); | 2583 | int security_tun_dev_attach(struct sock *sk); |
2557 | 2584 | ||
2558 | #else /* CONFIG_SECURITY_NETWORK */ | 2585 | #else /* CONFIG_SECURITY_NETWORK */ |
2559 | static inline int security_unix_stream_connect(struct socket *sock, | 2586 | static inline int security_unix_stream_connect(struct sock *sock, |
2560 | struct socket *other, | 2587 | struct sock *other, |
2561 | struct sock *newsk) | 2588 | struct sock *newsk) |
2562 | { | 2589 | { |
2563 | return 0; | 2590 | return 0; |
@@ -2705,6 +2732,19 @@ static inline void security_inet_conn_established(struct sock *sk, | |||
2705 | { | 2732 | { |
2706 | } | 2733 | } |
2707 | 2734 | ||
2735 | static inline int security_secmark_relabel_packet(u32 secid) | ||
2736 | { | ||
2737 | return 0; | ||
2738 | } | ||
2739 | |||
2740 | static inline void security_secmark_refcount_inc(void) | ||
2741 | { | ||
2742 | } | ||
2743 | |||
2744 | static inline void security_secmark_refcount_dec(void) | ||
2745 | { | ||
2746 | } | ||
2747 | |||
2708 | static inline int security_tun_dev_create(void) | 2748 | static inline int security_tun_dev_create(void) |
2709 | { | 2749 | { |
2710 | return 0; | 2750 | return 0; |
@@ -2733,7 +2773,8 @@ int security_xfrm_state_delete(struct xfrm_state *x); | |||
2733 | void security_xfrm_state_free(struct xfrm_state *x); | 2773 | void security_xfrm_state_free(struct xfrm_state *x); |
2734 | int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); | 2774 | int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
2735 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | 2775 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
2736 | struct xfrm_policy *xp, struct flowi *fl); | 2776 | struct xfrm_policy *xp, |
2777 | const struct flowi *fl); | ||
2737 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); | 2778 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); |
2738 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); | 2779 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); |
2739 | 2780 | ||
@@ -2785,7 +2826,7 @@ static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_s | |||
2785 | } | 2826 | } |
2786 | 2827 | ||
2787 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | 2828 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
2788 | struct xfrm_policy *xp, struct flowi *fl) | 2829 | struct xfrm_policy *xp, const struct flowi *fl) |
2789 | { | 2830 | { |
2790 | return 1; | 2831 | return 1; |
2791 | } | 2832 | } |