<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/core/sock.c, branch linux-2.6.33.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.33.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.33.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2010-04-01T23:02:04Z</updated>
<entry>
<title>net: backlog functions rename</title>
<updated>2010-04-01T23:02:04Z</updated>
<author>
<name>Zhu Yi</name>
</author>
<published>2010-03-04T18:01:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a12a9a26ff389892df27e2ff4cbf03e5b2ed0d64'/>
<id>urn:sha1:a12a9a26ff389892df27e2ff4cbf03e5b2ed0d64</id>
<content type='text'>
[ Upstream commit a3a858ff18a72a8d388e31ab0d98f7e944841a62 ]

sk_add_backlog -&gt; __sk_add_backlog
sk_add_backlog_limited -&gt; sk_add_backlog

Signed-off-by: Zhu Yi &lt;yi.zhu@intel.com&gt;
Acked-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;


</content>
</entry>
<entry>
<title>net: add limit for socket backlog</title>
<updated>2010-04-01T23:02:02Z</updated>
<author>
<name>Zhu Yi</name>
</author>
<published>2010-03-04T18:01:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ab9dd052e4d0c4d281ceec0b7e410e229beb6fb2'/>
<id>urn:sha1:ab9dd052e4d0c4d281ceec0b7e410e229beb6fb2</id>
<content type='text'>
[ Upstream commit 8eae939f1400326b06d0c9afe53d2a484a326871 ]

We got system OOM while running some UDP netperf testing on the loopback
device. The case is multiple senders sent stream UDP packets to a single
receiver via loopback on local host. Of course, the receiver is not able
to handle all the packets in time. But we surprisingly found that these
packets were not discarded due to the receiver's sk-&gt;sk_rcvbuf limit.
Instead, they are kept queuing to sk-&gt;sk_backlog and finally ate up all
the memory. We believe this is a secure hole that a none privileged user
can crash the system.

The root cause for this problem is, when the receiver is doing
__release_sock() (i.e. after userspace recv, kernel udp_recvmsg -&gt;
skb_free_datagram_locked -&gt; release_sock), it moves skbs from backlog to
sk_receive_queue with the softirq enabled. In the above case, multiple
busy senders will almost make it an endless loop. The skbs in the
backlog end up eat all the system memory.

The issue is not only for UDP. Any protocols using socket backlog is
potentially affected. The patch adds limit for socket backlog so that
the backlog size cannot be expanded endlessly.

Reported-by: Alex Shi &lt;alex.shi@intel.com&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@ghostprotocols.net&gt;
Cc: Alexey Kuznetsov &lt;kuznet@ms2.inr.ac.ru&gt;
Cc: "Pekka Savola (ipv6)" &lt;pekkas@netcore.fi&gt;
Cc: Patrick McHardy &lt;kaber@trash.net&gt;
Cc: Vlad Yasevich &lt;vladislav.yasevich@hp.com&gt;
Cc: Sridhar Samudrala &lt;sri@us.ibm.com&gt;
Cc: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Cc: Allan Stephens &lt;allan.stephens@windriver.com&gt;
Cc: Andrew Hendry &lt;andrew.hendry@gmail.com&gt;
Signed-off-by: Zhu Yi &lt;yi.zhu@intel.com&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Acked-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>tcp: update the netstamp_needed counter when cloning sockets</title>
<updated>2010-01-08T08:00:09Z</updated>
<author>
<name>Octavian Purdila</name>
</author>
<published>2010-01-08T08:00:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=704da560c0a0120d8869187f511491a00951a1d3'/>
<id>urn:sha1:704da560c0a0120d8869187f511491a00951a1d3</id>
<content type='text'>
This fixes a netstamp_needed accounting issue when the listen socket
has SO_TIMESTAMP set:

    s = socket(AF_INET, SOCK_STREAM, 0);
    setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, 1); -&gt; netstamp_needed = 1
    bind(s, ...);
    listen(s, ...);
    s2 = accept(s, ...); -&gt; netstamp_needed = 1
    close(s2); -&gt; netstamp_needed = 0
    close(s); -&gt; netstamp_needed = -1

Signed-off-by: Octavian Purdila &lt;opurdila@ixiacom.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix build warning in sock_bindtodevice().</title>
<updated>2009-11-06T06:37:11Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2009-11-06T06:37:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=000ba2e43f33901859fd794bb33c885909d53b3b'/>
<id>urn:sha1:000ba2e43f33901859fd794bb33c885909d53b3b</id>
<content type='text'>
net/core/sock.c: In function 'sock_setsockopt':
net/core/sock.c:396: warning: 'index' may be used uninitialized in this function
net/core/sock.c:396: note: 'index' was declared here

GCC can't see that all paths initialize index, so just
set it to the default (0) and eliminate the specific
code block that handles the null device name string.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: sock_bindtodevice() RCU-ification</title>
<updated>2009-11-06T06:34:24Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2009-11-06T05:03:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bf8e56bfc4fcfcef9f08e6233dc619706807893a'/>
<id>urn:sha1:bf8e56bfc4fcfcef9f08e6233dc619706807893a</id>
<content type='text'>
Avoid dev_hold()/dev_put() in sock_bindtodevice()

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix for dst_negative_advice</title>
<updated>2009-10-21T01:55:46Z</updated>
<author>
<name>Krishna Kumar</name>
</author>
<published>2009-10-19T23:46:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ea94ff3b55188df157a8740bdf3976a87563d705'/>
<id>urn:sha1:ea94ff3b55188df157a8740bdf3976a87563d705</id>
<content type='text'>
dst_negative_advice() should check for changed dst and reset
sk_tx_queue_mapping accordingly. Pass sock to the callers of
dst_negative_advice.

(sk_reset_txq is defined just for use by dst_negative_advice. The
only way I could find to get around this is to move dst_negative_()
from dst.h to dst.c, include sock.h in dst.c, etc)

Signed-off-by: Krishna Kumar &lt;krkumar2@in.ibm.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Introduce sk_tx_queue_mapping</title>
<updated>2009-10-21T01:55:45Z</updated>
<author>
<name>Krishna Kumar</name>
</author>
<published>2009-10-19T23:46:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e022f0b4a03f4fff9323b509df023b8af635716e'/>
<id>urn:sha1:e022f0b4a03f4fff9323b509df023b8af635716e</id>
<content type='text'>
Introduce sk_tx_queue_mapping; and functions that set, test and
get this value. Reset sk_tx_queue_mapping to -1 whenever the dst
cache is set/reset, and in socket alloc. Setting txq to -1 and
using valid txq=&lt;0 to n-1&gt; allows the tx path to use the value
of sk_tx_queue_mapping directly instead of subtracting 1 on every
tx.

Signed-off-by: Krishna Kumar &lt;krkumar2@in.ibm.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: sk_drops consolidation</title>
<updated>2009-10-15T03:40:11Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2009-10-15T03:40:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=766e9037cc139ee25ed93ee5ad11e1450c4b99f6'/>
<id>urn:sha1:766e9037cc139ee25ed93ee5ad11e1450c4b99f6</id>
<content type='text'>
sock_queue_rcv_skb() can update sk_drops itself, removing need for
callers to take care of it. This is more consistent since
sock_queue_rcv_skb() also reads sk_drops when queueing a skb.

This adds sk_drops managment to many protocols that not cared yet.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Generalize socket rx gap / receive queue overflow cmsg</title>
<updated>2009-10-12T20:26:31Z</updated>
<author>
<name>Neil Horman</name>
</author>
<published>2009-10-12T20:26:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b885787ea4112eaa80945999ea0901bf742707f'/>
<id>urn:sha1:3b885787ea4112eaa80945999ea0901bf742707f</id>
<content type='text'>
Create a new socket level option to report number of queue overflows

Recently I augmented the AF_PACKET protocol to report the number of frames lost
on the socket receive queue between any two enqueued frames.  This value was
exported via a SOL_PACKET level cmsg.  AFter I completed that work it was
requested that this feature be generalized so that any datagram oriented socket
could make use of this option.  As such I've created this patch, It creates a
new SOL_SOCKET level option called SO_RXQ_OVFL, which when enabled exports a
SOL_SOCKET level cmsg that reports the nubmer of times the sk_receive_queue
overflowed between any two given frames.  It also augments the AF_PACKET
protocol to take advantage of this new feature (as it previously did not touch
sk-&gt;sk_drops, which this patch uses to record the overflow count).  Tested
successfully by me.

Notes:

1) Unlike my previous patch, this patch simply records the sk_drops value, which
is not a number of drops between packets, but rather a total number of drops.
Deltas must be computed in user space.

2) While this patch currently works with datagram oriented protocols, it will
also be accepted by non-datagram oriented protocols. I'm not sure if thats
agreeable to everyone, but my argument in favor of doing so is that, for those
protocols which aren't applicable to this option, sk_drops will always be zero,
and reporting no drops on a receive queue that isn't used for those
non-participating protocols seems reasonable to me.  This also saves us having
to code in a per-protocol opt in mechanism.

3) This applies cleanly to net-next assuming that commit
977750076d98c7ff6cbda51858bb5a5894a9d9ab (my af packet cmsg patch) is reverted

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix sock_wfree() race</title>
<updated>2009-09-30T23:20:38Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2009-09-24T10:49:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d99927f4d93f36553699573b279e0ff98ad7dea6'/>
<id>urn:sha1:d99927f4d93f36553699573b279e0ff98ad7dea6</id>
<content type='text'>
Commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
(net: No more expensive sock_hold()/sock_put() on each tx)
opens a window in sock_wfree() where another cpu
might free the socket we are working on.

A fix is to call sk-&gt;sk_write_space(sk) while still
holding a reference on sk.

Reported-by: Jike Song &lt;albcamus@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
