alistair23-linux/net
James Morris 134b0fc544 IPsec: propagate security module errors up from flow_cache_lookup
When a security module is loaded (in this case, SELinux), the
security_xfrm_policy_lookup() hook can return an access denied permission
(or other error).  We were not handling that correctly, and in fact
inverting the return logic and propagating a false "ok" back up to
xfrm_lookup(), which then allowed packets to pass as if they were not
associated with an xfrm policy.

The way I was seeing the problem was when connecting via IPsec to a
confined service on an SELinux box (vsftpd), which did not have the
appropriate SELinux policy permissions to send packets via IPsec.

The first SYNACK would be blocked, because of an uncached lookup via
flow_cache_lookup(), which would fail to resolve an xfrm policy because
the SELinux policy is checked at that point via the resolver.

However, retransmitted SYNACKs would then find a cached flow entry when
calling into flow_cache_lookup() with a null xfrm policy, which is
interpreted by xfrm_lookup() as the packet not having any associated
policy and similarly to the first case, allowing it to pass without
transformation.

The solution presented here is to first ensure that errno values are
correctly propagated all the way back up through the various call chains
from security_xfrm_policy_lookup(), and handled correctly.

Then, flow_cache_lookup() is modified, so that if the policy resolver
fails (typically a permission denied via the security module), the flow
cache entry is killed rather than having a null policy assigned (which
indicates that the packet can pass freely).  This also forces any future
lookups for the same flow to consult the security module (e.g. SELinux)
for current security policy (rather than, say, caching the error on the
flow cache entry).

Signed-off-by: James Morris <jmorris@namei.org>
2006-10-11 23:59:34 -07:00
..
802 [TR]: endiannness annotations 2006-09-28 17:53:59 -07:00
8021q [PATCH] Finish annotations of struct vlan_ethhdr 2006-10-10 16:15:34 -07:00
appletalk [ATALK]: endianness annotations 2006-09-28 17:53:58 -07:00
atm Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
ax25 [NET]: Conversions from kmalloc+memset to k(z|c)alloc. 2006-07-21 14:51:30 -07:00
bluetooth [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
bridge [NETFILTER]: ebt_mark: add or/and/xor action support to mark target 2006-10-04 00:30:57 -07:00
core IPsec: propagate security module errors up from flow_cache_lookup 2006-10-11 23:59:34 -07:00
dccp [IPV4]: ip_route_connect() ipv4 address arguments annotated 2006-09-28 17:54:06 -07:00
decnet [NET]: Fix sk->sk_filter field access 2006-09-22 15:18:47 -07:00
econet [NET]: Conversions from kmalloc+memset to k(z|c)alloc. 2006-07-21 14:51:30 -07:00
ethernet [NET]: Annotate dst_ops protocol 2006-09-28 18:02:58 -07:00
ieee80211 [PATCH] bcm43xx: WE-21 support 2006-09-25 16:52:16 -04:00
ipv4 NetLabel: fix a cache race condition 2006-10-11 23:59:29 -07:00
ipv6 Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/configh 2006-10-04 09:59:57 -07:00
ipx [IPX]: Fix typo, ipxhdr() --> ipx_hdr() 2006-08-09 17:36:15 -07:00
irda [PATCH] strndup() would better take size_t, not int 2006-10-10 15:37:24 -07:00
key [XFRM]: ports in struct xfrm_selector annotated 2006-09-28 18:02:33 -07:00
lapb [LAPB]: Fix windowsize check 2006-08-05 21:15:58 -07:00
llc [LLC]: multicast receive device match 2006-08-13 18:56:26 -07:00
netfilter [NETFILTER]: Kconfig: fix xt_physdev dependencies 2006-10-04 00:30:53 -07:00
netlabel NetLabel: fix a cache race condition 2006-10-11 23:59:29 -07:00
netlink [GENL]: Provide more information to userspace about registered genl families 2006-09-22 15:18:51 -07:00
netrom [NETROM] lockdep: fix false positive 2006-07-12 13:59:02 -07:00
packet [NET]: Fix sk->sk_filter field access 2006-09-22 15:18:47 -07:00
rose [ROSE] lockdep: fix false positive 2006-07-12 13:58:59 -07:00
rxrpc [PATCH] kmemdup: some users 2006-10-01 00:39:19 -07:00
sched [NET_SCHED]: Remove old estimator implementation 2006-10-04 00:31:07 -07:00
sctp [SCTP]: Do not timestamp every SCTP packet. 2006-09-29 17:10:03 -07:00
sunrpc [PATCH] net/sunrpc/auth_gss/svcauth_gss.c endianness regression 2006-10-10 15:37:24 -07:00
tipc [PATCH] tipc __user annotations 2006-10-10 15:37:21 -07:00
unix [AF_UNIX]: Change max_dgram_qlen sysctl to __read_mostly 2006-09-22 15:18:42 -07:00
wanrouter [NET]: Conversions from kmalloc+memset to k(z|c)alloc. 2006-07-21 14:51:30 -07:00
x25 Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
xfrm IPsec: propagate security module errors up from flow_cache_lookup 2006-10-11 23:59:34 -07:00
compat.c
Kconfig [NET] Kconfig: fix cut/paste error in TCPPROBE 2006-09-28 17:53:57 -07:00
Makefile [NetLabel]: core NetLabel subsystem 2006-09-22 14:53:34 -07:00
nonet.c
socket.c [PATCH] file: modify struct fown_struct to use a struct pid 2006-10-02 07:57:14 -07:00
sysctl_net.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
TUNABLE