selinux: Null-out secmark after use - V.02
PATCH 1/1 selinux: Null-out secmark after use - V.02
This nulls out the secmark field on the skb after we are done with ALL the access checks in the postroute_last hook to handle the case where multicast packets that we send might be arriving back to us on a non-loopback device. This would cause the flow_in hook to use the secmark on the skb (ostensibly from the originating socket) as a security point context, which it isn't.
---
Right sign-off this time :)
security/selinux/hooks.c +16 -0
@@ -3903,6 +3903,22 @@ static unsigned int selinux_ip_postroute } err =avc_has_perm (skb->secmark,SECINITSID_NETMSG ,SECCLASS_PACKET ,PACKET__FLOW_OUT , &ad); + +if (skb->secmark && skb->dev != &loopback_dev) +/* +* Our multicast packets could get copied back +* to us, arriving on a non-loopback device. +* Leaving the secmark intact here will cause it +* to be used as a security point context in +* the flow_in hook above while it's not in fact +* a security point context. +* +* We may be able to retain this marking if +* we can reliably determine that it was a local +* packet although it arrived on a non-loopback +* device, in the flow_in hook above. +*/ + skb->secmark =SECSID_NULL ; } out:return err ?NF_DROP :NF_ACCEPT ;
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 1 line · Venkat Yekkirala
This nulls out the secmark field on the skb after
This doesn't apply to an upstream tree.
Please indicate which tree it is for and also whether you want it applied or reviewed.
- James
Signature · 7 lines
James Morris <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.