aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-02-09 18:28:49 -0500
committerJames Morris <james.l.morris@oracle.com>2017-02-09 18:28:49 -0500
commita2a15479d617ebbab67c60b4eed02524536af780 (patch)
tree64c4a5bbf434b003f02f56edda845e89fd539a7a /security/selinux/hooks.c
parente2241be62deabe09d7c681326fcb0bc707082147 (diff)
parent1ea0ce40690dff38935538e8dab7b12683ded0d3 (diff)
Merge branch 'stable-4.11' of git://git.infradead.org/users/pcmoore/selinux into next
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c379
1 files changed, 188 insertions, 191 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 424573029c5c..9bc12bcddc2c 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -210,16 +210,6 @@ static inline u32 task_sid(const struct task_struct *task)
210 return sid; 210 return sid;
211} 211}
212 212
213/*
214 * get the subjective security ID of the current task
215 */
216static inline u32 current_sid(void)
217{
218 const struct task_security_struct *tsec = current_security();
219
220 return tsec->sid;
221}
222
223/* Allocate and free functions for each kind of security blob. */ 213/* Allocate and free functions for each kind of security blob. */
224 214
225static int inode_alloc_security(struct inode *inode) 215static int inode_alloc_security(struct inode *inode)
@@ -490,8 +480,11 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
490 sbsec->behavior == SECURITY_FS_USE_NATIVE || 480 sbsec->behavior == SECURITY_FS_USE_NATIVE ||
491 /* Special handling. Genfs but also in-core setxattr handler */ 481 /* Special handling. Genfs but also in-core setxattr handler */
492 !strcmp(sb->s_type->name, "sysfs") || 482 !strcmp(sb->s_type->name, "sysfs") ||
483 !strcmp(sb->s_type->name, "cgroup") ||
484 !strcmp(sb->s_type->name, "cgroup2") ||
493 !strcmp(sb->s_type->name, "pstore") || 485 !strcmp(sb->s_type->name, "pstore") ||
494 !strcmp(sb->s_type->name, "debugfs") || 486 !strcmp(sb->s_type->name, "debugfs") ||
487 !strcmp(sb->s_type->name, "tracefs") ||
495 !strcmp(sb->s_type->name, "rootfs"); 488 !strcmp(sb->s_type->name, "rootfs");
496} 489}
497 490
@@ -833,10 +826,14 @@ static int selinux_set_mnt_opts(struct super_block *sb,
833 } 826 }
834 827
835 /* 828 /*
836 * If this is a user namespace mount, no contexts are allowed 829 * If this is a user namespace mount and the filesystem type is not
837 * on the command line and security labels must be ignored. 830 * explicitly whitelisted, then no contexts are allowed on the command
831 * line and security labels must be ignored.
838 */ 832 */
839 if (sb->s_user_ns != &init_user_ns) { 833 if (sb->s_user_ns != &init_user_ns &&
834 strcmp(sb->s_type->name, "tmpfs") &&
835 strcmp(sb->s_type->name, "ramfs") &&
836 strcmp(sb->s_type->name, "devpts")) {
840 if (context_sid || fscontext_sid || rootcontext_sid || 837 if (context_sid || fscontext_sid || rootcontext_sid ||
841 defcontext_sid) { 838 defcontext_sid) {
842 rc = -EACCES; 839 rc = -EACCES;
@@ -1268,6 +1265,8 @@ static inline int default_protocol_dgram(int protocol)
1268 1265
1269static inline u16 socket_type_to_security_class(int family, int type, int protocol) 1266static inline u16 socket_type_to_security_class(int family, int type, int protocol)
1270{ 1267{
1268 int extsockclass = selinux_policycap_extsockclass;
1269
1271 switch (family) { 1270 switch (family) {
1272 case PF_UNIX: 1271 case PF_UNIX:
1273 switch (type) { 1272 switch (type) {
@@ -1282,13 +1281,19 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1282 case PF_INET6: 1281 case PF_INET6:
1283 switch (type) { 1282 switch (type) {
1284 case SOCK_STREAM: 1283 case SOCK_STREAM:
1284 case SOCK_SEQPACKET:
1285 if (default_protocol_stream(protocol)) 1285 if (default_protocol_stream(protocol))
1286 return SECCLASS_TCP_SOCKET; 1286 return SECCLASS_TCP_SOCKET;
1287 else if (extsockclass && protocol == IPPROTO_SCTP)
1288 return SECCLASS_SCTP_SOCKET;
1287 else 1289 else
1288 return SECCLASS_RAWIP_SOCKET; 1290 return SECCLASS_RAWIP_SOCKET;
1289 case SOCK_DGRAM: 1291 case SOCK_DGRAM:
1290 if (default_protocol_dgram(protocol)) 1292 if (default_protocol_dgram(protocol))
1291 return SECCLASS_UDP_SOCKET; 1293 return SECCLASS_UDP_SOCKET;
1294 else if (extsockclass && (protocol == IPPROTO_ICMP ||
1295 protocol == IPPROTO_ICMPV6))
1296 return SECCLASS_ICMP_SOCKET;
1292 else 1297 else
1293 return SECCLASS_RAWIP_SOCKET; 1298 return SECCLASS_RAWIP_SOCKET;
1294 case SOCK_DCCP: 1299 case SOCK_DCCP:
@@ -1342,6 +1347,66 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1342 return SECCLASS_APPLETALK_SOCKET; 1347 return SECCLASS_APPLETALK_SOCKET;
1343 } 1348 }
1344 1349
1350 if (extsockclass) {
1351 switch (family) {
1352 case PF_AX25:
1353 return SECCLASS_AX25_SOCKET;
1354 case PF_IPX:
1355 return SECCLASS_IPX_SOCKET;
1356 case PF_NETROM:
1357 return SECCLASS_NETROM_SOCKET;
1358 case PF_ATMPVC:
1359 return SECCLASS_ATMPVC_SOCKET;
1360 case PF_X25:
1361 return SECCLASS_X25_SOCKET;
1362 case PF_ROSE:
1363 return SECCLASS_ROSE_SOCKET;
1364 case PF_DECnet:
1365 return SECCLASS_DECNET_SOCKET;
1366 case PF_ATMSVC:
1367 return SECCLASS_ATMSVC_SOCKET;
1368 case PF_RDS:
1369 return SECCLASS_RDS_SOCKET;
1370 case PF_IRDA:
1371 return SECCLASS_IRDA_SOCKET;
1372 case PF_PPPOX:
1373 return SECCLASS_PPPOX_SOCKET;
1374 case PF_LLC:
1375 return SECCLASS_LLC_SOCKET;
1376 case PF_CAN:
1377 return SECCLASS_CAN_SOCKET;
1378 case PF_TIPC:
1379 return SECCLASS_TIPC_SOCKET;
1380 case PF_BLUETOOTH:
1381 return SECCLASS_BLUETOOTH_SOCKET;
1382 case PF_IUCV:
1383 return SECCLASS_IUCV_SOCKET;
1384 case PF_RXRPC:
1385 return SECCLASS_RXRPC_SOCKET;
1386 case PF_ISDN:
1387 return SECCLASS_ISDN_SOCKET;
1388 case PF_PHONET:
1389 return SECCLASS_PHONET_SOCKET;
1390 case PF_IEEE802154:
1391 return SECCLASS_IEEE802154_SOCKET;
1392 case PF_CAIF:
1393 return SECCLASS_CAIF_SOCKET;
1394 case PF_ALG:
1395 return SECCLASS_ALG_SOCKET;
1396 case PF_NFC:
1397 return SECCLASS_NFC_SOCKET;
1398 case PF_VSOCK:
1399 return SECCLASS_VSOCK_SOCKET;
1400 case PF_KCM:
1401 return SECCLASS_KCM_SOCKET;
1402 case PF_QIPCRTR:
1403 return SECCLASS_QIPCRTR_SOCKET;
1404#if PF_MAX > 43
1405#error New address family defined, please update this function.
1406#endif
1407 }
1408 }
1409
1345 return SECCLASS_SOCKET; 1410 return SECCLASS_SOCKET;
1346} 1411}
1347 1412
@@ -1608,55 +1673,6 @@ static inline u32 signal_to_av(int sig)
1608 return perm; 1673 return perm;
1609} 1674}
1610 1675
1611/*
1612 * Check permission between a pair of credentials
1613 * fork check, ptrace check, etc.
1614 */
1615static int cred_has_perm(const struct cred *actor,
1616 const struct cred *target,
1617 u32 perms)
1618{
1619 u32 asid = cred_sid(actor), tsid = cred_sid(target);
1620
1621 return avc_has_perm(asid, tsid, SECCLASS_PROCESS, perms, NULL);
1622}
1623
1624/*
1625 * Check permission between a pair of tasks, e.g. signal checks,
1626 * fork check, ptrace check, etc.
1627 * tsk1 is the actor and tsk2 is the target
1628 * - this uses the default subjective creds of tsk1
1629 */
1630static int task_has_perm(const struct task_struct *tsk1,
1631 const struct task_struct *tsk2,
1632 u32 perms)
1633{
1634 const struct task_security_struct *__tsec1, *__tsec2;
1635 u32 sid1, sid2;
1636
1637 rcu_read_lock();
1638 __tsec1 = __task_cred(tsk1)->security; sid1 = __tsec1->sid;
1639 __tsec2 = __task_cred(tsk2)->security; sid2 = __tsec2->sid;
1640 rcu_read_unlock();
1641 return avc_has_perm(sid1, sid2, SECCLASS_PROCESS, perms, NULL);
1642}
1643
1644/*
1645 * Check permission between current and another task, e.g. signal checks,
1646 * fork check, ptrace check, etc.
1647 * current is the actor and tsk2 is the target
1648 * - this uses current's subjective creds
1649 */
1650static int current_has_perm(const struct task_struct *tsk,
1651 u32 perms)
1652{
1653 u32 sid, tsid;
1654
1655 sid = current_sid();
1656 tsid = task_sid(tsk);
1657 return avc_has_perm(sid, tsid, SECCLASS_PROCESS, perms, NULL);
1658}
1659
1660#if CAP_LAST_CAP > 63 1676#if CAP_LAST_CAP > 63
1661#error Fix SELinux to handle capabilities > 63. 1677#error Fix SELinux to handle capabilities > 63.
1662#endif 1678#endif
@@ -1698,16 +1714,6 @@ static int cred_has_capability(const struct cred *cred,
1698 return rc; 1714 return rc;
1699} 1715}
1700 1716
1701/* Check whether a task is allowed to use a system operation. */
1702static int task_has_system(struct task_struct *tsk,
1703 u32 perms)
1704{
1705 u32 sid = task_sid(tsk);
1706
1707 return avc_has_perm(sid, SECINITSID_KERNEL,
1708 SECCLASS_SYSTEM, perms, NULL);
1709}
1710
1711/* Check whether a task has a particular permission to an inode. 1717/* Check whether a task has a particular permission to an inode.
1712 The 'adp' parameter is optional and allows other audit 1718 The 'adp' parameter is optional and allows other audit
1713 data to be passed (e.g. the dentry). */ 1719 data to be passed (e.g. the dentry). */
@@ -1879,15 +1885,6 @@ static int may_create(struct inode *dir,
1879 FILESYSTEM__ASSOCIATE, &ad); 1885 FILESYSTEM__ASSOCIATE, &ad);
1880} 1886}
1881 1887
1882/* Check whether a task can create a key. */
1883static int may_create_key(u32 ksid,
1884 struct task_struct *ctx)
1885{
1886 u32 sid = task_sid(ctx);
1887
1888 return avc_has_perm(sid, ksid, SECCLASS_KEY, KEY__CREATE, NULL);
1889}
1890
1891#define MAY_LINK 0 1888#define MAY_LINK 0
1892#define MAY_UNLINK 1 1889#define MAY_UNLINK 1
1893#define MAY_RMDIR 2 1890#define MAY_RMDIR 2
@@ -2143,24 +2140,26 @@ static int selinux_binder_transfer_file(struct task_struct *from,
2143static int selinux_ptrace_access_check(struct task_struct *child, 2140static int selinux_ptrace_access_check(struct task_struct *child,
2144 unsigned int mode) 2141 unsigned int mode)
2145{ 2142{
2146 if (mode & PTRACE_MODE_READ) { 2143 u32 sid = current_sid();
2147 u32 sid = current_sid(); 2144 u32 csid = task_sid(child);
2148 u32 csid = task_sid(child); 2145
2146 if (mode & PTRACE_MODE_READ)
2149 return avc_has_perm(sid, csid, SECCLASS_FILE, FILE__READ, NULL); 2147 return avc_has_perm(sid, csid, SECCLASS_FILE, FILE__READ, NULL);
2150 }
2151 2148
2152 return current_has_perm(child, PROCESS__PTRACE); 2149 return avc_has_perm(sid, csid, SECCLASS_PROCESS, PROCESS__PTRACE, NULL);
2153} 2150}
2154 2151
2155static int selinux_ptrace_traceme(struct task_struct *parent) 2152static int selinux_ptrace_traceme(struct task_struct *parent)
2156{ 2153{
2157 return task_has_perm(parent, current, PROCESS__PTRACE); 2154 return avc_has_perm(task_sid(parent), current_sid(), SECCLASS_PROCESS,
2155 PROCESS__PTRACE, NULL);
2158} 2156}
2159 2157
2160static int selinux_capget(struct task_struct *target, kernel_cap_t *effective, 2158static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
2161 kernel_cap_t *inheritable, kernel_cap_t *permitted) 2159 kernel_cap_t *inheritable, kernel_cap_t *permitted)
2162{ 2160{
2163 return current_has_perm(target, PROCESS__GETCAP); 2161 return avc_has_perm(current_sid(), task_sid(target), SECCLASS_PROCESS,
2162 PROCESS__GETCAP, NULL);
2164} 2163}
2165 2164
2166static int selinux_capset(struct cred *new, const struct cred *old, 2165static int selinux_capset(struct cred *new, const struct cred *old,
@@ -2168,7 +2167,8 @@ static int selinux_capset(struct cred *new, const struct cred *old,
2168 const kernel_cap_t *inheritable, 2167 const kernel_cap_t *inheritable,
2169 const kernel_cap_t *permitted) 2168 const kernel_cap_t *permitted)
2170{ 2169{
2171 return cred_has_perm(old, new, PROCESS__SETCAP); 2170 return avc_has_perm(cred_sid(old), cred_sid(new), SECCLASS_PROCESS,
2171 PROCESS__SETCAP, NULL);
2172} 2172}
2173 2173
2174/* 2174/*
@@ -2224,29 +2224,22 @@ static int selinux_quota_on(struct dentry *dentry)
2224 2224
2225static int selinux_syslog(int type) 2225static int selinux_syslog(int type)
2226{ 2226{
2227 int rc;
2228
2229 switch (type) { 2227 switch (type) {
2230 case SYSLOG_ACTION_READ_ALL: /* Read last kernel messages */ 2228 case SYSLOG_ACTION_READ_ALL: /* Read last kernel messages */
2231 case SYSLOG_ACTION_SIZE_BUFFER: /* Return size of the log buffer */ 2229 case SYSLOG_ACTION_SIZE_BUFFER: /* Return size of the log buffer */
2232 rc = task_has_system(current, SYSTEM__SYSLOG_READ); 2230 return avc_has_perm(current_sid(), SECINITSID_KERNEL,
2233 break; 2231 SECCLASS_SYSTEM, SYSTEM__SYSLOG_READ, NULL);
2234 case SYSLOG_ACTION_CONSOLE_OFF: /* Disable logging to console */ 2232 case SYSLOG_ACTION_CONSOLE_OFF: /* Disable logging to console */
2235 case SYSLOG_ACTION_CONSOLE_ON: /* Enable logging to console */ 2233 case SYSLOG_ACTION_CONSOLE_ON: /* Enable logging to console */
2236 /* Set level of messages printed to console */ 2234 /* Set level of messages printed to console */
2237 case SYSLOG_ACTION_CONSOLE_LEVEL: 2235 case SYSLOG_ACTION_CONSOLE_LEVEL:
2238 rc = task_has_system(current, SYSTEM__SYSLOG_CONSOLE); 2236 return avc_has_perm(current_sid(), SECINITSID_KERNEL,
2239 break; 2237 SECCLASS_SYSTEM, SYSTEM__SYSLOG_CONSOLE,
2240 case SYSLOG_ACTION_CLOSE: /* Close log */ 2238 NULL);
2241 case SYSLOG_ACTION_OPEN: /* Open log */
2242 case SYSLOG_ACTION_READ: /* Read from log */
2243 case SYSLOG_ACTION_READ_CLEAR: /* Read/clear last kernel messages */
2244 case SYSLOG_ACTION_CLEAR: /* Clear ring buffer */
2245 default:
2246 rc = task_has_system(current, SYSTEM__SYSLOG_MOD);
2247 break;
2248 } 2239 }
2249 return rc; 2240 /* All other syslog types */
2241 return avc_has_perm(current_sid(), SECINITSID_KERNEL,
2242 SECCLASS_SYSTEM, SYSTEM__SYSLOG_MOD, NULL);
2250} 2243}
2251 2244
2252/* 2245/*
@@ -2271,13 +2264,13 @@ static int selinux_vm_enough_memory(struct mm_struct *mm, long pages)
2271 2264
2272/* binprm security operations */ 2265/* binprm security operations */
2273 2266
2274static u32 ptrace_parent_sid(struct task_struct *task) 2267static u32 ptrace_parent_sid(void)
2275{ 2268{
2276 u32 sid = 0; 2269 u32 sid = 0;
2277 struct task_struct *tracer; 2270 struct task_struct *tracer;
2278 2271
2279 rcu_read_lock(); 2272 rcu_read_lock();
2280 tracer = ptrace_parent(task); 2273 tracer = ptrace_parent(current);
2281 if (tracer) 2274 if (tracer)
2282 sid = task_sid(tracer); 2275 sid = task_sid(tracer);
2283 rcu_read_unlock(); 2276 rcu_read_unlock();
@@ -2406,7 +2399,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
2406 * changes its SID has the appropriate permit */ 2399 * changes its SID has the appropriate permit */
2407 if (bprm->unsafe & 2400 if (bprm->unsafe &
2408 (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) { 2401 (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
2409 u32 ptsid = ptrace_parent_sid(current); 2402 u32 ptsid = ptrace_parent_sid();
2410 if (ptsid != 0) { 2403 if (ptsid != 0) {
2411 rc = avc_has_perm(ptsid, new_tsec->sid, 2404 rc = avc_has_perm(ptsid, new_tsec->sid,
2412 SECCLASS_PROCESS, 2405 SECCLASS_PROCESS,
@@ -3503,6 +3496,7 @@ static int default_noexec;
3503static int file_map_prot_check(struct file *file, unsigned long prot, int shared) 3496static int file_map_prot_check(struct file *file, unsigned long prot, int shared)
3504{ 3497{
3505 const struct cred *cred = current_cred(); 3498 const struct cred *cred = current_cred();
3499 u32 sid = cred_sid(cred);
3506 int rc = 0; 3500 int rc = 0;
3507 3501
3508 if (default_noexec && 3502 if (default_noexec &&
@@ -3513,7 +3507,8 @@ static int file_map_prot_check(struct file *file, unsigned long prot, int shared
3513 * private file mapping that will also be writable. 3507 * private file mapping that will also be writable.
3514 * This has an additional check. 3508 * This has an additional check.
3515 */ 3509 */
3516 rc = cred_has_perm(cred, cred, PROCESS__EXECMEM); 3510 rc = avc_has_perm(sid, sid, SECCLASS_PROCESS,
3511 PROCESS__EXECMEM, NULL);
3517 if (rc) 3512 if (rc)
3518 goto error; 3513 goto error;
3519 } 3514 }
@@ -3564,6 +3559,7 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,
3564 unsigned long prot) 3559 unsigned long prot)
3565{ 3560{
3566 const struct cred *cred = current_cred(); 3561 const struct cred *cred = current_cred();
3562 u32 sid = cred_sid(cred);
3567 3563
3568 if (selinux_checkreqprot) 3564 if (selinux_checkreqprot)
3569 prot = reqprot; 3565 prot = reqprot;
@@ -3573,12 +3569,14 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,
3573 int rc = 0; 3569 int rc = 0;
3574 if (vma->vm_start >= vma->vm_mm->start_brk && 3570 if (vma->vm_start >= vma->vm_mm->start_brk &&
3575 vma->vm_end <= vma->vm_mm->brk) { 3571 vma->vm_end <= vma->vm_mm->brk) {
3576 rc = cred_has_perm(cred, cred, PROCESS__EXECHEAP); 3572 rc = avc_has_perm(sid, sid, SECCLASS_PROCESS,
3573 PROCESS__EXECHEAP, NULL);
3577 } else if (!vma->vm_file && 3574 } else if (!vma->vm_file &&
3578 ((vma->vm_start <= vma->vm_mm->start_stack && 3575 ((vma->vm_start <= vma->vm_mm->start_stack &&
3579 vma->vm_end >= vma->vm_mm->start_stack) || 3576 vma->vm_end >= vma->vm_mm->start_stack) ||
3580 vma_is_stack_for_current(vma))) { 3577 vma_is_stack_for_current(vma))) {
3581 rc = current_has_perm(current, PROCESS__EXECSTACK); 3578 rc = avc_has_perm(sid, sid, SECCLASS_PROCESS,
3579 PROCESS__EXECSTACK, NULL);
3582 } else if (vma->vm_file && vma->anon_vma) { 3580 } else if (vma->vm_file && vma->anon_vma) {
3583 /* 3581 /*
3584 * We are making executable a file mapping that has 3582 * We are making executable a file mapping that has
@@ -3711,7 +3709,9 @@ static int selinux_file_open(struct file *file, const struct cred *cred)
3711 3709
3712static int selinux_task_create(unsigned long clone_flags) 3710static int selinux_task_create(unsigned long clone_flags)
3713{ 3711{
3714 return current_has_perm(current, PROCESS__FORK); 3712 u32 sid = current_sid();
3713
3714 return avc_has_perm(sid, sid, SECCLASS_PROCESS, PROCESS__FORK, NULL);
3715} 3715}
3716 3716
3717/* 3717/*
@@ -3821,15 +3821,12 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode)
3821 3821
3822static int selinux_kernel_module_request(char *kmod_name) 3822static int selinux_kernel_module_request(char *kmod_name)
3823{ 3823{
3824 u32 sid;
3825 struct common_audit_data ad; 3824 struct common_audit_data ad;
3826 3825
3827 sid = task_sid(current);
3828
3829 ad.type = LSM_AUDIT_DATA_KMOD; 3826 ad.type = LSM_AUDIT_DATA_KMOD;
3830 ad.u.kmod_name = kmod_name; 3827 ad.u.kmod_name = kmod_name;
3831 3828
3832 return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, 3829 return avc_has_perm(current_sid(), SECINITSID_KERNEL, SECCLASS_SYSTEM,
3833 SYSTEM__MODULE_REQUEST, &ad); 3830 SYSTEM__MODULE_REQUEST, &ad);
3834} 3831}
3835 3832
@@ -3881,17 +3878,20 @@ static int selinux_kernel_read_file(struct file *file,
3881 3878
3882static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) 3879static int selinux_task_setpgid(struct task_struct *p, pid_t pgid)
3883{ 3880{
3884 return current_has_perm(p, PROCESS__SETPGID); 3881 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3882 PROCESS__SETPGID, NULL);
3885} 3883}
3886 3884
3887static int selinux_task_getpgid(struct task_struct *p) 3885static int selinux_task_getpgid(struct task_struct *p)
3888{ 3886{
3889 return current_has_perm(p, PROCESS__GETPGID); 3887 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3888 PROCESS__GETPGID, NULL);
3890} 3889}
3891 3890
3892static int selinux_task_getsid(struct task_struct *p) 3891static int selinux_task_getsid(struct task_struct *p)
3893{ 3892{
3894 return current_has_perm(p, PROCESS__GETSESSION); 3893 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3894 PROCESS__GETSESSION, NULL);
3895} 3895}
3896 3896
3897static void selinux_task_getsecid(struct task_struct *p, u32 *secid) 3897static void selinux_task_getsecid(struct task_struct *p, u32 *secid)
@@ -3901,17 +3901,20 @@ static void selinux_task_getsecid(struct task_struct *p, u32 *secid)
3901 3901
3902static int selinux_task_setnice(struct task_struct *p, int nice) 3902static int selinux_task_setnice(struct task_struct *p, int nice)
3903{ 3903{
3904 return current_has_perm(p, PROCESS__SETSCHED); 3904 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3905 PROCESS__SETSCHED, NULL);
3905} 3906}
3906 3907
3907static int selinux_task_setioprio(struct task_struct *p, int ioprio) 3908static int selinux_task_setioprio(struct task_struct *p, int ioprio)
3908{ 3909{
3909 return current_has_perm(p, PROCESS__SETSCHED); 3910 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3911 PROCESS__SETSCHED, NULL);
3910} 3912}
3911 3913
3912static int selinux_task_getioprio(struct task_struct *p) 3914static int selinux_task_getioprio(struct task_struct *p)
3913{ 3915{
3914 return current_has_perm(p, PROCESS__GETSCHED); 3916 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3917 PROCESS__GETSCHED, NULL);
3915} 3918}
3916 3919
3917static int selinux_task_setrlimit(struct task_struct *p, unsigned int resource, 3920static int selinux_task_setrlimit(struct task_struct *p, unsigned int resource,
@@ -3924,47 +3927,42 @@ static int selinux_task_setrlimit(struct task_struct *p, unsigned int resource,
3924 later be used as a safe reset point for the soft limit 3927 later be used as a safe reset point for the soft limit
3925 upon context transitions. See selinux_bprm_committing_creds. */ 3928 upon context transitions. See selinux_bprm_committing_creds. */
3926 if (old_rlim->rlim_max != new_rlim->rlim_max) 3929 if (old_rlim->rlim_max != new_rlim->rlim_max)
3927 return current_has_perm(p, PROCESS__SETRLIMIT); 3930 return avc_has_perm(current_sid(), task_sid(p),
3931 SECCLASS_PROCESS, PROCESS__SETRLIMIT, NULL);
3928 3932
3929 return 0; 3933 return 0;
3930} 3934}
3931 3935
3932static int selinux_task_setscheduler(struct task_struct *p) 3936static int selinux_task_setscheduler(struct task_struct *p)
3933{ 3937{
3934 return current_has_perm(p, PROCESS__SETSCHED); 3938 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3939 PROCESS__SETSCHED, NULL);
3935} 3940}
3936 3941
3937static int selinux_task_getscheduler(struct task_struct *p) 3942static int selinux_task_getscheduler(struct task_struct *p)
3938{ 3943{
3939 return current_has_perm(p, PROCESS__GETSCHED); 3944 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3945 PROCESS__GETSCHED, NULL);
3940} 3946}
3941 3947
3942static int selinux_task_movememory(struct task_struct *p) 3948static int selinux_task_movememory(struct task_struct *p)
3943{ 3949{
3944 return current_has_perm(p, PROCESS__SETSCHED); 3950 return avc_has_perm(current_sid(), task_sid(p), SECCLASS_PROCESS,
3951 PROCESS__SETSCHED, NULL);
3945} 3952}
3946 3953
3947static int selinux_task_kill(struct task_struct *p, struct siginfo *info, 3954static int selinux_task_kill(struct task_struct *p, struct siginfo *info,
3948 int sig, u32 secid) 3955 int sig, u32 secid)
3949{ 3956{
3950 u32 perm; 3957 u32 perm;
3951 int rc;
3952 3958
3953 if (!sig) 3959 if (!sig)
3954 perm = PROCESS__SIGNULL; /* null signal; existence test */ 3960 perm = PROCESS__SIGNULL; /* null signal; existence test */
3955 else 3961 else
3956 perm = signal_to_av(sig); 3962 perm = signal_to_av(sig);
3957 if (secid) 3963 if (!secid)
3958 rc = avc_has_perm(secid, task_sid(p), 3964 secid = current_sid();
3959 SECCLASS_PROCESS, perm, NULL); 3965 return avc_has_perm(secid, task_sid(p), SECCLASS_PROCESS, perm, NULL);
3960 else
3961 rc = current_has_perm(p, perm);
3962 return rc;
3963}
3964
3965static int selinux_task_wait(struct task_struct *p)
3966{
3967 return task_has_perm(p, current, PROCESS__SIGCHLD);
3968} 3966}
3969 3967
3970static void selinux_task_to_inode(struct task_struct *p, 3968static void selinux_task_to_inode(struct task_struct *p,
@@ -4254,12 +4252,11 @@ static int socket_sockcreate_sid(const struct task_security_struct *tsec,
4254 socksid); 4252 socksid);
4255} 4253}
4256 4254
4257static int sock_has_perm(struct task_struct *task, struct sock *sk, u32 perms) 4255static int sock_has_perm(struct sock *sk, u32 perms)
4258{ 4256{
4259 struct sk_security_struct *sksec = sk->sk_security; 4257 struct sk_security_struct *sksec = sk->sk_security;
4260 struct common_audit_data ad; 4258 struct common_audit_data ad;
4261 struct lsm_network_audit net = {0,}; 4259 struct lsm_network_audit net = {0,};
4262 u32 tsid = task_sid(task);
4263 4260
4264 if (sksec->sid == SECINITSID_KERNEL) 4261 if (sksec->sid == SECINITSID_KERNEL)
4265 return 0; 4262 return 0;
@@ -4268,7 +4265,8 @@ static int sock_has_perm(struct task_struct *task, struct sock *sk, u32 perms)
4268 ad.u.net = &net; 4265 ad.u.net = &net;
4269 ad.u.net->sk = sk; 4266 ad.u.net->sk = sk;
4270 4267
4271 return avc_has_perm(tsid, sksec->sid, sksec->sclass, perms, &ad); 4268 return avc_has_perm(current_sid(), sksec->sid, sksec->sclass, perms,
4269 &ad);
4272} 4270}
4273 4271
4274static int selinux_socket_create(int family, int type, 4272static int selinux_socket_create(int family, int type,
@@ -4330,7 +4328,7 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in
4330 u16 family; 4328 u16 family;
4331 int err; 4329 int err;
4332 4330
4333 err = sock_has_perm(current, sk, SOCKET__BIND); 4331 err = sock_has_perm(sk, SOCKET__BIND);
4334 if (err) 4332 if (err)
4335 goto out; 4333 goto out;
4336 4334
@@ -4429,7 +4427,7 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address,
4429 struct sk_security_struct *sksec = sk->sk_security; 4427 struct sk_security_struct *sksec = sk->sk_security;
4430 int err; 4428 int err;
4431 4429
4432 err = sock_has_perm(current, sk, SOCKET__CONNECT); 4430 err = sock_has_perm(sk, SOCKET__CONNECT);
4433 if (err) 4431 if (err)
4434 return err; 4432 return err;
4435 4433
@@ -4481,7 +4479,7 @@ out:
4481 4479
4482static int selinux_socket_listen(struct socket *sock, int backlog) 4480static int selinux_socket_listen(struct socket *sock, int backlog)
4483{ 4481{
4484 return sock_has_perm(current, sock->sk, SOCKET__LISTEN); 4482 return sock_has_perm(sock->sk, SOCKET__LISTEN);
4485} 4483}
4486 4484
4487static int selinux_socket_accept(struct socket *sock, struct socket *newsock) 4485static int selinux_socket_accept(struct socket *sock, struct socket *newsock)
@@ -4492,7 +4490,7 @@ static int selinux_socket_accept(struct socket *sock, struct socket *newsock)
4492 u16 sclass; 4490 u16 sclass;
4493 u32 sid; 4491 u32 sid;
4494 4492
4495 err = sock_has_perm(current, sock->sk, SOCKET__ACCEPT); 4493 err = sock_has_perm(sock->sk, SOCKET__ACCEPT);
4496 if (err) 4494 if (err)
4497 return err; 4495 return err;
4498 4496
@@ -4513,30 +4511,30 @@ static int selinux_socket_accept(struct socket *sock, struct socket *newsock)
4513static int selinux_socket_sendmsg(struct socket *sock, struct msghdr *msg, 4511static int selinux_socket_sendmsg(struct socket *sock, struct msghdr *msg,
4514 int size) 4512 int size)
4515{ 4513{
4516 return sock_has_perm(current, sock->sk, SOCKET__WRITE); 4514 return sock_has_perm(sock->sk, SOCKET__WRITE);
4517} 4515}
4518 4516
4519static int selinux_socket_recvmsg(struct socket *sock, struct msghdr *msg, 4517static int selinux_socket_recvmsg(struct socket *sock, struct msghdr *msg,
4520 int size, int flags) 4518 int size, int flags)
4521{ 4519{
4522 return sock_has_perm(current, sock->sk, SOCKET__READ); 4520 return sock_has_perm(sock->sk, SOCKET__READ);
4523} 4521}
4524 4522
4525static int selinux_socket_getsockname(struct socket *sock) 4523static int selinux_socket_getsockname(struct socket *sock)
4526{ 4524{
4527 return sock_has_perm(current, sock->sk, SOCKET__GETATTR); 4525 return sock_has_perm(sock->sk, SOCKET__GETATTR);
4528} 4526}
4529 4527
4530static int selinux_socket_getpeername(struct socket *sock) 4528static int selinux_socket_getpeername(struct socket *sock)
4531{ 4529{
4532 return sock_has_perm(current, sock->sk, SOCKET__GETATTR); 4530 return sock_has_perm(sock->sk, SOCKET__GETATTR);
4533} 4531}
4534 4532
4535static int selinux_socket_setsockopt(struct socket *sock, int level, int optname) 4533static int selinux_socket_setsockopt(struct socket *sock, int level, int optname)
4536{ 4534{
4537 int err; 4535 int err;
4538 4536
4539 err = sock_has_perm(current, sock->sk, SOCKET__SETOPT); 4537 err = sock_has_perm(sock->sk, SOCKET__SETOPT);
4540 if (err) 4538 if (err)
4541 return err; 4539 return err;
4542 4540
@@ -4546,12 +4544,12 @@ static int selinux_socket_setsockopt(struct socket *sock, int level, int optname
4546static int selinux_socket_getsockopt(struct socket *sock, int level, 4544static int selinux_socket_getsockopt(struct socket *sock, int level,
4547 int optname) 4545 int optname)
4548{ 4546{
4549 return sock_has_perm(current, sock->sk, SOCKET__GETOPT); 4547 return sock_has_perm(sock->sk, SOCKET__GETOPT);
4550} 4548}
4551 4549
4552static int selinux_socket_shutdown(struct socket *sock, int how) 4550static int selinux_socket_shutdown(struct socket *sock, int how)
4553{ 4551{
4554 return sock_has_perm(current, sock->sk, SOCKET__SHUTDOWN); 4552 return sock_has_perm(sock->sk, SOCKET__SHUTDOWN);
4555} 4553}
4556 4554
4557static int selinux_socket_unix_stream_connect(struct sock *sock, 4555static int selinux_socket_unix_stream_connect(struct sock *sock,
@@ -5039,7 +5037,7 @@ static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb)
5039 goto out; 5037 goto out;
5040 } 5038 }
5041 5039
5042 err = sock_has_perm(current, sk, perm); 5040 err = sock_has_perm(sk, perm);
5043out: 5041out:
5044 return err; 5042 return err;
5045} 5043}
@@ -5370,20 +5368,17 @@ static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
5370 return selinux_nlmsg_perm(sk, skb); 5368 return selinux_nlmsg_perm(sk, skb);
5371} 5369}
5372 5370
5373static int ipc_alloc_security(struct task_struct *task, 5371static int ipc_alloc_security(struct kern_ipc_perm *perm,
5374 struct kern_ipc_perm *perm,
5375 u16 sclass) 5372 u16 sclass)
5376{ 5373{
5377 struct ipc_security_struct *isec; 5374 struct ipc_security_struct *isec;
5378 u32 sid;
5379 5375
5380 isec = kzalloc(sizeof(struct ipc_security_struct), GFP_KERNEL); 5376 isec = kzalloc(sizeof(struct ipc_security_struct), GFP_KERNEL);
5381 if (!isec) 5377 if (!isec)
5382 return -ENOMEM; 5378 return -ENOMEM;
5383 5379
5384 sid = task_sid(task);
5385 isec->sclass = sclass; 5380 isec->sclass = sclass;
5386 isec->sid = sid; 5381 isec->sid = current_sid();
5387 perm->security = isec; 5382 perm->security = isec;
5388 5383
5389 return 0; 5384 return 0;
@@ -5451,7 +5446,7 @@ static int selinux_msg_queue_alloc_security(struct msg_queue *msq)
5451 u32 sid = current_sid(); 5446 u32 sid = current_sid();
5452 int rc; 5447 int rc;
5453 5448
5454 rc = ipc_alloc_security(current, &msq->q_perm, SECCLASS_MSGQ); 5449 rc = ipc_alloc_security(&msq->q_perm, SECCLASS_MSGQ);
5455 if (rc) 5450 if (rc)
5456 return rc; 5451 return rc;
5457 5452
@@ -5498,7 +5493,8 @@ static int selinux_msg_queue_msgctl(struct msg_queue *msq, int cmd)
5498 case IPC_INFO: 5493 case IPC_INFO:
5499 case MSG_INFO: 5494 case MSG_INFO:
5500 /* No specific object, just general system-wide information. */ 5495 /* No specific object, just general system-wide information. */
5501 return task_has_system(current, SYSTEM__IPC_INFO); 5496 return avc_has_perm(current_sid(), SECINITSID_KERNEL,
5497 SECCLASS_SYSTEM, SYSTEM__IPC_INFO, NULL);
5502 case IPC_STAT: 5498 case IPC_STAT:
5503 case MSG_STAT: 5499 case MSG_STAT:
5504 perms = MSGQ__GETATTR | MSGQ__ASSOCIATE; 5500 perms = MSGQ__GETATTR | MSGQ__ASSOCIATE;
@@ -5592,7 +5588,7 @@ static int selinux_shm_alloc_security(struct shmid_kernel *shp)
5592 u32 sid = current_sid(); 5588 u32 sid = current_sid();
5593 int rc; 5589 int rc;
5594 5590
5595 rc = ipc_alloc_security(current, &shp->shm_perm, SECCLASS_SHM); 5591 rc = ipc_alloc_security(&shp->shm_perm, SECCLASS_SHM);
5596 if (rc) 5592 if (rc)
5597 return rc; 5593 return rc;
5598 5594
@@ -5640,7 +5636,8 @@ static int selinux_shm_shmctl(struct shmid_kernel *shp, int cmd)
5640 case IPC_INFO: 5636 case IPC_INFO:
5641 case SHM_INFO: 5637 case SHM_INFO:
5642 /* No specific object, just general system-wide information. */ 5638 /* No specific object, just general system-wide information. */
5643 return task_has_system(current, SYSTEM__IPC_INFO); 5639 return avc_has_perm(current_sid(), SECINITSID_KERNEL,
5640 SECCLASS_SYSTEM, SYSTEM__IPC_INFO, NULL);
5644 case IPC_STAT: 5641 case IPC_STAT:
5645 case SHM_STAT: 5642 case SHM_STAT:
5646 perms = SHM__GETATTR | SHM__ASSOCIATE; 5643 perms = SHM__GETATTR | SHM__ASSOCIATE;
@@ -5684,7 +5681,7 @@ static int selinux_sem_alloc_security(struct sem_array *sma)
5684 u32 sid = current_sid(); 5681 u32 sid = current_sid();
5685 int rc; 5682 int rc;
5686 5683
5687 rc = ipc_alloc_security(current, &sma->sem_perm, SECCLASS_SEM); 5684 rc = ipc_alloc_security(&sma->sem_perm, SECCLASS_SEM);
5688 if (rc) 5685 if (rc)
5689 return rc; 5686 return rc;
5690 5687
@@ -5732,7 +5729,8 @@ static int selinux_sem_semctl(struct sem_array *sma, int cmd)
5732 case IPC_INFO: 5729 case IPC_INFO:
5733 case SEM_INFO: 5730 case SEM_INFO:
5734 /* No specific object, just general system-wide information. */ 5731 /* No specific object, just general system-wide information. */
5735 return task_has_system(current, SYSTEM__IPC_INFO); 5732 return avc_has_perm(current_sid(), SECINITSID_KERNEL,
5733 SECCLASS_SYSTEM, SYSTEM__IPC_INFO, NULL);
5736 case GETPID: 5734 case GETPID:
5737 case GETNCNT: 5735 case GETNCNT:
5738 case GETZCNT: 5736 case GETZCNT:
@@ -5813,15 +5811,16 @@ static int selinux_getprocattr(struct task_struct *p,
5813 int error; 5811 int error;
5814 unsigned len; 5812 unsigned len;
5815 5813
5814 rcu_read_lock();
5815 __tsec = __task_cred(p)->security;
5816
5816 if (current != p) { 5817 if (current != p) {
5817 error = current_has_perm(p, PROCESS__GETATTR); 5818 error = avc_has_perm(current_sid(), __tsec->sid,
5819 SECCLASS_PROCESS, PROCESS__GETATTR, NULL);
5818 if (error) 5820 if (error)
5819 return error; 5821 goto bad;
5820 } 5822 }
5821 5823
5822 rcu_read_lock();
5823 __tsec = __task_cred(p)->security;
5824
5825 if (!strcmp(name, "current")) 5824 if (!strcmp(name, "current"))
5826 sid = __tsec->sid; 5825 sid = __tsec->sid;
5827 else if (!strcmp(name, "prev")) 5826 else if (!strcmp(name, "prev"))
@@ -5834,8 +5833,10 @@ static int selinux_getprocattr(struct task_struct *p,
5834 sid = __tsec->keycreate_sid; 5833 sid = __tsec->keycreate_sid;
5835 else if (!strcmp(name, "sockcreate")) 5834 else if (!strcmp(name, "sockcreate"))
5836 sid = __tsec->sockcreate_sid; 5835 sid = __tsec->sockcreate_sid;
5837 else 5836 else {
5838 goto invalid; 5837 error = -EINVAL;
5838 goto bad;
5839 }
5839 rcu_read_unlock(); 5840 rcu_read_unlock();
5840 5841
5841 if (!sid) 5842 if (!sid)
@@ -5846,41 +5847,37 @@ static int selinux_getprocattr(struct task_struct *p,
5846 return error; 5847 return error;
5847 return len; 5848 return len;
5848 5849
5849invalid: 5850bad:
5850 rcu_read_unlock(); 5851 rcu_read_unlock();
5851 return -EINVAL; 5852 return error;
5852} 5853}
5853 5854
5854static int selinux_setprocattr(struct task_struct *p, 5855static int selinux_setprocattr(const char *name, void *value, size_t size)
5855 char *name, void *value, size_t size)
5856{ 5856{
5857 struct task_security_struct *tsec; 5857 struct task_security_struct *tsec;
5858 struct cred *new; 5858 struct cred *new;
5859 u32 sid = 0, ptsid; 5859 u32 mysid = current_sid(), sid = 0, ptsid;
5860 int error; 5860 int error;
5861 char *str = value; 5861 char *str = value;
5862 5862
5863 if (current != p) {
5864 /* SELinux only allows a process to change its own
5865 security attributes. */
5866 return -EACCES;
5867 }
5868
5869 /* 5863 /*
5870 * Basic control over ability to set these attributes at all. 5864 * Basic control over ability to set these attributes at all.
5871 * current == p, but we'll pass them separately in case the
5872 * above restriction is ever removed.
5873 */ 5865 */
5874 if (!strcmp(name, "exec")) 5866 if (!strcmp(name, "exec"))
5875 error = current_has_perm(p, PROCESS__SETEXEC); 5867 error = avc_has_perm(mysid, mysid, SECCLASS_PROCESS,
5868 PROCESS__SETEXEC, NULL);
5876 else if (!strcmp(name, "fscreate")) 5869 else if (!strcmp(name, "fscreate"))
5877 error = current_has_perm(p, PROCESS__SETFSCREATE); 5870 error = avc_has_perm(mysid, mysid, SECCLASS_PROCESS,
5871 PROCESS__SETFSCREATE, NULL);
5878 else if (!strcmp(name, "keycreate")) 5872 else if (!strcmp(name, "keycreate"))
5879 error = current_has_perm(p, PROCESS__SETKEYCREATE); 5873 error = avc_has_perm(mysid, mysid, SECCLASS_PROCESS,
5874 PROCESS__SETKEYCREATE, NULL);
5880 else if (!strcmp(name, "sockcreate")) 5875 else if (!strcmp(name, "sockcreate"))
5881 error = current_has_perm(p, PROCESS__SETSOCKCREATE); 5876 error = avc_has_perm(mysid, mysid, SECCLASS_PROCESS,
5877 PROCESS__SETSOCKCREATE, NULL);
5882 else if (!strcmp(name, "current")) 5878 else if (!strcmp(name, "current"))
5883 error = current_has_perm(p, PROCESS__SETCURRENT); 5879 error = avc_has_perm(mysid, mysid, SECCLASS_PROCESS,
5880 PROCESS__SETCURRENT, NULL);
5884 else 5881 else
5885 error = -EINVAL; 5882 error = -EINVAL;
5886 if (error) 5883 if (error)
@@ -5934,7 +5931,8 @@ static int selinux_setprocattr(struct task_struct *p,
5934 } else if (!strcmp(name, "fscreate")) { 5931 } else if (!strcmp(name, "fscreate")) {
5935 tsec->create_sid = sid; 5932 tsec->create_sid = sid;
5936 } else if (!strcmp(name, "keycreate")) { 5933 } else if (!strcmp(name, "keycreate")) {
5937 error = may_create_key(sid, p); 5934 error = avc_has_perm(mysid, sid, SECCLASS_KEY, KEY__CREATE,
5935 NULL);
5938 if (error) 5936 if (error)
5939 goto abort_change; 5937 goto abort_change;
5940 tsec->keycreate_sid = sid; 5938 tsec->keycreate_sid = sid;
@@ -5961,7 +5959,7 @@ static int selinux_setprocattr(struct task_struct *p,
5961 5959
5962 /* Check for ptracing, and update the task SID if ok. 5960 /* Check for ptracing, and update the task SID if ok.
5963 Otherwise, leave SID unchanged and fail. */ 5961 Otherwise, leave SID unchanged and fail. */
5964 ptsid = ptrace_parent_sid(p); 5962 ptsid = ptrace_parent_sid();
5965 if (ptsid != 0) { 5963 if (ptsid != 0) {
5966 error = avc_has_perm(ptsid, sid, SECCLASS_PROCESS, 5964 error = avc_has_perm(ptsid, sid, SECCLASS_PROCESS,
5967 PROCESS__PTRACE, NULL); 5965 PROCESS__PTRACE, NULL);
@@ -6209,7 +6207,6 @@ static struct security_hook_list selinux_hooks[] = {
6209 LSM_HOOK_INIT(task_getscheduler, selinux_task_getscheduler), 6207 LSM_HOOK_INIT(task_getscheduler, selinux_task_getscheduler),
6210 LSM_HOOK_INIT(task_movememory, selinux_task_movememory), 6208 LSM_HOOK_INIT(task_movememory, selinux_task_movememory),
6211 LSM_HOOK_INIT(task_kill, selinux_task_kill), 6209 LSM_HOOK_INIT(task_kill, selinux_task_kill),
6212 LSM_HOOK_INIT(task_wait, selinux_task_wait),
6213 LSM_HOOK_INIT(task_to_inode, selinux_task_to_inode), 6210 LSM_HOOK_INIT(task_to_inode, selinux_task_to_inode),
6214 6211
6215 LSM_HOOK_INIT(ipc_permission, selinux_ipc_permission), 6212 LSM_HOOK_INIT(ipc_permission, selinux_ipc_permission),