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)
Jan 27 2024, 1:08 PM
Unknown Object (File)
Dec 23 2023, 3:24 AM
Unknown Object (File)
Aug 25 2023, 1:21 AM
Unknown Object (File)
Jun 3 2023, 11:27 PM
Unknown Object (File)
May 15 2023, 3:06 PM
Unknown Object (File)
Dec 31 2022, 12:50 AM
Unknown Object (File)
Dec 12 2022, 8:25 AM
Unknown Object (File)
Dec 19 2016, 1:17 AM
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