Page MenuHomeFreeBSD

pf: Send syncookies from the receiving thread
Needs ReviewPublic

Authored by bnovkov on Fri, Aug 21, 12:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Aug 21, 12:49 PM
Unknown Object (File)
Fri, Aug 21, 12:45 PM
F167389276: baseline.svg
Fri, Aug 21, 12:24 PM
F167389277: patch.svg
Fri, Aug 21, 12:24 PM

Details

Reviewers
kp
Group Reviewers
Klara
Summary

pf sends outbound packets by offloading them to a single per-vnet SWI handler
through the V_pf_sendqueue mbuf queue. A large DDoS attack may overwhelm
that per-vnet queue with syncookie packets and cause contention in the SWI
handler that negatively affects other pf operations.

Fix this by sending the initial syncookie challenge from the context
of the receiving thread. This avoids the syncookie-induced contention on
the pf_intr mbuf queue.

Sponsored by: Klara, Inc.
Sponsored by: Entersekt
MFC after: 3 weeks

Test Plan

I've tested this patch by flooding a host using hping3. The two attached pmcstat-generated flamegraphs show that the patch is successfully removing the load from the SWI handler.


Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75933
Build 72816: arc lint + arc unit

Event Timeline

Can you check or host the results somewhere else? Maybe freefall?

Can you check or host the results somewhere else? Maybe freefall?

Sorry, I forgot that phabricator doesn't automatically attach the referenced files, they should be visible now.

In case they're not, I've also uploaded them to freefall.