]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'packet-DDOS'
authorDavid S. Miller <davem@davemloft.net>
Sat, 15 Jun 2019 01:52:14 +0000 (18:52 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 15 Jun 2019 01:52:44 +0000 (18:52 -0700)
commitd4108abd7b1b02e8a391c0a14f9ce056c16323c9
treed8fd9f39518e15bb5c6b3856043e3c14bbf412b9
parente8a24502dce31563b1793b8d3ee957f77961a6ce
parent1f449b72f29423594a02e142d62e8b1ba7e2bbb3
Merge branch 'packet-DDOS'

Eric Dumazet says:

====================
net/packet: better behavior under DDOS

Using tcpdump (or other af_packet user) on a busy host can lead to
catastrophic consequences, because suddenly, potentially all cpus
are spinning on a contended spinlock.

Both packet_rcv() and tpacket_rcv() grab the spinlock
to eventually find there is no room for an additional packet.

This patch series align packet_rcv() and tpacket_rcv() to both
check if the queue is full before grabbing the spinlock.

If the queue is full, they both increment a new atomic counter
placed on a separate cache line to let readers drain the queue faster.

There is still false sharing on this new atomic counter,
we might in the future make it per cpu if there is interest.
====================

Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>