diff options
author | Paul Moore <pmoore@redhat.com> | 2014-01-23 15:52:06 -0500 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2014-01-23 15:52:06 -0500 |
commit | 41be702a542a0d14bb0b1c16e824fa9ed27616ec (patch) | |
tree | e48942a05882da47544e179c6a0c920e00137a6a /security/selinux | |
parent | 8ed814602876bec9bad2649ca17f34b499357a1c (diff) | |
parent | d8ec26d7f8287f5788a494f56e8814210f0e64be (diff) |
Merge tag 'v3.13' into next
Linux 3.13
Minor fixup needed in selinux_inet_conn_request()
Conflicts:
security/selinux/hooks.c
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/hooks.c | 32 | ||||
-rw-r--r-- | security/selinux/include/objsec.h | 5 | ||||
-rw-r--r-- | security/selinux/nlmsgtab.c | 2 |
3 files changed, 30 insertions, 9 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 6ace9b3abf0d..4b34847208cc 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -233,6 +233,14 @@ static int inode_alloc_security(struct inode *inode) | |||
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | 235 | ||
236 | static void inode_free_rcu(struct rcu_head *head) | ||
237 | { | ||
238 | struct inode_security_struct *isec; | ||
239 | |||
240 | isec = container_of(head, struct inode_security_struct, rcu); | ||
241 | kmem_cache_free(sel_inode_cache, isec); | ||
242 | } | ||
243 | |||
236 | static void inode_free_security(struct inode *inode) | 244 | static void inode_free_security(struct inode *inode) |
237 | { | 245 | { |
238 | struct inode_security_struct *isec = inode->i_security; | 246 | struct inode_security_struct *isec = inode->i_security; |
@@ -243,8 +251,16 @@ static void inode_free_security(struct inode *inode) | |||
243 | list_del_init(&isec->list); | 251 | list_del_init(&isec->list); |
244 | spin_unlock(&sbsec->isec_lock); | 252 | spin_unlock(&sbsec->isec_lock); |
245 | 253 | ||
246 | inode->i_security = NULL; | 254 | /* |
247 | kmem_cache_free(sel_inode_cache, isec); | 255 | * The inode may still be referenced in a path walk and |
256 | * a call to selinux_inode_permission() can be made | ||
257 | * after inode_free_security() is called. Ideally, the VFS | ||
258 | * wouldn't do this, but fixing that is a much harder | ||
259 | * job. For now, simply free the i_security via RCU, and | ||
260 | * leave the current inode->i_security pointer intact. | ||
261 | * The inode will be freed after the RCU grace period too. | ||
262 | */ | ||
263 | call_rcu(&isec->rcu, inode_free_rcu); | ||
248 | } | 264 | } |
249 | 265 | ||
250 | static int file_alloc_security(struct file *file) | 266 | static int file_alloc_security(struct file *file) |
@@ -3989,7 +4005,7 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3989 | if (snum) { | 4005 | if (snum) { |
3990 | int low, high; | 4006 | int low, high; |
3991 | 4007 | ||
3992 | inet_get_local_port_range(&low, &high); | 4008 | inet_get_local_port_range(sock_net(sk), &low, &high); |
3993 | 4009 | ||
3994 | if (snum < max(PROT_SOCK, low) || snum > high) { | 4010 | if (snum < max(PROT_SOCK, low) || snum > high) { |
3995 | err = sel_netport_sid(sk->sk_protocol, | 4011 | err = sel_netport_sid(sk->sk_protocol, |
@@ -4721,7 +4737,7 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex, | |||
4721 | return NF_ACCEPT; | 4737 | return NF_ACCEPT; |
4722 | } | 4738 | } |
4723 | 4739 | ||
4724 | static unsigned int selinux_ipv4_forward(unsigned int hooknum, | 4740 | static unsigned int selinux_ipv4_forward(const struct nf_hook_ops *ops, |
4725 | struct sk_buff *skb, | 4741 | struct sk_buff *skb, |
4726 | const struct net_device *in, | 4742 | const struct net_device *in, |
4727 | const struct net_device *out, | 4743 | const struct net_device *out, |
@@ -4731,7 +4747,7 @@ static unsigned int selinux_ipv4_forward(unsigned int hooknum, | |||
4731 | } | 4747 | } |
4732 | 4748 | ||
4733 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 4749 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
4734 | static unsigned int selinux_ipv6_forward(unsigned int hooknum, | 4750 | static unsigned int selinux_ipv6_forward(const struct nf_hook_ops *ops, |
4735 | struct sk_buff *skb, | 4751 | struct sk_buff *skb, |
4736 | const struct net_device *in, | 4752 | const struct net_device *in, |
4737 | const struct net_device *out, | 4753 | const struct net_device *out, |
@@ -4783,7 +4799,7 @@ static unsigned int selinux_ip_output(struct sk_buff *skb, | |||
4783 | return NF_ACCEPT; | 4799 | return NF_ACCEPT; |
4784 | } | 4800 | } |
4785 | 4801 | ||
4786 | static unsigned int selinux_ipv4_output(unsigned int hooknum, | 4802 | static unsigned int selinux_ipv4_output(const struct nf_hook_ops *ops, |
4787 | struct sk_buff *skb, | 4803 | struct sk_buff *skb, |
4788 | const struct net_device *in, | 4804 | const struct net_device *in, |
4789 | const struct net_device *out, | 4805 | const struct net_device *out, |
@@ -4957,7 +4973,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4957 | return NF_ACCEPT; | 4973 | return NF_ACCEPT; |
4958 | } | 4974 | } |
4959 | 4975 | ||
4960 | static unsigned int selinux_ipv4_postroute(unsigned int hooknum, | 4976 | static unsigned int selinux_ipv4_postroute(const struct nf_hook_ops *ops, |
4961 | struct sk_buff *skb, | 4977 | struct sk_buff *skb, |
4962 | const struct net_device *in, | 4978 | const struct net_device *in, |
4963 | const struct net_device *out, | 4979 | const struct net_device *out, |
@@ -4967,7 +4983,7 @@ static unsigned int selinux_ipv4_postroute(unsigned int hooknum, | |||
4967 | } | 4983 | } |
4968 | 4984 | ||
4969 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 4985 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
4970 | static unsigned int selinux_ipv6_postroute(unsigned int hooknum, | 4986 | static unsigned int selinux_ipv6_postroute(const struct nf_hook_ops *ops, |
4971 | struct sk_buff *skb, | 4987 | struct sk_buff *skb, |
4972 | const struct net_device *in, | 4988 | const struct net_device *in, |
4973 | const struct net_device *out, | 4989 | const struct net_device *out, |
diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h index b1dfe1049450..078e553f52f2 100644 --- a/security/selinux/include/objsec.h +++ b/security/selinux/include/objsec.h | |||
@@ -38,7 +38,10 @@ struct task_security_struct { | |||
38 | 38 | ||
39 | struct inode_security_struct { | 39 | struct inode_security_struct { |
40 | struct inode *inode; /* back pointer to inode object */ | 40 | struct inode *inode; /* back pointer to inode object */ |
41 | struct list_head list; /* list of inode_security_struct */ | 41 | union { |
42 | struct list_head list; /* list of inode_security_struct */ | ||
43 | struct rcu_head rcu; /* for freeing the inode_security_struct */ | ||
44 | }; | ||
42 | u32 task_sid; /* SID of creating task */ | 45 | u32 task_sid; /* SID of creating task */ |
43 | u32 sid; /* SID of this object */ | 46 | u32 sid; /* SID of this object */ |
44 | u16 sclass; /* security class of this object */ | 47 | u16 sclass; /* security class of this object */ |
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 855e464e92ef..332ac8a80cf5 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
@@ -116,6 +116,8 @@ static struct nlmsg_perm nlmsg_audit_perms[] = | |||
116 | { AUDIT_MAKE_EQUIV, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | 116 | { AUDIT_MAKE_EQUIV, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, |
117 | { AUDIT_TTY_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ }, | 117 | { AUDIT_TTY_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ }, |
118 | { AUDIT_TTY_SET, NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT }, | 118 | { AUDIT_TTY_SET, NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT }, |
119 | { AUDIT_GET_FEATURE, NETLINK_AUDIT_SOCKET__NLMSG_READ }, | ||
120 | { AUDIT_SET_FEATURE, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | ||
119 | }; | 121 | }; |
120 | 122 | ||
121 | 123 | ||