netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: netdev@vger.kernel.org, Jianlin Shi <jishi@redhat.com>,
	Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH net] net: enforce xmit_recursion for devices with a queue
Date: Thu, 14 Mar 2019 07:56:10 -0700	[thread overview]
Message-ID: <d0fb2f43-89a5-ccb0-b551-5d6ed6a90fed@gmail.com> (raw)
In-Reply-To: <20190314141505.GA1953@bistromath.localdomain>



On 03/14/2019 07:15 AM, Sabrina Dubroca wrote:
> 2019-03-14, 05:58:03 -0700, Eric Dumazet wrote:
>>
>>
>> On 03/14/2019 03:15 AM, Sabrina Dubroca wrote:
>>> Commit 745e20f1b626 ("net: add a recursion limit in xmit path")
>>> introduced a recursion limit, but it only applies to devices without a
>>> queue. Virtual devices with a queue (either because they don't have
>>> the IFF_NO_QUEUE flag, or because the administrator added one) can
>>> still cause an unbounded recursion, via __dev_queue_xmit ->
>>> __dev_xmit_skb -> qdisc_run -> __qdisc_run -> qdisc_restart ->
>>> sch_direct_xmit -> dev_hard_start_xmit . Jianlin reported this in a
>>> setup with 16 gretap devices stacked on top of one another.
>>>
>>> This patch prevents the stack overflow by incrementing xmit_recursion in
>>> code paths that can call dev_hard_start_xmit() (like commit 745e20f1b626
>>> did). If the recursion limit is exceeded, the packet is enqueued and the
>>> qdisc is scheduled.
>>>
>>> Reported-by: Jianlin Shi <jishi@redhat.com>
>>> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
>>> Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
>>
>> Hi Sabrina, thanks for the patch.
>>
>> Can't we detect this in the control path instead ?
> 
> I don't see how. You could have a perfectly reasonable set of gretap
> devices that trigger this situation from simply reshuffling the IP
> addresses:
> 
> gretap$x remote 1.1.$((x-1)).{1,2}
> (all those addresses set on a single veth device)
> 
> Then you move those addresses to the corresponding device
> (1.1.${x}.{1,2} on gretap$x), and your machine crashes.
> 

If this only can be done with gretap, why gretap cant implement the protection,
outside of the fast path ?

Thanks.

  reply	other threads:[~2019-03-14 14:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 10:15 [PATCH net] net: enforce xmit_recursion for devices with a queue Sabrina Dubroca
2019-03-14 12:58 ` Eric Dumazet
2019-03-14 14:15   ` Sabrina Dubroca
2019-03-14 14:56     ` Eric Dumazet [this message]
2019-03-14 17:40       ` Sabrina Dubroca
2019-03-14 17:51         ` Eric Dumazet
2019-03-14 17:58           ` Sabrina Dubroca
2019-04-10  9:45           ` Sabrina Dubroca

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=d0fb2f43-89a5-ccb0-b551-5d6ed6a90fed@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=jishi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sbrivio@redhat.com \
    --cc=sd@queasysnail.net \
    /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;
as well as URLs for NNTP newsgroup(s).