Skip to content
Commit cf379667 authored by Florian Westphal's avatar Florian Westphal Committed by Steffen Klassert
Browse files

xfrm: do unconditional template resolution before pcpu cache check



Stephen Smalley says:
 Since 4.14-rc1, the selinux-testsuite has been encountering sporadic
 failures during testing of labeled IPSEC. git bisect pointed to
 commit ec30d ("xfrm: add xdst pcpu cache").
 The xdst pcpu cache is only checking that the policies are the same,
 but does not validate that the policy, state, and flow match with respect
 to security context labeling.
 As a result, the wrong SA could be used and the receiver could end up
 performing permission checking and providing SO_PEERSEC or SCM_SECURITY
 values for the wrong security context.

This fix makes it so that we always do the template resolution, and
then checks that the found states match those in the pcpu bundle.

This has the disadvantage of doing a bit more work (lookup in state hash
table) if we can reuse the xdst entry (we only avoid xdst alloc/free)
but we don't add a lot of extra work in case we can't reuse.

xfrm_pol_dead() check is removed, reasoning is that
xfrm_tmpl_resolve does all needed checks.

Cc: Paul Moore <paul@paul-moore.com>
Fixes: ec30d78c ("xfrm: add xdst pcpu cache")
Reported-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Tested-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Acked-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent cb79a180
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment