From: kuznet@ms2.inr.ac.ru
To: raghuangadi@yahoo.com (Raghu Angadi)
Cc: davem@redhat.com, raghuangadi@yahoo.com, linux-kernel@vger.kernel.org
Subject: Re: Fw: memory corruption in tcp bind hash buckets on SMP?
Date: Fri, 1 Mar 2002 22:07:03 +0300 (MSK) [thread overview]
Message-ID: <200203011907.WAA08216@ms2.inr.ac.ru> (raw)
In-Reply-To: <20020227203101.78001.qmail@web12305.mail.yahoo.com> from "Raghu Angadi" at Feb 27, 2 12:31:01 pm
Hello!
> > > inverted order of insertion into the lists in tw_hashdance() is probably
> > > cleaner fix than inverted order of removal..
> >
> > Why are they not equivalent? Good question? :-)
>
> they are. with "if (!tb->tb) return;" instead of "if (!tb->pprev) return;".
> silly me was thinking of literal cut-n-paste invertion of the oder :->
However, you were 100% right. They are really not equivalent. :-)
Right solution is to exchange order of insertion. tcp_timewait_kill()
is right and need not changes.
Proof follows:
Main invariant: that guy who inserts/removes socket to/from established
hash table, must make this for binding table. That guy who did not find
socket in established hash, must not touch binding table.
In this case concurrent tcp_timewait_kill()s are happy: socket will
be removed from binding table once and only once, when it is removed
from established hash. The second tcp_timewait_kill() does not find
socket in established table and it must _not_ touch binding table,
despite of socket can be there at the moment.
The mess happens while concurrent remove and insert: insert adds
socket to established table and then to binding table. Racing remove
removes it from established table, but cannot satisfy invariant
because socket is still not in binding table. (This place should
be asserted with a BUG() for future)
The second statement, which completes the proof: removing is possible
only after the socket is added to established hash table (it is evident,
until this time bucket is private to creator).
Alexey
next prev parent reply other threads:[~2002-03-01 19:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20020226.231934.116353439.davem@redhat.com>
2002-02-27 19:04 ` kuznet
2002-02-27 19:46 ` Raghu Angadi
2002-02-27 20:05 ` Raghu Angadi
2002-02-27 20:12 ` kuznet
2002-02-27 20:31 ` Raghu Angadi
2002-03-01 19:07 ` kuznet [this message]
2002-03-04 20:48 ` Raghu Angadi
2002-03-04 23:26 ` David S. Miller
2002-03-05 0:54 ` Raghu Angadi
2002-03-05 4:30 ` David S. Miller
2002-02-27 20:08 ` Fw: " kuznet
2002-02-27 20:26 ` Raghu Angadi
2002-02-28 5:53 ` Raghu Angadi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200203011907.WAA08216@ms2.inr.ac.ru \
--to=kuznet@ms2.inr.ac.ru \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=raghuangadi@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®