Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker
@ 2021-07-29 15:57 George Kennedy
  2021-07-29 15:57 ` [PATCH 5.4.y 1/1] net_sched: check error pointer in tcf_dump_walker() George Kennedy
  2021-07-29 16:49 ` [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker Sasha Levin
  0 siblings, 2 replies; 3+ messages in thread
From: George Kennedy @ 2021-07-29 15:57 UTC (permalink / raw)
  To: gregkh
  Cc: george.kennedy, xiyou.wangcong, jhs, jiri, stable, dhaval.giani,
	dan.carpenter, netdev

During Syzkaller reproducer testing on 5.4.y (5.4.121-rc1) the following warning occurred:

general protection fault in tcf_generic_walker
https://syzkaller.appspot.com//bug?id=a85a4c2d373f7f8ff9ac5ee351e60d3c042cc781

This missing upstream commit is needed to fix the crash in 5.4.y:
580e4273d7a883ececfefa692c1f96bdbacb99b5 net_sched: check error pointer in tcf_dump_walker()

debugfs: Directory 'sg0' with parent 'block' already present!
blktrace: debugfs_dir not present for sg0 so skipping
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN NOPTI
CPU: 0 PID: 16603 Comm: syz-executor.7 Not tainted 5.4.135-rc1-syzk #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
RIP: 0010:tcf_dump_walker net/sched/act_api.c:236 [inline]
RIP: 0010:tcf_generic_walker+0x3ac/0xbd0 net/sched/act_api.c:340
Code: 31 ff 48 89 de e8 e4 92 b9 f5 48 85 db 74 44 e8 aa 91 b9 f5 49 8d 7c 24 30 48 b9 00 00 00 00 00 fc ff df 48 89 f8 48 c1 e8 03 <80> 3c 08 00 0f 85 06 07 00 00 49 8b 5c 24 30 48 2b 9d 18 ff ff ff
RSP: 0018:ffff888048f37240 EFLAGS: 00010212
RAX: 0000000000000004 RBX: 0000000100261497 RCX: dffffc0000000000
RDX: 00000000000006e0 RSI: ffffffff8bbbbc06 RDI: 0000000000000020
RBP: ffff888048f37388 R08: ffff888046e61740 R09: ffffed10091e6e3c
R10: ffffed10091e6e3b R11: ffff888048f371df R12: fffffffffffffff0
R13: 00000000ffffffff R14: 0000000000000000 R15: ffff8880665488c0
FS:  00007fdde8ed0700(0000) GS:ffff88810b200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2fb21000 CR3: 0000000050326000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff4ff0 DR7: 0000000000000600
Call Trace:
 tunnel_key_walker+0x91/0xe0 net/sched/act_tunnel_key.c:577
 tc_dump_action+0x748/0xf50 net/sched/act_api.c:1524
 netlink_dump+0x53b/0xe80 net/netlink/af_netlink.c:2247
 __netlink_dump_start+0x5a2/0x7d0 net/netlink/af_netlink.c:2355
 netlink_dump_start include/linux/netlink.h:233 [inline]
 rtnetlink_rcv_msg+0x707/0xb00 net/core/rtnetlink.c:5222
 netlink_rcv_skb+0x178/0x490 net/netlink/af_netlink.c:2480
 rtnetlink_rcv+0x21/0x30 net/core/rtnetlink.c:5277
 netlink_unicast_kernel net/netlink/af_netlink.c:1305 [inline]
 netlink_unicast+0x561/0x710 net/netlink/af_netlink.c:1331
 netlink_sendmsg+0x8c9/0xda0 net/netlink/af_netlink.c:1920
 sock_sendmsg_nosec net/socket.c:637 [inline]
 sock_sendmsg+0x155/0x190 net/socket.c:657
 ____sys_sendmsg+0x738/0x8c0 net/socket.c:2284
 ___sys_sendmsg+0x10f/0x190 net/socket.c:2338
 __sys_sendmsg+0x115/0x1f0 net/socket.c:2384
 __do_sys_sendmsg net/socket.c:2393 [inline]
 __se_sys_sendmsg net/socket.c:2391 [inline]
 __x64_sys_sendmsg+0x7d/0xc0 net/socket.c:2391
 do_syscall_64+0xe6/0x4d0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4595f9
Code: fc ff 48 81 c4 80 00 00 00 e9 f1 fe ff ff 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 0b 42 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fdde8ecfc48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000002e680 RCX: 00000000004595f9
RDX: 0000000000000000 RSI: 0000000020000200 RDI: 0000000000000004
RBP: 000000000077bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000077bf0c
R13: 0000000000021000 R14: 000000000077bf00 R15: 00007fdde8ed0700
Modules linked in:

Cong Wang (1):
  net_sched: check error pointer in tcf_dump_walker()

 net/sched/act_api.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
1.8.3.1


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

* [PATCH 5.4.y 1/1] net_sched: check error pointer in tcf_dump_walker()
  2021-07-29 15:57 [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker George Kennedy
@ 2021-07-29 15:57 ` George Kennedy
  2021-07-29 16:49 ` [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: George Kennedy @ 2021-07-29 15:57 UTC (permalink / raw)
  To: gregkh
  Cc: george.kennedy, xiyou.wangcong, jhs, jiri, stable, dhaval.giani,
	dan.carpenter, netdev

From: Cong Wang <xiyou.wangcong@gmail.com>

Although we take RTNL on dump path, it is possible to
skip RTNL on insertion path. So the following race condition
is possible:

rtnl_lock()		// no rtnl lock
			mutex_lock(&idrinfo->lock);
			// insert ERR_PTR(-EBUSY)
			mutex_unlock(&idrinfo->lock);
tc_dump_action()
rtnl_unlock()

So we have to skip those temporary -EBUSY entries on dump path
too.

Reported-and-tested-by: syzbot+b47bc4f247856fb4d9e1@syzkaller.appspotmail.com
Fixes: 0fedc63fadf0 ("net_sched: commit action insertions together")
Cc: Vlad Buslov <vladbu@mellanox.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 580e4273d7a883ececfefa692c1f96bdbacb99b5)
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
---
 net/sched/act_api.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 17e5cd9..75132d0 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -231,6 +231,8 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 		index++;
 		if (index < s_i)
 			continue;
+		if (IS_ERR(p))
+			continue;
 
 		if (jiffy_since &&
 		    time_after(jiffy_since,
-- 
1.8.3.1


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

* Re: [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker
  2021-07-29 15:57 [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker George Kennedy
  2021-07-29 15:57 ` [PATCH 5.4.y 1/1] net_sched: check error pointer in tcf_dump_walker() George Kennedy
@ 2021-07-29 16:49 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-07-29 16:49 UTC (permalink / raw)
  To: George Kennedy
  Cc: gregkh, xiyou.wangcong, jhs, jiri, stable, dhaval.giani,
	dan.carpenter, netdev

On Thu, Jul 29, 2021 at 10:57:33AM -0500, George Kennedy wrote:
>During Syzkaller reproducer testing on 5.4.y (5.4.121-rc1) the following warning occurred:
>
>general protection fault in tcf_generic_walker
>https://syzkaller.appspot.com//bug?id=a85a4c2d373f7f8ff9ac5ee351e60d3c042cc781
>
>This missing upstream commit is needed to fix the crash in 5.4.y:
>580e4273d7a883ececfefa692c1f96bdbacb99b5 net_sched: check error pointer in tcf_dump_walker()

I'll queue it up, thanks!

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2021-07-29 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 15:57 [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker George Kennedy
2021-07-29 15:57 ` [PATCH 5.4.y 1/1] net_sched: check error pointer in tcf_dump_walker() George Kennedy
2021-07-29 16:49 ` [PATCH 5.4.y 0/0] Missing commit 580e4273 causing: general protection fault in tcf_generic_walker Sasha Levin

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).