public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* 4.19 stable kernel crash caused by vxlan testing
@ 2024-04-23  5:52 zhulei
  2024-04-23 11:04 ` Taehee Yoo
  2024-04-23 11:11 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: zhulei @ 2024-04-23  5:52 UTC (permalink / raw)
  To: ap420073; +Cc: davem, jbenc, sashal, stable, gregkh

Hey all,

I recently used a testing program to test the 4.19 stable branch kernel and found that a crash occurred immediately. The test source code link is:
https://github.com/Backmyheart/src0358/blob/master/vxlan_fdb_destroy.c

The test command is as follows:
gcc vxlan_fdb_destroy.c -o vxlan_fdb_destroy -lpthread

According to its stack, upstream has relevant repair patch, the commit id is 7c31e54aeee517d1318dfc0bde9fa7de75893dc6.

May i ask if the 4.19 kernel will port this patch ?

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

* Re: 4.19 stable kernel crash caused by vxlan testing
  2024-04-23  5:52 4.19 stable kernel crash caused by vxlan testing zhulei
@ 2024-04-23 11:04 ` Taehee Yoo
  2024-04-23 11:11 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Taehee Yoo @ 2024-04-23 11:04 UTC (permalink / raw)
  To: zhulei; +Cc: davem, jbenc, sashal, stable, gregkh

On Tue, Apr 23, 2024 at 2:53 PM zhulei <zhulei_szu@163.com> wrote:
>
> Hey all,
>
> I recently used a testing program to test the 4.19 stable branch kernel and found that a crash occurred immediately. The test source code link is:
> https://github.com/Backmyheart/src0358/blob/master/vxlan_fdb_destroy.c
>
> The test command is as follows:
> gcc vxlan_fdb_destroy.c -o vxlan_fdb_destroy -lpthread
>
> According to its stack, upstream has relevant repair patch, the commit id is 7c31e54aeee517d1318dfc0bde9fa7de75893dc6.
>
> May i ask if the 4.19 kernel will port this patch ?

Hi zhulei,

The commit 7c31e54aeee5 ("vxlan: do not destroy fdb if
register_netdevice() is failed") was not backported to 4.19-stable
tree.
https://lore.kernel.org/stable/15641355392228@kroah.com/

So, you can request a backport.
Please check the URL:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

Thanks a lot!
Taehee Yoo

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

* Re: 4.19 stable kernel crash caused by vxlan testing
  2024-04-23  5:52 4.19 stable kernel crash caused by vxlan testing zhulei
  2024-04-23 11:04 ` Taehee Yoo
@ 2024-04-23 11:11 ` Greg KH
  2024-05-07  9:20   ` zhulei
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2024-04-23 11:11 UTC (permalink / raw)
  To: zhulei; +Cc: ap420073, davem, jbenc, sashal, stable

On Tue, Apr 23, 2024 at 01:52:40PM +0800, zhulei wrote:
> Hey all,
> 
> I recently used a testing program to test the 4.19 stable branch kernel and found that a crash occurred immediately. The test source code link is:
> https://github.com/Backmyheart/src0358/blob/master/vxlan_fdb_destroy.c
> 
> The test command is as follows:
> gcc vxlan_fdb_destroy.c -o vxlan_fdb_destroy -lpthread
> 
> According to its stack, upstream has relevant repair patch, the commit id is 7c31e54aeee517d1318dfc0bde9fa7de75893dc6.
> 
> May i ask if the 4.19 kernel will port this patch ?

Have you tested to verify that it does work?  If so, please provide the
working patch because as-is, it does not apply to 4.19.y at all.

thansk,

greg k-h

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

* Re: 4.19 stable kernel crash caused by vxlan testing
  2024-04-23 11:11 ` Greg KH
@ 2024-05-07  9:20   ` zhulei
  2024-05-13 13:03     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: zhulei @ 2024-05-07  9:20 UTC (permalink / raw)
  To: gregkh; +Cc: ap420073, davem, jbenc, sashal, stable

By making the following changes and using our own 4.19 kernel
verification, we can observe the output that passes the test
in dmesg.

When using the 4.19 stable branch kernel for verification, the
dmesg has no output, which looks more like the test program is not
running. However, the code of vxlan.c is the same.

May i ask if the changes made to the maintainer are reasonable?

---
 drivers/net/vxlan.c | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 704db80df38b..d3000c58c0f2 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -657,6 +657,14 @@ static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan,
 	return f;
 }
 
+static void vxlan_fdb_insert(struct vxlan_dev *vxlan, const u8 *mac,
+			     __be32 src_vni, struct vxlan_fdb *f)
+{
+	++vxlan->addrcnt;
+	hlist_add_head_rcu(&f->hlist,
+			   vxlan_fdb_head(vxlan, mac, src_vni));
+}
+
 static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 			    const u8 *mac, union vxlan_addr *ip,
 			    __u16 state, __be16 port, __be32 src_vni,
@@ -682,10 +690,6 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 		return rc;
 	}
 
-	++vxlan->addrcnt;
-	hlist_add_head_rcu(&f->hlist,
-			   vxlan_fdb_head(vxlan, mac, src_vni));
-
 	*fdb = f;
 
 	return 0;
@@ -758,15 +762,15 @@ static int vxlan_fdb_update(struct vxlan_dev *vxlan,
 	if (notify) {
 		if (rd == NULL)
 			rd = first_remote_rtnl(f);
+		vxlan_fdb_insert(vxlan, mac, src_vni, f);
 		vxlan_fdb_notify(vxlan, f, rd, RTM_NEWNEIGH);
 	}
 
 	return 0;
 }
 
-static void vxlan_fdb_free(struct rcu_head *head)
+static void __vxlan_fdb_free(struct vxlan_fdb *f)
 {
-	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
 	struct vxlan_rdst *rd, *nd;
 
 	list_for_each_entry_safe(rd, nd, &f->remotes, list) {
@@ -776,6 +780,13 @@ static void vxlan_fdb_free(struct rcu_head *head)
 	kfree(f);
 }
 
+static void vxlan_fdb_free(struct rcu_head *head)
+{
+	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
+
+	__vxlan_fdb_free(f);
+}
+
 static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
 			      bool do_notify)
 {
@@ -3265,9 +3276,12 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
 	if (err)
 		goto errout;
 
-	/* notify default fdb entry */
-	if (f)
+	if (f) {
+		vxlan_fdb_insert(vxlan, all_zeros_mac,
+				 vxlan->default_dst.remote_vni, f);
+		/* notify default fdb entry */
 		vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH);
+	}
 
 	list_add(&vxlan->next, &vn->vxlan_list);
 	return 0;
@@ -3278,9 +3292,11 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
 	 * destroy the entry by hand here.
 	 */
 	if (f)
-		vxlan_fdb_destroy(vxlan, f, false);
-	if (unregister)
+		__vxlan_fdb_free(f);
+	if (unregister) {
+		vxlan_fdb_destroy(vxlan, f, true);
 		unregister_netdevice(dev);
+	}
 	return err;
 }
 
-- 
2.27.0


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

* Re: 4.19 stable kernel crash caused by vxlan testing
  2024-05-07  9:20   ` zhulei
@ 2024-05-13 13:03     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2024-05-13 13:03 UTC (permalink / raw)
  To: zhulei; +Cc: ap420073, davem, jbenc, sashal, stable

On Tue, May 07, 2024 at 05:20:49PM +0800, zhulei wrote:
> By making the following changes and using our own 4.19 kernel
> verification, we can observe the output that passes the test
> in dmesg.
> 
> When using the 4.19 stable branch kernel for verification, the
> dmesg has no output, which looks more like the test program is not
> running. However, the code of vxlan.c is the same.
> 
> May i ask if the changes made to the maintainer are reasonable?

Why is this only a 4.19.y thing?  Why is this not also relevent for
Linus's current tree?

thanks,

greg k-h

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

end of thread, other threads:[~2024-05-13 13:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23  5:52 4.19 stable kernel crash caused by vxlan testing zhulei
2024-04-23 11:04 ` Taehee Yoo
2024-04-23 11:11 ` Greg KH
2024-05-07  9:20   ` zhulei
2024-05-13 13:03     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox