Page MenuHomeFreeBSD

Avoid accessing the socket memory in tcp_input() for ESTABLISHED sessions
ClosedPublic

Authored by jtl on Oct 11 2016, 8:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 28 2024, 5:51 PM
Unknown Object (File)
Nov 25 2024, 10:13 AM
Unknown Object (File)
Oct 29 2024, 11:27 AM
Unknown Object (File)
Oct 29 2024, 11:17 AM
Unknown Object (File)
Oct 17 2024, 10:45 PM
Unknown Object (File)
Oct 3 2024, 11:07 AM
Unknown Object (File)
Oct 2 2024, 11:18 PM
Unknown Object (File)
Oct 2 2024, 10:13 PM
Subscribers

Details

Reviewers
gallatin
rrs
jtl
Group Reviewers
transport
Summary

Currently, when tcp_input() receives a packet on a session that matches a TCPCB, it checks (so->so_options & SO_ACCEPTCONN) to determine whether or not the socket is a listening socket. However, this causes the code to access a different cacheline. If we first check if the socket is in the LISTEN state, we can avoid accessing so->so_options for ESTABLISHED packets.

If INVARIANTS is defined, the code still needs to access both to check that so->so_options is consistent with the state. (That's just the penalty you pay for running INVARIANTS.)

Test Plan

I tested this with live traffic. It works.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5550
Build 5784: arc lint + arc unit

Event Timeline

jtl retitled this revision from to Avoid accessing the socket memory in tcp_input() for ESTABLISHED sessions.
jtl updated this object.
jtl edited the test plan for this revision. (Show Details)
jtl added reviewers: rrs, gallatin.
gallatin edited edge metadata.
jtl added a reviewer: jtl.
This revision is now accepted and ready to land.Oct 12 2016, 2:27 AM