linux_dsm_epyc7002/net/ipv4
Herbert Xu 2a0a6ebee1 [NETLINK]: Synchronous message processing.
Let's recap the problem.  The current asynchronous netlink kernel
message processing is vulnerable to these attacks:

1) Hit and run: Attacker sends one or more messages and then exits
before they're processed.  This may confuse/disable the next netlink
user that gets the netlink address of the attacker since it may
receive the responses to the attacker's messages.

Proposed solutions:

a) Synchronous processing.
b) Stream mode socket.
c) Restrict/prohibit binding.

2) Starvation: Because various netlink rcv functions were written
to not return until all messages have been processed on a socket,
it is possible for these functions to execute for an arbitrarily
long period of time.  If this is successfully exploited it could
also be used to hold rtnl forever.

Proposed solutions:

a) Synchronous processing.
b) Stream mode socket.

Firstly let's cross off solution c).  It only solves the first
problem and it has user-visible impacts.  In particular, it'll
break user space applications that expect to bind or communicate
with specific netlink addresses (pid's).

So we're left with a choice of synchronous processing versus
SOCK_STREAM for netlink.

For the moment I'm sticking with the synchronous approach as
suggested by Alexey since it's simpler and I'd rather spend
my time working on other things.

However, it does have a number of deficiencies compared to the
stream mode solution:

1) User-space to user-space netlink communication is still vulnerable.

2) Inefficient use of resources.  This is especially true for rtnetlink
since the lock is shared with other users such as networking drivers.
The latter could hold the rtnl while communicating with hardware which
causes the rtnetlink user to wait when it could be doing other things.

3) It is still possible to DoS all netlink users by flooding the kernel
netlink receive queue.  The attacker simply fills the receive socket
with a single netlink message that fills up the entire queue.  The
attacker then continues to call sendmsg with the same message in a loop.

Point 3) can be countered by retransmissions in user-space code, however
it is pretty messy.

In light of these problems (in particular, point 3), we should implement
stream mode netlink at some point.  In the mean time, here is a patch
that implements synchronous processing.  

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-05-03 14:55:09 -07:00
..
ipvs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
netfilter [NETLINK]: Synchronous message processing. 2005-05-03 14:55:09 -07:00
af_inet.c [NET]: kill gratitious includes of major.h 2005-04-25 21:40:39 -07:00
ah4.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
arp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
datagram.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
devinet.c [RTNETLINK] Cleanup rtnetlink_link tables 2005-05-03 14:29:39 -07:00
esp4.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fib_frontend.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fib_hash.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fib_lookup.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fib_rules.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fib_semantics.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
icmp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
igmp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
inetpeer.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_forward.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_fragment.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_gre.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_input.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_options.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_output.c [NETFILTER]: Drop conntrack reference when packet leaves IP 2005-04-25 12:01:07 -07:00
ip_sockglue.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipcomp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipconfig.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipip.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipmr.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
multipath_drr.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
multipath_random.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
multipath_rr.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
multipath_wrandom.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
multipath.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
proc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
protocol.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
raw.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
route.c [NET]: /proc/net/stat/* header cleanup 2005-04-28 12:16:08 -07:00
syncookies.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sysctl_net_ipv4.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tcp_diag.c [NETLINK]: Synchronous message processing. 2005-05-03 14:55:09 -07:00
tcp_input.c [TCP]: Trivial tcp_data_queue() cleanup 2005-04-25 21:39:29 -07:00
tcp_ipv4.c [TCP]: Optimize check in port-allocation code. 2005-05-03 14:36:08 -07:00
tcp_minisocks.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tcp_output.c [TCP]: skb pcount with MTU discovery 2005-04-24 19:12:33 -07:00
tcp_timer.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tcp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
udp.c [IPSEC]: COW skb header in UDP decap 2005-04-19 22:48:59 -07:00
utils.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfrm4_input.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfrm4_output.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfrm4_policy.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfrm4_state.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfrm4_tunnel.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00