Re: r194546 amd64: kernel panic in tcp_sack.c

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Kamigishi Rei <spambox@...>
Cc: <silby@...>, <freebsd-current@...>
Date: Friday, July 3, 2009 - 5:28 pm

Kamigishi Rei wrote:

With some poking around and a key insight provided by Robert Watson, I 
believe we've got this sorted.

The SACK code puts a global cap on the amount of memory that can be used 
for SACK accounting. The variable V_tcp_sack_globalholes tracks how many 
SACK holes are currently allocated across all active TCP connections. It 
gets incremented in tcp_sackhole_alloc() and decremented in 
tcp_sackhole_free() in netinet/tcp_sack.c.

It turns out that there is currently no lock synchronising access to the 
variable, and the incrementing/decrementing is not being done 
atomically. In Kamigishi's case, his server had a traffic profile 
consisting of a large number of clients simultaneously connecting over 
cruddy links which was giving the SACK accounting a real workout. The 
inevitable race would strike one or more times, leaving the count of 
holes not in tune with reality, and eventually when traffic died down 
the variable would decrement down below 0, triggering the panic. Note 
that this panic only occurs if INVARIANTS is compiled into the kernel so 
the issue has been around for some time but not noticed.

The attached patch makes use of the atomic(9) KPI to ensure 
incrementing/decrementing the variable is done atomically, which should 
fix the bug.

Reviews/testing would be good so that we can get this into 8.0.

Cheers,
Lawrence
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
r194546 amd64: kernel panic in tcp_sack.c, Kamigishi Rei, (Sat Jun 27, 1:18 am)
Re: r194546 amd64: kernel panic in tcp_sack.c, Lawrence Stewart, (Mon Jun 29, 10:21 am)
Re: r194546 amd64: kernel panic in tcp_sack.c, Kamigishi Rei, (Mon Jun 29, 10:50 am)
Re: r194546 amd64: kernel panic in tcp_sack.c, Lawrence Stewart, (Mon Jun 29, 11:13 am)
Re: r194546 amd64: kernel panic in tcp_sack.c, Kamigishi Rei, (Wed Jul 1, 6:33 pm)
Re: r194546 amd64: kernel panic in tcp_sack.c, Lawrence Stewart, (Fri Jul 3, 5:28 pm)
Re: r194546 amd64: kernel panic in tcp_sack.c, Kamigishi Rei, (Sun Jul 5, 6:47 am)
Re: r194546 amd64: kernel panic in tcp_sack.c, Lawrence Stewart, (Wed Jul 1, 7:07 pm)
Re: r194546 amd64: kernel panic in tcp_sack.c, Kamigishi Rei, (Wed Jul 1, 7:27 pm)
Re: r194546 amd64: kernel panic in tcp_sack.c, Lawrence Stewart, (Wed Jul 1, 7:31 pm)
Re: r194546 amd64: kernel panic in tcp_sack.c, Kamigishi Rei, (Wed Jul 1, 7:34 pm)