linux/net/core
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
..
datagram.c [NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE 2006-09-22 14:53:53 -07:00
dev_mcast.c [NET]: Remove unnecessary config.h includes from net/ 2006-09-22 14:54:21 -07:00
dev.c [NET_SCHED]: Fix fallout from dev->qdisc RCU change 2006-09-28 18:01:50 -07:00
dst.c [NET]: add_timer -> mod_timer() in dst_run_gc() 2006-08-09 02:25:54 -07:00
dv.c [NET]: More kzalloc conversions. 2006-04-09 22:25:48 -07:00
ethtool.c [ETHTOOL]: Remove some entries from non-root command list. 2006-09-28 18:03:12 -07:00
fib_rules.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
filter.c [NET]: Fix sk->sk_filter field access 2006-09-22 15:18:47 -07:00
flow.c IPsec: propagate security module errors up from flow_cache_lookup 2006-10-11 23:59:34 -07:00
gen_estimator.c [NET]: More kzalloc conversions. 2006-04-09 22:25:48 -07:00
gen_stats.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iovec.c [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
link_watch.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
Makefile [NET]: Protocol Independant Policy Routing Rules Framework 2006-09-22 14:53:40 -07:00
neighbour.c [NEIGH]: always use hash_mask under tbl lock 2006-10-04 00:31:01 -07:00
net-sysfs.c [PATCH] WE-21 support (core API) 2006-09-25 16:52:14 -04:00
netevent.c [NET]: Network Event Notifier Mechanism. 2006-08-02 13:38:20 -07:00
netpoll.c [NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE 2006-09-22 14:53:53 -07:00
pktgen.c [PKTGEN]: DSCP support 2006-09-28 18:01:47 -07:00
request_sock.c [NET]: More kzalloc conversions. 2006-04-09 22:25:48 -07:00
rtnetlink.c [RTNETLINK]: Possible dereference in net/core/rtnetlink.c 2006-09-28 18:01:23 -07:00
scm.c [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
skbuff.c [PATCH] slab: clean up leak tracking ifdefs a little bit 2006-10-04 07:55:13 -07:00
sock.c [NET]: Fix sk->sk_filter field access 2006-09-22 15:18:47 -07:00
stream.c [NET]: fix __sk_stream_mem_reclaim 2006-07-12 17:58:53 -07:00
sysctl_net_core.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
user_dma.c [I/OAT]: net/core/user_dma.c should #include <net/netdma.h> 2006-07-21 14:49:49 -07:00
utils.c [NET]: is it Andy or Andi ?? 2006-09-28 18:02:57 -07:00
wireless.c [PATCH] WE-21 support (core API) 2006-09-25 16:52:14 -04:00