diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/hooks.c | 24 | ||||
-rw-r--r-- | security/selinux/include/av_perm_to_string.h | 2 | ||||
-rw-r--r-- | security/selinux/include/av_permissions.h | 2 | ||||
-rw-r--r-- | security/selinux/nlmsgtab.c | 13 |
4 files changed, 19 insertions, 22 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 2ae7d3cb8df4..aae1e794fe48 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2855,8 +2855,7 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, struct avc_audit_data *ad | |||
2855 | 2855 | ||
2856 | nexthdr = ip6->nexthdr; | 2856 | nexthdr = ip6->nexthdr; |
2857 | offset += sizeof(_ipv6h); | 2857 | offset += sizeof(_ipv6h); |
2858 | offset = ipv6_skip_exthdr(skb, offset, &nexthdr, | 2858 | offset = ipv6_skip_exthdr(skb, offset, &nexthdr); |
2859 | skb->tail - skb->head - offset); | ||
2860 | if (offset < 0) | 2859 | if (offset < 0) |
2861 | goto out; | 2860 | goto out; |
2862 | 2861 | ||
@@ -3668,7 +3667,7 @@ static void msg_msg_free_security(struct msg_msg *msg) | |||
3668 | } | 3667 | } |
3669 | 3668 | ||
3670 | static int ipc_has_perm(struct kern_ipc_perm *ipc_perms, | 3669 | static int ipc_has_perm(struct kern_ipc_perm *ipc_perms, |
3671 | u16 sclass, u32 perms) | 3670 | u32 perms) |
3672 | { | 3671 | { |
3673 | struct task_security_struct *tsec; | 3672 | struct task_security_struct *tsec; |
3674 | struct ipc_security_struct *isec; | 3673 | struct ipc_security_struct *isec; |
@@ -3680,7 +3679,7 @@ static int ipc_has_perm(struct kern_ipc_perm *ipc_perms, | |||
3680 | AVC_AUDIT_DATA_INIT(&ad, IPC); | 3679 | AVC_AUDIT_DATA_INIT(&ad, IPC); |
3681 | ad.u.ipc_id = ipc_perms->key; | 3680 | ad.u.ipc_id = ipc_perms->key; |
3682 | 3681 | ||
3683 | return avc_has_perm(tsec->sid, isec->sid, sclass, perms, &ad); | 3682 | return avc_has_perm(tsec->sid, isec->sid, isec->sclass, perms, &ad); |
3684 | } | 3683 | } |
3685 | 3684 | ||
3686 | static int selinux_msg_msg_alloc_security(struct msg_msg *msg) | 3685 | static int selinux_msg_msg_alloc_security(struct msg_msg *msg) |
@@ -3765,7 +3764,7 @@ static int selinux_msg_queue_msgctl(struct msg_queue *msq, int cmd) | |||
3765 | return 0; | 3764 | return 0; |
3766 | } | 3765 | } |
3767 | 3766 | ||
3768 | err = ipc_has_perm(&msq->q_perm, SECCLASS_MSGQ, perms); | 3767 | err = ipc_has_perm(&msq->q_perm, perms); |
3769 | return err; | 3768 | return err; |
3770 | } | 3769 | } |
3771 | 3770 | ||
@@ -3917,7 +3916,7 @@ static int selinux_shm_shmctl(struct shmid_kernel *shp, int cmd) | |||
3917 | return 0; | 3916 | return 0; |
3918 | } | 3917 | } |
3919 | 3918 | ||
3920 | err = ipc_has_perm(&shp->shm_perm, SECCLASS_SHM, perms); | 3919 | err = ipc_has_perm(&shp->shm_perm, perms); |
3921 | return err; | 3920 | return err; |
3922 | } | 3921 | } |
3923 | 3922 | ||
@@ -3936,7 +3935,7 @@ static int selinux_shm_shmat(struct shmid_kernel *shp, | |||
3936 | else | 3935 | else |
3937 | perms = SHM__READ | SHM__WRITE; | 3936 | perms = SHM__READ | SHM__WRITE; |
3938 | 3937 | ||
3939 | return ipc_has_perm(&shp->shm_perm, SECCLASS_SHM, perms); | 3938 | return ipc_has_perm(&shp->shm_perm, perms); |
3940 | } | 3939 | } |
3941 | 3940 | ||
3942 | /* Semaphore security operations */ | 3941 | /* Semaphore security operations */ |
@@ -4025,7 +4024,7 @@ static int selinux_sem_semctl(struct sem_array *sma, int cmd) | |||
4025 | return 0; | 4024 | return 0; |
4026 | } | 4025 | } |
4027 | 4026 | ||
4028 | err = ipc_has_perm(&sma->sem_perm, SECCLASS_SEM, perms); | 4027 | err = ipc_has_perm(&sma->sem_perm, perms); |
4029 | return err; | 4028 | return err; |
4030 | } | 4029 | } |
4031 | 4030 | ||
@@ -4039,18 +4038,13 @@ static int selinux_sem_semop(struct sem_array *sma, | |||
4039 | else | 4038 | else |
4040 | perms = SEM__READ; | 4039 | perms = SEM__READ; |
4041 | 4040 | ||
4042 | return ipc_has_perm(&sma->sem_perm, SECCLASS_SEM, perms); | 4041 | return ipc_has_perm(&sma->sem_perm, perms); |
4043 | } | 4042 | } |
4044 | 4043 | ||
4045 | static int selinux_ipc_permission(struct kern_ipc_perm *ipcp, short flag) | 4044 | static int selinux_ipc_permission(struct kern_ipc_perm *ipcp, short flag) |
4046 | { | 4045 | { |
4047 | struct ipc_security_struct *isec = ipcp->security; | ||
4048 | u16 sclass = SECCLASS_IPC; | ||
4049 | u32 av = 0; | 4046 | u32 av = 0; |
4050 | 4047 | ||
4051 | if (isec && isec->magic == SELINUX_MAGIC) | ||
4052 | sclass = isec->sclass; | ||
4053 | |||
4054 | av = 0; | 4048 | av = 0; |
4055 | if (flag & S_IRUGO) | 4049 | if (flag & S_IRUGO) |
4056 | av |= IPC__UNIX_READ; | 4050 | av |= IPC__UNIX_READ; |
@@ -4060,7 +4054,7 @@ static int selinux_ipc_permission(struct kern_ipc_perm *ipcp, short flag) | |||
4060 | if (av == 0) | 4054 | if (av == 0) |
4061 | return 0; | 4055 | return 0; |
4062 | 4056 | ||
4063 | return ipc_has_perm(ipcp, sclass, av); | 4057 | return ipc_has_perm(ipcp, av); |
4064 | } | 4058 | } |
4065 | 4059 | ||
4066 | /* module stacking operations */ | 4060 | /* module stacking operations */ |
diff --git a/security/selinux/include/av_perm_to_string.h b/security/selinux/include/av_perm_to_string.h index eb340b45bc6f..8928bb4d3c53 100644 --- a/security/selinux/include/av_perm_to_string.h +++ b/security/selinux/include/av_perm_to_string.h | |||
@@ -220,6 +220,8 @@ | |||
220 | S_(SECCLASS_NETLINK_XFRM_SOCKET, NETLINK_XFRM_SOCKET__NLMSG_WRITE, "nlmsg_write") | 220 | S_(SECCLASS_NETLINK_XFRM_SOCKET, NETLINK_XFRM_SOCKET__NLMSG_WRITE, "nlmsg_write") |
221 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_READ, "nlmsg_read") | 221 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_READ, "nlmsg_read") |
222 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE, "nlmsg_write") | 222 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE, "nlmsg_write") |
223 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_RELAY, "nlmsg_relay") | ||
224 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_READPRIV, "nlmsg_readpriv") | ||
223 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_READ, "nlmsg_read") | 225 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_READ, "nlmsg_read") |
224 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_WRITE, "nlmsg_write") | 226 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_WRITE, "nlmsg_write") |
225 | S_(SECCLASS_DBUS, DBUS__ACQUIRE_SVC, "acquire_svc") | 227 | S_(SECCLASS_DBUS, DBUS__ACQUIRE_SVC, "acquire_svc") |
diff --git a/security/selinux/include/av_permissions.h b/security/selinux/include/av_permissions.h index f9de0f966559..bdfce4ca8f8e 100644 --- a/security/selinux/include/av_permissions.h +++ b/security/selinux/include/av_permissions.h | |||
@@ -840,6 +840,8 @@ | |||
840 | 840 | ||
841 | #define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL | 841 | #define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL |
842 | #define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL | 842 | #define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL |
843 | #define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL | ||
844 | #define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL | ||
843 | 845 | ||
844 | #define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL | 846 | #define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL |
845 | #define NETLINK_IP6FW_SOCKET__READ 0x00000002UL | 847 | #define NETLINK_IP6FW_SOCKET__READ 0x00000002UL |
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index f79408252730..b3adb481bc25 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
@@ -91,13 +91,12 @@ static struct nlmsg_perm nlmsg_xfrm_perms[] = | |||
91 | 91 | ||
92 | static struct nlmsg_perm nlmsg_audit_perms[] = | 92 | static struct nlmsg_perm nlmsg_audit_perms[] = |
93 | { | 93 | { |
94 | { AUDIT_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ }, | 94 | { AUDIT_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ }, |
95 | { AUDIT_SET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | 95 | { AUDIT_SET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, |
96 | { AUDIT_LIST, NETLINK_AUDIT_SOCKET__NLMSG_READ }, | 96 | { AUDIT_LIST, NETLINK_AUDIT_SOCKET__NLMSG_READPRIV }, |
97 | { AUDIT_ADD, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | 97 | { AUDIT_ADD, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, |
98 | { AUDIT_DEL, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | 98 | { AUDIT_DEL, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, |
99 | { AUDIT_USER, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | 99 | { AUDIT_USER, NETLINK_AUDIT_SOCKET__NLMSG_RELAY }, |
100 | { AUDIT_LOGIN, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | ||
101 | }; | 100 | }; |
102 | 101 | ||
103 | 102 | ||