All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: core: reduce recursion limit value
@ 2020-06-15 15:00 Taehee Yoo
  2020-06-15 15:21 ` Florian Westphal
  0 siblings, 1 reply; 3+ messages in thread
From: Taehee Yoo @ 2020-06-15 15:00 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: ap420073, fw

In the current code, ->ndo_start_xmit() can be executed recursively only
10 times because of stack memory.
But, in the case of the vxlan, 10 recursion limit value results in
a stack overflow.
In the current code, the nested interface is limited by 8 depth.
There is no critical reason that the recursion limitation value should
be 10.
So, it would be good to be the same value with the limitation value of
nesting interface depth.

Test commands:
    ip link add vxlan10 type vxlan vni 10 dstport 4789 srcport 4789 4789
    ip link set vxlan10 up
    ip a a 192.168.10.1/24 dev vxlan10
    ip n a 192.168.10.2 dev vxlan10 lladdr fc:22:33:44:55:66 nud permanent

    for i in {9..0}
    do
        let A=$i+1
	ip link add vxlan$i type vxlan vni $i dstport 4789 srcport 4789 4789
	ip link set vxlan$i up
	ip a a 192.168.$i.1/24 dev vxlan$i
	ip n a 192.168.$i.2 dev vxlan$i lladdr fc:22:33:44:55:66 nud permanent
	bridge fdb add fc:22:33:44:55:66 dev vxlan$A dst 192.168.$i.2 self
    done
    hping3 192.168.10.2 -2 -d 60000

Splat looks like:
[  103.814237][ T1127] =============================================================================
[  103.871955][ T1127] BUG kmalloc-2k (Tainted: G    B            ): Padding overwritten. 0x00000000897a2e4f-0x000
[  103.873187][ T1127] -----------------------------------------------------------------------------
[  103.873187][ T1127]
[  103.874252][ T1127] INFO: Slab 0x000000005cccc724 objects=5 used=5 fp=0x0000000000000000 flags=0x10000000001020
[  103.881323][ T1127] CPU: 3 PID: 1127 Comm: hping3 Tainted: G    B             5.7.0+ #575
[  103.882131][ T1127] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[  103.883006][ T1127] Call Trace:
[  103.883324][ T1127]  dump_stack+0x96/0xdb
[  103.883716][ T1127]  slab_err+0xad/0xd0
[  103.884106][ T1127]  ? _raw_spin_unlock+0x1f/0x30
[  103.884620][ T1127]  ? get_partial_node.isra.78+0x140/0x360
[  103.885214][ T1127]  slab_pad_check.part.53+0xf7/0x160
[  103.885769][ T1127]  ? pskb_expand_head+0x110/0xe10
[  103.886316][ T1127]  check_slab+0x97/0xb0
[  103.886763][ T1127]  alloc_debug_processing+0x84/0x1a0
[  103.887308][ T1127]  ___slab_alloc+0x5a5/0x630
[  103.887765][ T1127]  ? pskb_expand_head+0x110/0xe10
[  103.888265][ T1127]  ? lock_downgrade+0x730/0x730
[  103.888762][ T1127]  ? pskb_expand_head+0x110/0xe10
[  103.889244][ T1127]  ? __slab_alloc+0x3e/0x80
[  103.889675][ T1127]  __slab_alloc+0x3e/0x80
[  103.890108][ T1127]  __kmalloc_node_track_caller+0xc7/0x420
[ ... ]

Fixes: 97cdcf37b57e ("net: place xmit recursion in softnet data")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
 include/linux/netdevice.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6fc613ed8eae..39e28e11863c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3157,7 +3157,7 @@ static inline int dev_recursion_level(void)
 	return this_cpu_read(softnet_data.xmit.recursion);
 }
 
-#define XMIT_RECURSION_LIMIT	10
+#define XMIT_RECURSION_LIMIT	8
 static inline bool dev_xmit_recursion(void)
 {
 	return unlikely(__this_cpu_read(softnet_data.xmit.recursion) >
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: core: reduce recursion limit value
  2020-06-15 15:00 [PATCH net] net: core: reduce recursion limit value Taehee Yoo
@ 2020-06-15 15:21 ` Florian Westphal
  2020-06-16 10:49   ` Taehee Yoo
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2020-06-15 15:21 UTC (permalink / raw)
  To: Taehee Yoo; +Cc: davem, kuba, netdev, fw

Taehee Yoo <ap420073@gmail.com> wrote:
> In the current code, ->ndo_start_xmit() can be executed recursively only
> 10 times because of stack memory.
> But, in the case of the vxlan, 10 recursion limit value results in
> a stack overflow.
[..]

> Fixes: 97cdcf37b57e ("net: place xmit recursion in softnet data")

That commit did not change the recursion limit,
11a766ce915fc9f86 ("net: Increase xmit RECURSION_LIMIT to 10.") did?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: core: reduce recursion limit value
  2020-06-15 15:21 ` Florian Westphal
@ 2020-06-16 10:49   ` Taehee Yoo
  0 siblings, 0 replies; 3+ messages in thread
From: Taehee Yoo @ 2020-06-16 10:49 UTC (permalink / raw)
  To: Florian Westphal; +Cc: David Miller, Jakub Kicinski, Netdev

On Tue, 16 Jun 2020 at 00:21, Florian Westphal <fw@strlen.de> wrote:
>

Hi Florian,
Thank you for the review!

> Taehee Yoo <ap420073@gmail.com> wrote:
> > In the current code, ->ndo_start_xmit() can be executed recursively only
> > 10 times because of stack memory.
> > But, in the case of the vxlan, 10 recursion limit value results in
> > a stack overflow.
> [..]
>
> > Fixes: 97cdcf37b57e ("net: place xmit recursion in softnet data")
>
> That commit did not change the recursion limit,
> 11a766ce915fc9f86 ("net: Increase xmit RECURSION_LIMIT to 10.") did?

You're right.
I will send a v2 patch.

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-16 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 15:00 [PATCH net] net: core: reduce recursion limit value Taehee Yoo
2020-06-15 15:21 ` Florian Westphal
2020-06-16 10:49   ` Taehee Yoo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.