diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 176 |
1 files changed, 133 insertions, 43 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 28482f9e15b8..d85b793c9321 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1420,6 +1420,7 @@ static int cred_has_capability(const struct cred *cred, | |||
1420 | int cap, int audit) | 1420 | int cap, int audit) |
1421 | { | 1421 | { |
1422 | struct common_audit_data ad; | 1422 | struct common_audit_data ad; |
1423 | struct selinux_audit_data sad = {0,}; | ||
1423 | struct av_decision avd; | 1424 | struct av_decision avd; |
1424 | u16 sclass; | 1425 | u16 sclass; |
1425 | u32 sid = cred_sid(cred); | 1426 | u32 sid = cred_sid(cred); |
@@ -1427,6 +1428,7 @@ static int cred_has_capability(const struct cred *cred, | |||
1427 | int rc; | 1428 | int rc; |
1428 | 1429 | ||
1429 | COMMON_AUDIT_DATA_INIT(&ad, CAP); | 1430 | COMMON_AUDIT_DATA_INIT(&ad, CAP); |
1431 | ad.selinux_audit_data = &sad; | ||
1430 | ad.tsk = current; | 1432 | ad.tsk = current; |
1431 | ad.u.cap = cap; | 1433 | ad.u.cap = cap; |
1432 | 1434 | ||
@@ -1492,9 +1494,11 @@ static int inode_has_perm_noadp(const struct cred *cred, | |||
1492 | unsigned flags) | 1494 | unsigned flags) |
1493 | { | 1495 | { |
1494 | struct common_audit_data ad; | 1496 | struct common_audit_data ad; |
1497 | struct selinux_audit_data sad = {0,}; | ||
1495 | 1498 | ||
1496 | COMMON_AUDIT_DATA_INIT(&ad, INODE); | 1499 | COMMON_AUDIT_DATA_INIT(&ad, INODE); |
1497 | ad.u.inode = inode; | 1500 | ad.u.inode = inode; |
1501 | ad.selinux_audit_data = &sad; | ||
1498 | return inode_has_perm(cred, inode, perms, &ad, flags); | 1502 | return inode_has_perm(cred, inode, perms, &ad, flags); |
1499 | } | 1503 | } |
1500 | 1504 | ||
@@ -1507,9 +1511,11 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
1507 | { | 1511 | { |
1508 | struct inode *inode = dentry->d_inode; | 1512 | struct inode *inode = dentry->d_inode; |
1509 | struct common_audit_data ad; | 1513 | struct common_audit_data ad; |
1514 | struct selinux_audit_data sad = {0,}; | ||
1510 | 1515 | ||
1511 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1516 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1512 | ad.u.dentry = dentry; | 1517 | ad.u.dentry = dentry; |
1518 | ad.selinux_audit_data = &sad; | ||
1513 | return inode_has_perm(cred, inode, av, &ad, 0); | 1519 | return inode_has_perm(cred, inode, av, &ad, 0); |
1514 | } | 1520 | } |
1515 | 1521 | ||
@@ -1522,9 +1528,11 @@ static inline int path_has_perm(const struct cred *cred, | |||
1522 | { | 1528 | { |
1523 | struct inode *inode = path->dentry->d_inode; | 1529 | struct inode *inode = path->dentry->d_inode; |
1524 | struct common_audit_data ad; | 1530 | struct common_audit_data ad; |
1531 | struct selinux_audit_data sad = {0,}; | ||
1525 | 1532 | ||
1526 | COMMON_AUDIT_DATA_INIT(&ad, PATH); | 1533 | COMMON_AUDIT_DATA_INIT(&ad, PATH); |
1527 | ad.u.path = *path; | 1534 | ad.u.path = *path; |
1535 | ad.selinux_audit_data = &sad; | ||
1528 | return inode_has_perm(cred, inode, av, &ad, 0); | 1536 | return inode_has_perm(cred, inode, av, &ad, 0); |
1529 | } | 1537 | } |
1530 | 1538 | ||
@@ -1543,11 +1551,13 @@ static int file_has_perm(const struct cred *cred, | |||
1543 | struct file_security_struct *fsec = file->f_security; | 1551 | struct file_security_struct *fsec = file->f_security; |
1544 | struct inode *inode = file->f_path.dentry->d_inode; | 1552 | struct inode *inode = file->f_path.dentry->d_inode; |
1545 | struct common_audit_data ad; | 1553 | struct common_audit_data ad; |
1554 | struct selinux_audit_data sad = {0,}; | ||
1546 | u32 sid = cred_sid(cred); | 1555 | u32 sid = cred_sid(cred); |
1547 | int rc; | 1556 | int rc; |
1548 | 1557 | ||
1549 | COMMON_AUDIT_DATA_INIT(&ad, PATH); | 1558 | COMMON_AUDIT_DATA_INIT(&ad, PATH); |
1550 | ad.u.path = file->f_path; | 1559 | ad.u.path = file->f_path; |
1560 | ad.selinux_audit_data = &sad; | ||
1551 | 1561 | ||
1552 | if (sid != fsec->sid) { | 1562 | if (sid != fsec->sid) { |
1553 | rc = avc_has_perm(sid, fsec->sid, | 1563 | rc = avc_has_perm(sid, fsec->sid, |
@@ -1577,6 +1587,7 @@ static int may_create(struct inode *dir, | |||
1577 | struct superblock_security_struct *sbsec; | 1587 | struct superblock_security_struct *sbsec; |
1578 | u32 sid, newsid; | 1588 | u32 sid, newsid; |
1579 | struct common_audit_data ad; | 1589 | struct common_audit_data ad; |
1590 | struct selinux_audit_data sad = {0,}; | ||
1580 | int rc; | 1591 | int rc; |
1581 | 1592 | ||
1582 | dsec = dir->i_security; | 1593 | dsec = dir->i_security; |
@@ -1587,6 +1598,7 @@ static int may_create(struct inode *dir, | |||
1587 | 1598 | ||
1588 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1599 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1589 | ad.u.dentry = dentry; | 1600 | ad.u.dentry = dentry; |
1601 | ad.selinux_audit_data = &sad; | ||
1590 | 1602 | ||
1591 | rc = avc_has_perm(sid, dsec->sid, SECCLASS_DIR, | 1603 | rc = avc_has_perm(sid, dsec->sid, SECCLASS_DIR, |
1592 | DIR__ADD_NAME | DIR__SEARCH, | 1604 | DIR__ADD_NAME | DIR__SEARCH, |
@@ -1631,6 +1643,7 @@ static int may_link(struct inode *dir, | |||
1631 | { | 1643 | { |
1632 | struct inode_security_struct *dsec, *isec; | 1644 | struct inode_security_struct *dsec, *isec; |
1633 | struct common_audit_data ad; | 1645 | struct common_audit_data ad; |
1646 | struct selinux_audit_data sad = {0,}; | ||
1634 | u32 sid = current_sid(); | 1647 | u32 sid = current_sid(); |
1635 | u32 av; | 1648 | u32 av; |
1636 | int rc; | 1649 | int rc; |
@@ -1640,6 +1653,7 @@ static int may_link(struct inode *dir, | |||
1640 | 1653 | ||
1641 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1654 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1642 | ad.u.dentry = dentry; | 1655 | ad.u.dentry = dentry; |
1656 | ad.selinux_audit_data = &sad; | ||
1643 | 1657 | ||
1644 | av = DIR__SEARCH; | 1658 | av = DIR__SEARCH; |
1645 | av |= (kind ? DIR__REMOVE_NAME : DIR__ADD_NAME); | 1659 | av |= (kind ? DIR__REMOVE_NAME : DIR__ADD_NAME); |
@@ -1674,6 +1688,7 @@ static inline int may_rename(struct inode *old_dir, | |||
1674 | { | 1688 | { |
1675 | struct inode_security_struct *old_dsec, *new_dsec, *old_isec, *new_isec; | 1689 | struct inode_security_struct *old_dsec, *new_dsec, *old_isec, *new_isec; |
1676 | struct common_audit_data ad; | 1690 | struct common_audit_data ad; |
1691 | struct selinux_audit_data sad = {0,}; | ||
1677 | u32 sid = current_sid(); | 1692 | u32 sid = current_sid(); |
1678 | u32 av; | 1693 | u32 av; |
1679 | int old_is_dir, new_is_dir; | 1694 | int old_is_dir, new_is_dir; |
@@ -1685,6 +1700,7 @@ static inline int may_rename(struct inode *old_dir, | |||
1685 | new_dsec = new_dir->i_security; | 1700 | new_dsec = new_dir->i_security; |
1686 | 1701 | ||
1687 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1702 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1703 | ad.selinux_audit_data = &sad; | ||
1688 | 1704 | ||
1689 | ad.u.dentry = old_dentry; | 1705 | ad.u.dentry = old_dentry; |
1690 | rc = avc_has_perm(sid, old_dsec->sid, SECCLASS_DIR, | 1706 | rc = avc_has_perm(sid, old_dsec->sid, SECCLASS_DIR, |
@@ -1970,6 +1986,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
1970 | struct task_security_struct *new_tsec; | 1986 | struct task_security_struct *new_tsec; |
1971 | struct inode_security_struct *isec; | 1987 | struct inode_security_struct *isec; |
1972 | struct common_audit_data ad; | 1988 | struct common_audit_data ad; |
1989 | struct selinux_audit_data sad = {0,}; | ||
1973 | struct inode *inode = bprm->file->f_path.dentry->d_inode; | 1990 | struct inode *inode = bprm->file->f_path.dentry->d_inode; |
1974 | int rc; | 1991 | int rc; |
1975 | 1992 | ||
@@ -2009,6 +2026,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
2009 | } | 2026 | } |
2010 | 2027 | ||
2011 | COMMON_AUDIT_DATA_INIT(&ad, PATH); | 2028 | COMMON_AUDIT_DATA_INIT(&ad, PATH); |
2029 | ad.selinux_audit_data = &sad; | ||
2012 | ad.u.path = bprm->file->f_path; | 2030 | ad.u.path = bprm->file->f_path; |
2013 | 2031 | ||
2014 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) | 2032 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) |
@@ -2098,6 +2116,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
2098 | struct files_struct *files) | 2116 | struct files_struct *files) |
2099 | { | 2117 | { |
2100 | struct common_audit_data ad; | 2118 | struct common_audit_data ad; |
2119 | struct selinux_audit_data sad = {0,}; | ||
2101 | struct file *file, *devnull = NULL; | 2120 | struct file *file, *devnull = NULL; |
2102 | struct tty_struct *tty; | 2121 | struct tty_struct *tty; |
2103 | struct fdtable *fdt; | 2122 | struct fdtable *fdt; |
@@ -2135,6 +2154,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
2135 | /* Revalidate access to inherited open files. */ | 2154 | /* Revalidate access to inherited open files. */ |
2136 | 2155 | ||
2137 | COMMON_AUDIT_DATA_INIT(&ad, INODE); | 2156 | COMMON_AUDIT_DATA_INIT(&ad, INODE); |
2157 | ad.selinux_audit_data = &sad; | ||
2138 | 2158 | ||
2139 | spin_lock(&files->file_lock); | 2159 | spin_lock(&files->file_lock); |
2140 | for (;;) { | 2160 | for (;;) { |
@@ -2472,6 +2492,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) | |||
2472 | { | 2492 | { |
2473 | const struct cred *cred = current_cred(); | 2493 | const struct cred *cred = current_cred(); |
2474 | struct common_audit_data ad; | 2494 | struct common_audit_data ad; |
2495 | struct selinux_audit_data sad = {0,}; | ||
2475 | int rc; | 2496 | int rc; |
2476 | 2497 | ||
2477 | rc = superblock_doinit(sb, data); | 2498 | rc = superblock_doinit(sb, data); |
@@ -2483,6 +2504,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) | |||
2483 | return 0; | 2504 | return 0; |
2484 | 2505 | ||
2485 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 2506 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
2507 | ad.selinux_audit_data = &sad; | ||
2486 | ad.u.dentry = sb->s_root; | 2508 | ad.u.dentry = sb->s_root; |
2487 | return superblock_has_perm(cred, sb, FILESYSTEM__MOUNT, &ad); | 2509 | return superblock_has_perm(cred, sb, FILESYSTEM__MOUNT, &ad); |
2488 | } | 2510 | } |
@@ -2491,8 +2513,10 @@ static int selinux_sb_statfs(struct dentry *dentry) | |||
2491 | { | 2513 | { |
2492 | const struct cred *cred = current_cred(); | 2514 | const struct cred *cred = current_cred(); |
2493 | struct common_audit_data ad; | 2515 | struct common_audit_data ad; |
2516 | struct selinux_audit_data sad = {0,}; | ||
2494 | 2517 | ||
2495 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 2518 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
2519 | ad.selinux_audit_data = &sad; | ||
2496 | ad.u.dentry = dentry->d_sb->s_root; | 2520 | ad.u.dentry = dentry->d_sb->s_root; |
2497 | return superblock_has_perm(cred, dentry->d_sb, FILESYSTEM__GETATTR, &ad); | 2521 | return superblock_has_perm(cred, dentry->d_sb, FILESYSTEM__GETATTR, &ad); |
2498 | } | 2522 | } |
@@ -2656,6 +2680,7 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2656 | { | 2680 | { |
2657 | const struct cred *cred = current_cred(); | 2681 | const struct cred *cred = current_cred(); |
2658 | struct common_audit_data ad; | 2682 | struct common_audit_data ad; |
2683 | struct selinux_audit_data sad = {0,}; | ||
2659 | u32 perms; | 2684 | u32 perms; |
2660 | bool from_access; | 2685 | bool from_access; |
2661 | unsigned flags = mask & MAY_NOT_BLOCK; | 2686 | unsigned flags = mask & MAY_NOT_BLOCK; |
@@ -2668,10 +2693,11 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2668 | return 0; | 2693 | return 0; |
2669 | 2694 | ||
2670 | COMMON_AUDIT_DATA_INIT(&ad, INODE); | 2695 | COMMON_AUDIT_DATA_INIT(&ad, INODE); |
2696 | ad.selinux_audit_data = &sad; | ||
2671 | ad.u.inode = inode; | 2697 | ad.u.inode = inode; |
2672 | 2698 | ||
2673 | if (from_access) | 2699 | if (from_access) |
2674 | ad.selinux_audit_data.auditdeny |= FILE__AUDIT_ACCESS; | 2700 | ad.selinux_audit_data->auditdeny |= FILE__AUDIT_ACCESS; |
2675 | 2701 | ||
2676 | perms = file_mask_to_av(inode->i_mode, mask); | 2702 | perms = file_mask_to_av(inode->i_mode, mask); |
2677 | 2703 | ||
@@ -2737,6 +2763,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2737 | struct inode_security_struct *isec = inode->i_security; | 2763 | struct inode_security_struct *isec = inode->i_security; |
2738 | struct superblock_security_struct *sbsec; | 2764 | struct superblock_security_struct *sbsec; |
2739 | struct common_audit_data ad; | 2765 | struct common_audit_data ad; |
2766 | struct selinux_audit_data sad = {0,}; | ||
2740 | u32 newsid, sid = current_sid(); | 2767 | u32 newsid, sid = current_sid(); |
2741 | int rc = 0; | 2768 | int rc = 0; |
2742 | 2769 | ||
@@ -2751,6 +2778,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2751 | return -EPERM; | 2778 | return -EPERM; |
2752 | 2779 | ||
2753 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 2780 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
2781 | ad.selinux_audit_data = &sad; | ||
2754 | ad.u.dentry = dentry; | 2782 | ad.u.dentry = dentry; |
2755 | 2783 | ||
2756 | rc = avc_has_perm(sid, isec->sid, isec->sclass, | 2784 | rc = avc_has_perm(sid, isec->sid, isec->sclass, |
@@ -3345,10 +3373,12 @@ static int selinux_kernel_module_request(char *kmod_name) | |||
3345 | { | 3373 | { |
3346 | u32 sid; | 3374 | u32 sid; |
3347 | struct common_audit_data ad; | 3375 | struct common_audit_data ad; |
3376 | struct selinux_audit_data sad = {0,}; | ||
3348 | 3377 | ||
3349 | sid = task_sid(current); | 3378 | sid = task_sid(current); |
3350 | 3379 | ||
3351 | COMMON_AUDIT_DATA_INIT(&ad, KMOD); | 3380 | COMMON_AUDIT_DATA_INIT(&ad, KMOD); |
3381 | ad.selinux_audit_data = &sad; | ||
3352 | ad.u.kmod_name = kmod_name; | 3382 | ad.u.kmod_name = kmod_name; |
3353 | 3383 | ||
3354 | return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, | 3384 | return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, |
@@ -3487,8 +3517,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3487 | if (ihlen < sizeof(_iph)) | 3517 | if (ihlen < sizeof(_iph)) |
3488 | goto out; | 3518 | goto out; |
3489 | 3519 | ||
3490 | ad->u.net.v4info.saddr = ih->saddr; | 3520 | ad->u.net->v4info.saddr = ih->saddr; |
3491 | ad->u.net.v4info.daddr = ih->daddr; | 3521 | ad->u.net->v4info.daddr = ih->daddr; |
3492 | ret = 0; | 3522 | ret = 0; |
3493 | 3523 | ||
3494 | if (proto) | 3524 | if (proto) |
@@ -3506,8 +3536,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3506 | if (th == NULL) | 3536 | if (th == NULL) |
3507 | break; | 3537 | break; |
3508 | 3538 | ||
3509 | ad->u.net.sport = th->source; | 3539 | ad->u.net->sport = th->source; |
3510 | ad->u.net.dport = th->dest; | 3540 | ad->u.net->dport = th->dest; |
3511 | break; | 3541 | break; |
3512 | } | 3542 | } |
3513 | 3543 | ||
@@ -3522,8 +3552,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3522 | if (uh == NULL) | 3552 | if (uh == NULL) |
3523 | break; | 3553 | break; |
3524 | 3554 | ||
3525 | ad->u.net.sport = uh->source; | 3555 | ad->u.net->sport = uh->source; |
3526 | ad->u.net.dport = uh->dest; | 3556 | ad->u.net->dport = uh->dest; |
3527 | break; | 3557 | break; |
3528 | } | 3558 | } |
3529 | 3559 | ||
@@ -3538,8 +3568,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3538 | if (dh == NULL) | 3568 | if (dh == NULL) |
3539 | break; | 3569 | break; |
3540 | 3570 | ||
3541 | ad->u.net.sport = dh->dccph_sport; | 3571 | ad->u.net->sport = dh->dccph_sport; |
3542 | ad->u.net.dport = dh->dccph_dport; | 3572 | ad->u.net->dport = dh->dccph_dport; |
3543 | break; | 3573 | break; |
3544 | } | 3574 | } |
3545 | 3575 | ||
@@ -3566,8 +3596,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3566 | if (ip6 == NULL) | 3596 | if (ip6 == NULL) |
3567 | goto out; | 3597 | goto out; |
3568 | 3598 | ||
3569 | ad->u.net.v6info.saddr = ip6->saddr; | 3599 | ad->u.net->v6info.saddr = ip6->saddr; |
3570 | ad->u.net.v6info.daddr = ip6->daddr; | 3600 | ad->u.net->v6info.daddr = ip6->daddr; |
3571 | ret = 0; | 3601 | ret = 0; |
3572 | 3602 | ||
3573 | nexthdr = ip6->nexthdr; | 3603 | nexthdr = ip6->nexthdr; |
@@ -3587,8 +3617,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3587 | if (th == NULL) | 3617 | if (th == NULL) |
3588 | break; | 3618 | break; |
3589 | 3619 | ||
3590 | ad->u.net.sport = th->source; | 3620 | ad->u.net->sport = th->source; |
3591 | ad->u.net.dport = th->dest; | 3621 | ad->u.net->dport = th->dest; |
3592 | break; | 3622 | break; |
3593 | } | 3623 | } |
3594 | 3624 | ||
@@ -3599,8 +3629,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3599 | if (uh == NULL) | 3629 | if (uh == NULL) |
3600 | break; | 3630 | break; |
3601 | 3631 | ||
3602 | ad->u.net.sport = uh->source; | 3632 | ad->u.net->sport = uh->source; |
3603 | ad->u.net.dport = uh->dest; | 3633 | ad->u.net->dport = uh->dest; |
3604 | break; | 3634 | break; |
3605 | } | 3635 | } |
3606 | 3636 | ||
@@ -3611,8 +3641,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3611 | if (dh == NULL) | 3641 | if (dh == NULL) |
3612 | break; | 3642 | break; |
3613 | 3643 | ||
3614 | ad->u.net.sport = dh->dccph_sport; | 3644 | ad->u.net->sport = dh->dccph_sport; |
3615 | ad->u.net.dport = dh->dccph_dport; | 3645 | ad->u.net->dport = dh->dccph_dport; |
3616 | break; | 3646 | break; |
3617 | } | 3647 | } |
3618 | 3648 | ||
@@ -3632,13 +3662,13 @@ static int selinux_parse_skb(struct sk_buff *skb, struct common_audit_data *ad, | |||
3632 | char *addrp; | 3662 | char *addrp; |
3633 | int ret; | 3663 | int ret; |
3634 | 3664 | ||
3635 | switch (ad->u.net.family) { | 3665 | switch (ad->u.net->family) { |
3636 | case PF_INET: | 3666 | case PF_INET: |
3637 | ret = selinux_parse_skb_ipv4(skb, ad, proto); | 3667 | ret = selinux_parse_skb_ipv4(skb, ad, proto); |
3638 | if (ret) | 3668 | if (ret) |
3639 | goto parse_error; | 3669 | goto parse_error; |
3640 | addrp = (char *)(src ? &ad->u.net.v4info.saddr : | 3670 | addrp = (char *)(src ? &ad->u.net->v4info.saddr : |
3641 | &ad->u.net.v4info.daddr); | 3671 | &ad->u.net->v4info.daddr); |
3642 | goto okay; | 3672 | goto okay; |
3643 | 3673 | ||
3644 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 3674 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -3646,8 +3676,8 @@ static int selinux_parse_skb(struct sk_buff *skb, struct common_audit_data *ad, | |||
3646 | ret = selinux_parse_skb_ipv6(skb, ad, proto); | 3676 | ret = selinux_parse_skb_ipv6(skb, ad, proto); |
3647 | if (ret) | 3677 | if (ret) |
3648 | goto parse_error; | 3678 | goto parse_error; |
3649 | addrp = (char *)(src ? &ad->u.net.v6info.saddr : | 3679 | addrp = (char *)(src ? &ad->u.net->v6info.saddr : |
3650 | &ad->u.net.v6info.daddr); | 3680 | &ad->u.net->v6info.daddr); |
3651 | goto okay; | 3681 | goto okay; |
3652 | #endif /* IPV6 */ | 3682 | #endif /* IPV6 */ |
3653 | default: | 3683 | default: |
@@ -3721,13 +3751,17 @@ static int sock_has_perm(struct task_struct *task, struct sock *sk, u32 perms) | |||
3721 | { | 3751 | { |
3722 | struct sk_security_struct *sksec = sk->sk_security; | 3752 | struct sk_security_struct *sksec = sk->sk_security; |
3723 | struct common_audit_data ad; | 3753 | struct common_audit_data ad; |
3754 | struct selinux_audit_data sad = {0,}; | ||
3755 | struct lsm_network_audit net = {0,}; | ||
3724 | u32 tsid = task_sid(task); | 3756 | u32 tsid = task_sid(task); |
3725 | 3757 | ||
3726 | if (sksec->sid == SECINITSID_KERNEL) | 3758 | if (sksec->sid == SECINITSID_KERNEL) |
3727 | return 0; | 3759 | return 0; |
3728 | 3760 | ||
3729 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3761 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3730 | ad.u.net.sk = sk; | 3762 | ad.selinux_audit_data = &sad; |
3763 | ad.u.net = &net; | ||
3764 | ad.u.net->sk = sk; | ||
3731 | 3765 | ||
3732 | return avc_has_perm(tsid, sksec->sid, sksec->sclass, perms, &ad); | 3766 | return avc_has_perm(tsid, sksec->sid, sksec->sclass, perms, &ad); |
3733 | } | 3767 | } |
@@ -3805,6 +3839,8 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3805 | char *addrp; | 3839 | char *addrp; |
3806 | struct sk_security_struct *sksec = sk->sk_security; | 3840 | struct sk_security_struct *sksec = sk->sk_security; |
3807 | struct common_audit_data ad; | 3841 | struct common_audit_data ad; |
3842 | struct selinux_audit_data sad = {0,}; | ||
3843 | struct lsm_network_audit net = {0,}; | ||
3808 | struct sockaddr_in *addr4 = NULL; | 3844 | struct sockaddr_in *addr4 = NULL; |
3809 | struct sockaddr_in6 *addr6 = NULL; | 3845 | struct sockaddr_in6 *addr6 = NULL; |
3810 | unsigned short snum; | 3846 | unsigned short snum; |
@@ -3831,8 +3867,10 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3831 | if (err) | 3867 | if (err) |
3832 | goto out; | 3868 | goto out; |
3833 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3869 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3834 | ad.u.net.sport = htons(snum); | 3870 | ad.selinux_audit_data = &sad; |
3835 | ad.u.net.family = family; | 3871 | ad.u.net = &net; |
3872 | ad.u.net->sport = htons(snum); | ||
3873 | ad.u.net->family = family; | ||
3836 | err = avc_has_perm(sksec->sid, sid, | 3874 | err = avc_has_perm(sksec->sid, sid, |
3837 | sksec->sclass, | 3875 | sksec->sclass, |
3838 | SOCKET__NAME_BIND, &ad); | 3876 | SOCKET__NAME_BIND, &ad); |
@@ -3864,13 +3902,15 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3864 | goto out; | 3902 | goto out; |
3865 | 3903 | ||
3866 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3904 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3867 | ad.u.net.sport = htons(snum); | 3905 | ad.selinux_audit_data = &sad; |
3868 | ad.u.net.family = family; | 3906 | ad.u.net = &net; |
3907 | ad.u.net->sport = htons(snum); | ||
3908 | ad.u.net->family = family; | ||
3869 | 3909 | ||
3870 | if (family == PF_INET) | 3910 | if (family == PF_INET) |
3871 | ad.u.net.v4info.saddr = addr4->sin_addr.s_addr; | 3911 | ad.u.net->v4info.saddr = addr4->sin_addr.s_addr; |
3872 | else | 3912 | else |
3873 | ad.u.net.v6info.saddr = addr6->sin6_addr; | 3913 | ad.u.net->v6info.saddr = addr6->sin6_addr; |
3874 | 3914 | ||
3875 | err = avc_has_perm(sksec->sid, sid, | 3915 | err = avc_has_perm(sksec->sid, sid, |
3876 | sksec->sclass, node_perm, &ad); | 3916 | sksec->sclass, node_perm, &ad); |
@@ -3897,6 +3937,8 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address, | |||
3897 | if (sksec->sclass == SECCLASS_TCP_SOCKET || | 3937 | if (sksec->sclass == SECCLASS_TCP_SOCKET || |
3898 | sksec->sclass == SECCLASS_DCCP_SOCKET) { | 3938 | sksec->sclass == SECCLASS_DCCP_SOCKET) { |
3899 | struct common_audit_data ad; | 3939 | struct common_audit_data ad; |
3940 | struct selinux_audit_data sad = {0,}; | ||
3941 | struct lsm_network_audit net = {0,}; | ||
3900 | struct sockaddr_in *addr4 = NULL; | 3942 | struct sockaddr_in *addr4 = NULL; |
3901 | struct sockaddr_in6 *addr6 = NULL; | 3943 | struct sockaddr_in6 *addr6 = NULL; |
3902 | unsigned short snum; | 3944 | unsigned short snum; |
@@ -3922,8 +3964,10 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address, | |||
3922 | TCP_SOCKET__NAME_CONNECT : DCCP_SOCKET__NAME_CONNECT; | 3964 | TCP_SOCKET__NAME_CONNECT : DCCP_SOCKET__NAME_CONNECT; |
3923 | 3965 | ||
3924 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3966 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3925 | ad.u.net.dport = htons(snum); | 3967 | ad.selinux_audit_data = &sad; |
3926 | ad.u.net.family = sk->sk_family; | 3968 | ad.u.net = &net; |
3969 | ad.u.net->dport = htons(snum); | ||
3970 | ad.u.net->family = sk->sk_family; | ||
3927 | err = avc_has_perm(sksec->sid, sid, sksec->sclass, perm, &ad); | 3971 | err = avc_has_perm(sksec->sid, sid, sksec->sclass, perm, &ad); |
3928 | if (err) | 3972 | if (err) |
3929 | goto out; | 3973 | goto out; |
@@ -4012,10 +4056,14 @@ static int selinux_socket_unix_stream_connect(struct sock *sock, | |||
4012 | struct sk_security_struct *sksec_other = other->sk_security; | 4056 | struct sk_security_struct *sksec_other = other->sk_security; |
4013 | struct sk_security_struct *sksec_new = newsk->sk_security; | 4057 | struct sk_security_struct *sksec_new = newsk->sk_security; |
4014 | struct common_audit_data ad; | 4058 | struct common_audit_data ad; |
4059 | struct selinux_audit_data sad = {0,}; | ||
4060 | struct lsm_network_audit net = {0,}; | ||
4015 | int err; | 4061 | int err; |
4016 | 4062 | ||
4017 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4063 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4018 | ad.u.net.sk = other; | 4064 | ad.selinux_audit_data = &sad; |
4065 | ad.u.net = &net; | ||
4066 | ad.u.net->sk = other; | ||
4019 | 4067 | ||
4020 | err = avc_has_perm(sksec_sock->sid, sksec_other->sid, | 4068 | err = avc_has_perm(sksec_sock->sid, sksec_other->sid, |
4021 | sksec_other->sclass, | 4069 | sksec_other->sclass, |
@@ -4042,9 +4090,13 @@ static int selinux_socket_unix_may_send(struct socket *sock, | |||
4042 | struct sk_security_struct *ssec = sock->sk->sk_security; | 4090 | struct sk_security_struct *ssec = sock->sk->sk_security; |
4043 | struct sk_security_struct *osec = other->sk->sk_security; | 4091 | struct sk_security_struct *osec = other->sk->sk_security; |
4044 | struct common_audit_data ad; | 4092 | struct common_audit_data ad; |
4093 | struct selinux_audit_data sad = {0,}; | ||
4094 | struct lsm_network_audit net = {0,}; | ||
4045 | 4095 | ||
4046 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4096 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4047 | ad.u.net.sk = other->sk; | 4097 | ad.selinux_audit_data = &sad; |
4098 | ad.u.net = &net; | ||
4099 | ad.u.net->sk = other->sk; | ||
4048 | 4100 | ||
4049 | return avc_has_perm(ssec->sid, osec->sid, osec->sclass, SOCKET__SENDTO, | 4101 | return avc_has_perm(ssec->sid, osec->sid, osec->sclass, SOCKET__SENDTO, |
4050 | &ad); | 4102 | &ad); |
@@ -4080,11 +4132,15 @@ static int selinux_sock_rcv_skb_compat(struct sock *sk, struct sk_buff *skb, | |||
4080 | struct sk_security_struct *sksec = sk->sk_security; | 4132 | struct sk_security_struct *sksec = sk->sk_security; |
4081 | u32 sk_sid = sksec->sid; | 4133 | u32 sk_sid = sksec->sid; |
4082 | struct common_audit_data ad; | 4134 | struct common_audit_data ad; |
4135 | struct selinux_audit_data sad = {0,}; | ||
4136 | struct lsm_network_audit net = {0,}; | ||
4083 | char *addrp; | 4137 | char *addrp; |
4084 | 4138 | ||
4085 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4139 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4086 | ad.u.net.netif = skb->skb_iif; | 4140 | ad.selinux_audit_data = &sad; |
4087 | ad.u.net.family = family; | 4141 | ad.u.net = &net; |
4142 | ad.u.net->netif = skb->skb_iif; | ||
4143 | ad.u.net->family = family; | ||
4088 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); | 4144 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); |
4089 | if (err) | 4145 | if (err) |
4090 | return err; | 4146 | return err; |
@@ -4111,6 +4167,8 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
4111 | u16 family = sk->sk_family; | 4167 | u16 family = sk->sk_family; |
4112 | u32 sk_sid = sksec->sid; | 4168 | u32 sk_sid = sksec->sid; |
4113 | struct common_audit_data ad; | 4169 | struct common_audit_data ad; |
4170 | struct selinux_audit_data sad = {0,}; | ||
4171 | struct lsm_network_audit net = {0,}; | ||
4114 | char *addrp; | 4172 | char *addrp; |
4115 | u8 secmark_active; | 4173 | u8 secmark_active; |
4116 | u8 peerlbl_active; | 4174 | u8 peerlbl_active; |
@@ -4135,8 +4193,10 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
4135 | return 0; | 4193 | return 0; |
4136 | 4194 | ||
4137 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4195 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4138 | ad.u.net.netif = skb->skb_iif; | 4196 | ad.selinux_audit_data = &sad; |
4139 | ad.u.net.family = family; | 4197 | ad.u.net = &net; |
4198 | ad.u.net->netif = skb->skb_iif; | ||
4199 | ad.u.net->family = family; | ||
4140 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); | 4200 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); |
4141 | if (err) | 4201 | if (err) |
4142 | return err; | 4202 | return err; |
@@ -4471,6 +4531,8 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex, | |||
4471 | char *addrp; | 4531 | char *addrp; |
4472 | u32 peer_sid; | 4532 | u32 peer_sid; |
4473 | struct common_audit_data ad; | 4533 | struct common_audit_data ad; |
4534 | struct selinux_audit_data sad = {0,}; | ||
4535 | struct lsm_network_audit net = {0,}; | ||
4474 | u8 secmark_active; | 4536 | u8 secmark_active; |
4475 | u8 netlbl_active; | 4537 | u8 netlbl_active; |
4476 | u8 peerlbl_active; | 4538 | u8 peerlbl_active; |
@@ -4488,8 +4550,10 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex, | |||
4488 | return NF_DROP; | 4550 | return NF_DROP; |
4489 | 4551 | ||
4490 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4552 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4491 | ad.u.net.netif = ifindex; | 4553 | ad.selinux_audit_data = &sad; |
4492 | ad.u.net.family = family; | 4554 | ad.u.net = &net; |
4555 | ad.u.net->netif = ifindex; | ||
4556 | ad.u.net->family = family; | ||
4493 | if (selinux_parse_skb(skb, &ad, &addrp, 1, NULL) != 0) | 4557 | if (selinux_parse_skb(skb, &ad, &addrp, 1, NULL) != 0) |
4494 | return NF_DROP; | 4558 | return NF_DROP; |
4495 | 4559 | ||
@@ -4576,6 +4640,8 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, | |||
4576 | struct sock *sk = skb->sk; | 4640 | struct sock *sk = skb->sk; |
4577 | struct sk_security_struct *sksec; | 4641 | struct sk_security_struct *sksec; |
4578 | struct common_audit_data ad; | 4642 | struct common_audit_data ad; |
4643 | struct selinux_audit_data sad = {0,}; | ||
4644 | struct lsm_network_audit net = {0,}; | ||
4579 | char *addrp; | 4645 | char *addrp; |
4580 | u8 proto; | 4646 | u8 proto; |
4581 | 4647 | ||
@@ -4584,8 +4650,10 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, | |||
4584 | sksec = sk->sk_security; | 4650 | sksec = sk->sk_security; |
4585 | 4651 | ||
4586 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4652 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4587 | ad.u.net.netif = ifindex; | 4653 | ad.selinux_audit_data = &sad; |
4588 | ad.u.net.family = family; | 4654 | ad.u.net = &net; |
4655 | ad.u.net->netif = ifindex; | ||
4656 | ad.u.net->family = family; | ||
4589 | if (selinux_parse_skb(skb, &ad, &addrp, 0, &proto)) | 4657 | if (selinux_parse_skb(skb, &ad, &addrp, 0, &proto)) |
4590 | return NF_DROP; | 4658 | return NF_DROP; |
4591 | 4659 | ||
@@ -4607,6 +4675,8 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4607 | u32 peer_sid; | 4675 | u32 peer_sid; |
4608 | struct sock *sk; | 4676 | struct sock *sk; |
4609 | struct common_audit_data ad; | 4677 | struct common_audit_data ad; |
4678 | struct selinux_audit_data sad = {0,}; | ||
4679 | struct lsm_network_audit net = {0,}; | ||
4610 | char *addrp; | 4680 | char *addrp; |
4611 | u8 secmark_active; | 4681 | u8 secmark_active; |
4612 | u8 peerlbl_active; | 4682 | u8 peerlbl_active; |
@@ -4653,8 +4723,10 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4653 | } | 4723 | } |
4654 | 4724 | ||
4655 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4725 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4656 | ad.u.net.netif = ifindex; | 4726 | ad.selinux_audit_data = &sad; |
4657 | ad.u.net.family = family; | 4727 | ad.u.net = &net; |
4728 | ad.u.net->netif = ifindex; | ||
4729 | ad.u.net->family = family; | ||
4658 | if (selinux_parse_skb(skb, &ad, &addrp, 0, NULL)) | 4730 | if (selinux_parse_skb(skb, &ad, &addrp, 0, NULL)) |
4659 | return NF_DROP; | 4731 | return NF_DROP; |
4660 | 4732 | ||
@@ -4769,11 +4841,13 @@ static int ipc_has_perm(struct kern_ipc_perm *ipc_perms, | |||
4769 | { | 4841 | { |
4770 | struct ipc_security_struct *isec; | 4842 | struct ipc_security_struct *isec; |
4771 | struct common_audit_data ad; | 4843 | struct common_audit_data ad; |
4844 | struct selinux_audit_data sad = {0,}; | ||
4772 | u32 sid = current_sid(); | 4845 | u32 sid = current_sid(); |
4773 | 4846 | ||
4774 | isec = ipc_perms->security; | 4847 | isec = ipc_perms->security; |
4775 | 4848 | ||
4776 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4849 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4850 | ad.selinux_audit_data = &sad; | ||
4777 | ad.u.ipc_id = ipc_perms->key; | 4851 | ad.u.ipc_id = ipc_perms->key; |
4778 | 4852 | ||
4779 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, &ad); | 4853 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, &ad); |
@@ -4794,6 +4868,7 @@ static int selinux_msg_queue_alloc_security(struct msg_queue *msq) | |||
4794 | { | 4868 | { |
4795 | struct ipc_security_struct *isec; | 4869 | struct ipc_security_struct *isec; |
4796 | struct common_audit_data ad; | 4870 | struct common_audit_data ad; |
4871 | struct selinux_audit_data sad = {0,}; | ||
4797 | u32 sid = current_sid(); | 4872 | u32 sid = current_sid(); |
4798 | int rc; | 4873 | int rc; |
4799 | 4874 | ||
@@ -4804,6 +4879,7 @@ static int selinux_msg_queue_alloc_security(struct msg_queue *msq) | |||
4804 | isec = msq->q_perm.security; | 4879 | isec = msq->q_perm.security; |
4805 | 4880 | ||
4806 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4881 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4882 | ad.selinux_audit_data = &sad; | ||
4807 | ad.u.ipc_id = msq->q_perm.key; | 4883 | ad.u.ipc_id = msq->q_perm.key; |
4808 | 4884 | ||
4809 | rc = avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, | 4885 | rc = avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, |
@@ -4824,11 +4900,13 @@ static int selinux_msg_queue_associate(struct msg_queue *msq, int msqflg) | |||
4824 | { | 4900 | { |
4825 | struct ipc_security_struct *isec; | 4901 | struct ipc_security_struct *isec; |
4826 | struct common_audit_data ad; | 4902 | struct common_audit_data ad; |
4903 | struct selinux_audit_data sad = {0,}; | ||
4827 | u32 sid = current_sid(); | 4904 | u32 sid = current_sid(); |
4828 | 4905 | ||
4829 | isec = msq->q_perm.security; | 4906 | isec = msq->q_perm.security; |
4830 | 4907 | ||
4831 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4908 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4909 | ad.selinux_audit_data = &sad; | ||
4832 | ad.u.ipc_id = msq->q_perm.key; | 4910 | ad.u.ipc_id = msq->q_perm.key; |
4833 | 4911 | ||
4834 | return avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, | 4912 | return avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, |
@@ -4868,6 +4946,7 @@ static int selinux_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg, | |||
4868 | struct ipc_security_struct *isec; | 4946 | struct ipc_security_struct *isec; |
4869 | struct msg_security_struct *msec; | 4947 | struct msg_security_struct *msec; |
4870 | struct common_audit_data ad; | 4948 | struct common_audit_data ad; |
4949 | struct selinux_audit_data sad = {0,}; | ||
4871 | u32 sid = current_sid(); | 4950 | u32 sid = current_sid(); |
4872 | int rc; | 4951 | int rc; |
4873 | 4952 | ||
@@ -4889,6 +4968,7 @@ static int selinux_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg, | |||
4889 | } | 4968 | } |
4890 | 4969 | ||
4891 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4970 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4971 | ad.selinux_audit_data = &sad; | ||
4892 | ad.u.ipc_id = msq->q_perm.key; | 4972 | ad.u.ipc_id = msq->q_perm.key; |
4893 | 4973 | ||
4894 | /* Can this process write to the queue? */ | 4974 | /* Can this process write to the queue? */ |
@@ -4913,6 +4993,7 @@ static int selinux_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, | |||
4913 | struct ipc_security_struct *isec; | 4993 | struct ipc_security_struct *isec; |
4914 | struct msg_security_struct *msec; | 4994 | struct msg_security_struct *msec; |
4915 | struct common_audit_data ad; | 4995 | struct common_audit_data ad; |
4996 | struct selinux_audit_data sad = {0,}; | ||
4916 | u32 sid = task_sid(target); | 4997 | u32 sid = task_sid(target); |
4917 | int rc; | 4998 | int rc; |
4918 | 4999 | ||
@@ -4920,6 +5001,7 @@ static int selinux_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, | |||
4920 | msec = msg->security; | 5001 | msec = msg->security; |
4921 | 5002 | ||
4922 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5003 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5004 | ad.selinux_audit_data = &sad; | ||
4923 | ad.u.ipc_id = msq->q_perm.key; | 5005 | ad.u.ipc_id = msq->q_perm.key; |
4924 | 5006 | ||
4925 | rc = avc_has_perm(sid, isec->sid, | 5007 | rc = avc_has_perm(sid, isec->sid, |
@@ -4935,6 +5017,7 @@ static int selinux_shm_alloc_security(struct shmid_kernel *shp) | |||
4935 | { | 5017 | { |
4936 | struct ipc_security_struct *isec; | 5018 | struct ipc_security_struct *isec; |
4937 | struct common_audit_data ad; | 5019 | struct common_audit_data ad; |
5020 | struct selinux_audit_data sad = {0,}; | ||
4938 | u32 sid = current_sid(); | 5021 | u32 sid = current_sid(); |
4939 | int rc; | 5022 | int rc; |
4940 | 5023 | ||
@@ -4945,6 +5028,7 @@ static int selinux_shm_alloc_security(struct shmid_kernel *shp) | |||
4945 | isec = shp->shm_perm.security; | 5028 | isec = shp->shm_perm.security; |
4946 | 5029 | ||
4947 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5030 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5031 | ad.selinux_audit_data = &sad; | ||
4948 | ad.u.ipc_id = shp->shm_perm.key; | 5032 | ad.u.ipc_id = shp->shm_perm.key; |
4949 | 5033 | ||
4950 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SHM, | 5034 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SHM, |
@@ -4965,11 +5049,13 @@ static int selinux_shm_associate(struct shmid_kernel *shp, int shmflg) | |||
4965 | { | 5049 | { |
4966 | struct ipc_security_struct *isec; | 5050 | struct ipc_security_struct *isec; |
4967 | struct common_audit_data ad; | 5051 | struct common_audit_data ad; |
5052 | struct selinux_audit_data sad = {0,}; | ||
4968 | u32 sid = current_sid(); | 5053 | u32 sid = current_sid(); |
4969 | 5054 | ||
4970 | isec = shp->shm_perm.security; | 5055 | isec = shp->shm_perm.security; |
4971 | 5056 | ||
4972 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5057 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5058 | ad.selinux_audit_data = &sad; | ||
4973 | ad.u.ipc_id = shp->shm_perm.key; | 5059 | ad.u.ipc_id = shp->shm_perm.key; |
4974 | 5060 | ||
4975 | return avc_has_perm(sid, isec->sid, SECCLASS_SHM, | 5061 | return avc_has_perm(sid, isec->sid, SECCLASS_SHM, |
@@ -5027,6 +5113,7 @@ static int selinux_sem_alloc_security(struct sem_array *sma) | |||
5027 | { | 5113 | { |
5028 | struct ipc_security_struct *isec; | 5114 | struct ipc_security_struct *isec; |
5029 | struct common_audit_data ad; | 5115 | struct common_audit_data ad; |
5116 | struct selinux_audit_data sad = {0,}; | ||
5030 | u32 sid = current_sid(); | 5117 | u32 sid = current_sid(); |
5031 | int rc; | 5118 | int rc; |
5032 | 5119 | ||
@@ -5037,6 +5124,7 @@ static int selinux_sem_alloc_security(struct sem_array *sma) | |||
5037 | isec = sma->sem_perm.security; | 5124 | isec = sma->sem_perm.security; |
5038 | 5125 | ||
5039 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5126 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5127 | ad.selinux_audit_data = &sad; | ||
5040 | ad.u.ipc_id = sma->sem_perm.key; | 5128 | ad.u.ipc_id = sma->sem_perm.key; |
5041 | 5129 | ||
5042 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SEM, | 5130 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SEM, |
@@ -5057,11 +5145,13 @@ static int selinux_sem_associate(struct sem_array *sma, int semflg) | |||
5057 | { | 5145 | { |
5058 | struct ipc_security_struct *isec; | 5146 | struct ipc_security_struct *isec; |
5059 | struct common_audit_data ad; | 5147 | struct common_audit_data ad; |
5148 | struct selinux_audit_data sad = {0,}; | ||
5060 | u32 sid = current_sid(); | 5149 | u32 sid = current_sid(); |
5061 | 5150 | ||
5062 | isec = sma->sem_perm.security; | 5151 | isec = sma->sem_perm.security; |
5063 | 5152 | ||
5064 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5153 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5154 | ad.selinux_audit_data = &sad; | ||
5065 | ad.u.ipc_id = sma->sem_perm.key; | 5155 | ad.u.ipc_id = sma->sem_perm.key; |
5066 | 5156 | ||
5067 | return avc_has_perm(sid, isec->sid, SECCLASS_SEM, | 5157 | return avc_has_perm(sid, isec->sid, SECCLASS_SEM, |