general protection fault in rds_ib_add_one
Subsystems (3)
Quoted 14 lines · Hillf Danton
On Mon, 24 Feb 2020 00:38:13 -0800
Quoted 12 lines
syzbot found the following crash on:
HEAD commit: b0dd1eb2 Merge branch 'akpm' (patches from Andrew) git tree: upstream console output: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=13db9de9e00000__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauXTR6PmUg$ kernel config: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=a6001be4097ab13c__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauUIjkEraA$ dashboard link: https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=274094e62023782eeb17__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauXEUExfYg$ compiler: clang version 10.0.0 (https://urldefense.com/v3/__https://github.com/llvm/llvm-project/__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauUcUeVf2A$ c2443155a0fb245c8f17f2c1c72b6ea391e86e81) syz repro: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=10ad6a7ee00000__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauX2w5ISoA$ C reproducer: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=13da7a29e00000__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauUf3qIVeQ$Bisection is inconclusive: the first bad commit could be any of:
[...]
Quoted 60 lines
Quoted 45 lines
868df536Merge branch 'odp_fixes' into rdma.git for-nextIMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by [email protected]
batman_adv: batadv0: Interface activated:batadv_slave_1infiniband syz1: set active
infiniband syz1: added vlan0general protection fault, probably for non-canonical address 0xdffffc0000000086: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000430-0x0000000000000437] CPU: 0 PID: 8852 Comm: syz-executor043 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:dev_to_node include/linux/device.h:663 [inline] RIP: 0010:rds_ib_add_one+0x81/0xe50 net/rds/ib.c:140 Code: b7 a8 06 00 00 4c 89 f0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 f7 e8 0e e4 1d fa bb 30 04 00 00 49 03 1e 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 f0 0a 00 00 8b 1b 48 c7 c0 28 0c 09 89 48 RSP: 0018:ffffc90003087298 EFLAGS: 00010202 RAX: 0000000000000086 RBX: 0000000000000430 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffc900030872f0 R08: ffffffff87964c3c R09: ffffed1014fd109c R10: ffffed1014fd109c R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8880a7e886a8 R15: ffff8880a7e88000 FS: 0000000000c3d880(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0318ed0000 CR3: 00000000a3167000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: add_client_context+0x482/0x660 drivers/infiniband/core/device.c:681 enable_device_and_get+0x15b/0x370 drivers/infiniband/core/device.c:1316 ib_register_device+0x124d/0x15b0 drivers/infiniband/core/device.c:1382 rxe_register_device+0x3f6/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:1231 rxe_add+0x1373/0x14f0 drivers/infiniband/sw/rxe/rxe.c:302 rxe_net_add+0x79/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:539 rxe_newlink+0x31/0x90 drivers/infiniband/sw/rxe/rxe.c:318 nldev_newlink+0x403/0x4a0 drivers/infiniband/core/nldev.c:1538 rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline] rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x701/0xa20 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x766/0x920 net/netlink/af_netlink.c:1328 netlink_sendmsg+0xa2b/0xd40 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline]Quoted 8 lines
____sys_sendmsg+0x4f7/0x7f0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x1ed/0x290 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbeFall back to
NUMA_NO_NODEif needed.
net/rds/ib.c static void rds_ib_add_one(struct ib_dev · line 144
Quoted 9 lines
net/rds/ib.c +2
-1@@ -137,7 +137,8 @@ static void rds_ib_add_one(struct ib_devreturn ; rds_ibdev =kzalloc_node (sizeof (struct rds_ib_device ),GFP_KERNEL , -ibdev_to_node (device)); + device->dev.parent ? +ibdev_to_node (device) :NUMA_NO_NODE );if (!rds_ibdev)return ;
This seems good. Can you please post it as properly formatted patch ?
[email protected]
Acked-byQuoted 9 lines · Hillf Danton
Quoted 3 lines · On Mon, 24 Feb 2020 09:51:01 -0800 Santosh Shilimkar wrote:
Quoted 2 lines · Hillf Danton
Fall back to
NUMA_NO_NODEif needed.[...]
Quoted 2 lines
Quoted 1 line
This seems good. Can you please post it as properly formatted patch ?
Thanks !!
Quoted 54 lines
---8<---
Subject: [PATCH] net/rds: fix gpf inrds_ib_add_one
From: Hillf Danton <[email protected]>The devoted syzbot posted a gpf report.
general protection fault, probably for non-canonical address 0xdffffc0000000086: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000430-0x0000000000000437] CPU: 0 PID: 8852 Comm: syz-executor043 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:dev_to_node include/linux/device.h:663 [inline] RIP: 0010:rds_ib_add_one+0x81/0xe50 net/rds/ib.c:140 Code: b7 a8 06 00 00 4c 89 f0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 f7 e8 0e e4 1d fa bb 30 04 00 00 49 03 1e 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 f0 0a 00 00 8b 1b 48 c7 c0 28 0c 09 89 48 RSP: 0018:ffffc90003087298 EFLAGS: 00010202 RAX: 0000000000000086 RBX: 0000000000000430 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffc900030872f0 R08: ffffffff87964c3c R09: ffffed1014fd109c R10: ffffed1014fd109c R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8880a7e886a8 R15: ffff8880a7e88000 FS: 0000000000c3d880(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0318ed0000 CR3: 00000000a3167000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: add_client_context+0x482/0x660 drivers/infiniband/core/device.c:681 enable_device_and_get+0x15b/0x370 drivers/infiniband/core/device.c:1316 ib_register_device+0x124d/0x15b0 drivers/infiniband/core/device.c:1382 rxe_register_device+0x3f6/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:1231 rxe_add+0x1373/0x14f0 drivers/infiniband/sw/rxe/rxe.c:302 rxe_net_add+0x79/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:539 rxe_newlink+0x31/0x90 drivers/infiniband/sw/rxe/rxe.c:318 nldev_newlink+0x403/0x4a0 drivers/infiniband/core/nldev.c:1538 rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline] rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x701/0xa20 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x766/0x920 net/netlink/af_netlink.c:1328 netlink_sendmsg+0xa2b/0xd40 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x4f7/0x7f0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x1ed/0x290 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbeIt's fixed by falling back to
NUMA_NO_NODEif needed while allocating memory slices for send/recv rings at some cost of dip in performance.
Quoted 7 lines
Reported-by syzbot <[email protected]>Fixes e4c52c98e049 ("RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()")Cc Santosh Shilimkar <[email protected]>Cc Andy Grover <[email protected]>Signed-off-by Hillf Danton <[email protected]>---
Quoted 14 lines
net/rds/ib.c +2
-2@@ -137,7 +137,8 @@ static void rds_ib_add_one(struct ib_devreturn ; rds_ibdev =kzalloc_node (sizeof (struct rds_ib_device ),GFP_KERNEL , -ibdev_to_node (device)); + device->dev.parent ? +ibdev_to_node (device) :NUMA_NO_NODE );if (!rds_ibdev)return ; --
Quoted 73 lines · On 25 Feb 2020, at 19:05, [email protected] wrote:
Quoted 7 lines · Hillf Danton
Quoted 3 lines · On Mon, 24 Feb 2020 09:51:01 -0800 Santosh Shilimkar wrote:
Quoted 2 lines · Hillf Danton
Fall back to
NUMA_NO_NODEif needed.[...]
Quoted 2 lines
Quoted 1 line
This seems good. Can you please post it as properly formatted patch ?
Thanks !!
Quoted 47 lines
---8<---
Subject: [PATCH] net/rds: fix gpf inrds_ib_add_one
From: Hillf Danton <[email protected]>
The devoted syzbot posted a gpf report.general protection fault, probably for non-canonical address 0xdffffc0000000086: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000430-0x0000000000000437] CPU: 0 PID: 8852 Comm: syz-executor043 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:dev_to_node include/linux/device.h:663 [inline] RIP: 0010:rds_ib_add_one+0x81/0xe50 net/rds/ib.c:140 Code: b7 a8 06 00 00 4c 89 f0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 f7 e8 0e e4 1d fa bb 30 04 00 00 49 03 1e 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 f0 0a 00 00 8b 1b 48 c7 c0 28 0c 09 89 48 RSP: 0018:ffffc90003087298 EFLAGS: 00010202 RAX: 0000000000000086 RBX: 0000000000000430 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffc900030872f0 R08: ffffffff87964c3c R09: ffffed1014fd109c R10: ffffed1014fd109c R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8880a7e886a8 R15: ffff8880a7e88000 FS: 0000000000c3d880(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0318ed0000 CR3: 00000000a3167000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: add_client_context+0x482/0x660 drivers/infiniband/core/device.c:681 enable_device_and_get+0x15b/0x370 drivers/infiniband/core/device.c:1316 ib_register_device+0x124d/0x15b0 drivers/infiniband/core/device.c:1382 rxe_register_device+0x3f6/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:1231 rxe_add+0x1373/0x14f0 drivers/infiniband/sw/rxe/rxe.c:302 rxe_net_add+0x79/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:539 rxe_newlink+0x31/0x90 drivers/infiniband/sw/rxe/rxe.c:318 nldev_newlink+0x403/0x4a0 drivers/infiniband/core/nldev.c:1538 rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline] rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x701/0xa20 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x766/0x920 net/netlink/af_netlink.c:1328 netlink_sendmsg+0xa2b/0xd40 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x4f7/0x7f0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x1ed/0x290 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbeQuoted 8 lines
It's fixed by falling back to
NUMA_NO_NODEif needed while allocating memory slices for send/recv rings at some cost of dip in performance.Reported-by syzbot <[email protected]>Fixes e4c52c98e049 ("RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()")Cc Santosh Shilimkar <[email protected]>Cc Andy Grover <[email protected]>Signed-off-by Hillf Danton <[email protected]>---
Quoted 8 lines
net/rds/ib.c static void rds_ib_add_one(struct ib_dev · line 140
Quoted 8 lines
net/rds/ib.c +2
-1@@ -137,7 +137,8 @@ static void rds_ib_add_one(struct ib_devreturn ; rds_ibdev =kzalloc_node (sizeof (struct rds_ib_device ),GFP_KERNEL , -ibdev_to_node (device)); + device->dev.parent ? +ibdev_to_node (device) :NUMA_NO_NODE );
I would strongly advice this fix to be applied to the define itself, so the fix will be made for all 4 calls as well. Aka:
#define ibdev_to_node(ibdev) (ibdev)->dev.parent ? dev_to_node((ibdev)->dev.parent) : NUMA_NO_NODE
Thxs, Håkon
Quoted 3 lines
Quoted 3 lines
net/rds/ib.c +0
-0if (!rds_ibdev)return ; --
Quoted 84 lines · Håkon Bugge
Quoted 73 lines · On 25 Feb 2020, at 19:05, [email protected] wrote:
Quoted 7 lines · Hillf Danton
Quoted 3 lines · On Mon, 24 Feb 2020 09:51:01 -0800 Santosh Shilimkar wrote:
Quoted 2 lines · Hillf Danton
Fall back to
NUMA_NO_NODEif needed.[...]
Quoted 2 lines
Quoted 1 line
This seems good. Can you please post it as properly formatted patch ?
Thanks !!
Quoted 47 lines
---8<---
Subject: [PATCH] net/rds: fix gpf inrds_ib_add_one
From: Hillf Danton <[email protected]>
The devoted syzbot posted a gpf report.general protection fault, probably for non-canonical address 0xdffffc0000000086: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000430-0x0000000000000437] CPU: 0 PID: 8852 Comm: syz-executor043 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:dev_to_node include/linux/device.h:663 [inline] RIP: 0010:rds_ib_add_one+0x81/0xe50 net/rds/ib.c:140 Code: b7 a8 06 00 00 4c 89 f0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 f7 e8 0e e4 1d fa bb 30 04 00 00 49 03 1e 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 f0 0a 00 00 8b 1b 48 c7 c0 28 0c 09 89 48 RSP: 0018:ffffc90003087298 EFLAGS: 00010202 RAX: 0000000000000086 RBX: 0000000000000430 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffc900030872f0 R08: ffffffff87964c3c R09: ffffed1014fd109c R10: ffffed1014fd109c R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8880a7e886a8 R15: ffff8880a7e88000 FS: 0000000000c3d880(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0318ed0000 CR3: 00000000a3167000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: add_client_context+0x482/0x660 drivers/infiniband/core/device.c:681 enable_device_and_get+0x15b/0x370 drivers/infiniband/core/device.c:1316 ib_register_device+0x124d/0x15b0 drivers/infiniband/core/device.c:1382 rxe_register_device+0x3f6/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:1231 rxe_add+0x1373/0x14f0 drivers/infiniband/sw/rxe/rxe.c:302 rxe_net_add+0x79/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:539 rxe_newlink+0x31/0x90 drivers/infiniband/sw/rxe/rxe.c:318 nldev_newlink+0x403/0x4a0 drivers/infiniband/core/nldev.c:1538 rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline] rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x701/0xa20 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x766/0x920 net/netlink/af_netlink.c:1328 netlink_sendmsg+0xa2b/0xd40 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x4f7/0x7f0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x1ed/0x290 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbeQuoted 8 lines
It's fixed by falling back to
NUMA_NO_NODEif needed while allocating memory slices for send/recv rings at some cost of dip in performance.Reported-by syzbot <[email protected]>Fixes e4c52c98e049 ("RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()")Cc Santosh Shilimkar <[email protected]>Cc Andy Grover <[email protected]>Signed-off-by Hillf Danton <[email protected]>---
Quoted 8 lines
net/rds/ib.c static void rds_ib_add_one(struct ib_dev · line 140
Quoted 8 lines
net/rds/ib.c +2
-1@@ -137,7 +137,8 @@ static void rds_ib_add_one(struct ib_devreturn ; rds_ibdev =kzalloc_node (sizeof (struct rds_ib_device ),GFP_KERNEL , -ibdev_to_node (device)); + device->dev.parent ? +ibdev_to_node (device) :NUMA_NO_NODE );I would strongly advice this fix to be applied to the define itself, so the fix will be made for all 4 calls as well. Aka:
Quoted 2 lines
#define
ibdev_to_node(ibdev)(ibdev)->dev.parent ? dev_to_node((ibdev)->dev.parent) :NUMA_NO_NODE
Indeed.
Hillf, Can you please spin V2 with it ?
Quoted 69 lines · Hillf Danton
Quoted 12 lines · On Sun, 1 Mar 2020 11:55:25 -0800 Santosh Shilimkar wrote:
Quoted 6 lines · Håkon Bugge
I would strongly advice this fix to be applied to the define itself, so the fix will be made for all 4 calls as well. Aka:
#define
ibdev_to_node(ibdev)(ibdev)->dev.parent ? dev_to_node((ibdev)->dev.parent) :NUMA_NO_NODEIndeed.
Hillf, Can you please spin V2 with it ?
---8<---
Subject: [PATCH v2] net/rds: fix gpf inrds_ib_add_one
From: Hillf Danton <[email protected]>The devoted syzbot reported a gpf.
general protection fault, probably for non-canonical address 0xdffffc0000000086: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000430-0x0000000000000437] CPU: 0 PID: 8852 Comm: syz-executor043 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:dev_to_node include/linux/device.h:663 [inline] RIP: 0010:rds_ib_add_one+0x81/0xe50 net/rds/ib.c:140 Code: b7 a8 06 00 00 4c 89 f0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 f7 e8 0e e4 1d fa bb 30 04 00 00 49 03 1e 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 f0 0a 00 00 8b 1b 48 c7 c0 28 0c 09 89 48 RSP: 0018:ffffc90003087298 EFLAGS: 00010202 RAX: 0000000000000086 RBX: 0000000000000430 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffc900030872f0 R08: ffffffff87964c3c R09: ffffed1014fd109c R10: ffffed1014fd109c R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8880a7e886a8 R15: ffff8880a7e88000 FS: 0000000000c3d880(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0318ed0000 CR3: 00000000a3167000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: add_client_context+0x482/0x660 drivers/infiniband/core/device.c:681 enable_device_and_get+0x15b/0x370 drivers/infiniband/core/device.c:1316 ib_register_device+0x124d/0x15b0 drivers/infiniband/core/device.c:1382 rxe_register_device+0x3f6/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:1231 rxe_add+0x1373/0x14f0 drivers/infiniband/sw/rxe/rxe.c:302 rxe_net_add+0x79/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:539 rxe_newlink+0x31/0x90 drivers/infiniband/sw/rxe/rxe.c:318 nldev_newlink+0x403/0x4a0 drivers/infiniband/core/nldev.c:1538 rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline] rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x701/0xa20 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x766/0x920 net/netlink/af_netlink.c:1328 netlink_sendmsg+0xa2b/0xd40 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x4f7/0x7f0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x1ed/0x290 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbeIt's fixed by falling back to
NUMA_NO_NODEif needed while setting up device at some cost of runtime dip in performance.
Quoted 7 lines
Reported-by syzbot <[email protected]>Fixes e4c52c98e049 ("RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()")Cc Andy Grover <[email protected]>Cc Santosh Shilimkar <[email protected]>Signed-off-by Hillf Danton <[email protected]>---
Thanks Hillf !!
Jason Gunthorpe
maintainerQuoted 74 lines · On Mon, Feb 24, 2020 at 09:51:01AM -0800, [email protected] wrote:
Quoted 14 lines · Hillf Danton
On Mon, 24 Feb 2020 00:38:13 -0800
Quoted 12 lines
syzbot found the following crash on:
HEAD commit: b0dd1eb2 Merge branch 'akpm' (patches from Andrew) git tree: upstream console output: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/log.txt?x=13db9de9e00000__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauXTR6PmUg$ kernel config: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/.config?x=a6001be4097ab13c__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauUIjkEraA$ dashboard link: https://urldefense.com/v3/__https://syzkaller.appspot.com/bug?extid=274094e62023782eeb17__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauXEUExfYg$ compiler: clang version 10.0.0 (https://urldefense.com/v3/__https://github.com/llvm/llvm-project/__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauUcUeVf2A$ c2443155a0fb245c8f17f2c1c72b6ea391e86e81) syz repro: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.syz?x=10ad6a7ee00000__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauX2w5ISoA$ C reproducer: https://urldefense.com/v3/__https://syzkaller.appspot.com/x/repro.c?x=13da7a29e00000__;!!GqivPVa7Brio!O9xt2mwp7Vb5SndsHmi1c7ynTdDMNXebFTWfSklgQdlUqRdC218qPSAXMuDUauUf3qIVeQ$Bisection is inconclusive: the first bad commit could be any of:
[...]
Quoted 56 lines
Quoted 45 lines
868df536Merge branch 'odp_fixes' into rdma.git for-nextIMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by [email protected]
batman_adv: batadv0: Interface activated:batadv_slave_1infiniband syz1: set active
infiniband syz1: added vlan0general protection fault, probably for non-canonical address 0xdffffc0000000086: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000430-0x0000000000000437] CPU: 0 PID: 8852 Comm: syz-executor043 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:dev_to_node include/linux/device.h:663 [inline] RIP: 0010:rds_ib_add_one+0x81/0xe50 net/rds/ib.c:140 Code: b7 a8 06 00 00 4c 89 f0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 f7 e8 0e e4 1d fa bb 30 04 00 00 49 03 1e 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 f0 0a 00 00 8b 1b 48 c7 c0 28 0c 09 89 48 RSP: 0018:ffffc90003087298 EFLAGS: 00010202 RAX: 0000000000000086 RBX: 0000000000000430 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffc900030872f0 R08: ffffffff87964c3c R09: ffffed1014fd109c R10: ffffed1014fd109c R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8880a7e886a8 R15: ffff8880a7e88000 FS: 0000000000c3d880(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0318ed0000 CR3: 00000000a3167000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: add_client_context+0x482/0x660 drivers/infiniband/core/device.c:681 enable_device_and_get+0x15b/0x370 drivers/infiniband/core/device.c:1316 ib_register_device+0x124d/0x15b0 drivers/infiniband/core/device.c:1382 rxe_register_device+0x3f6/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:1231 rxe_add+0x1373/0x14f0 drivers/infiniband/sw/rxe/rxe.c:302 rxe_net_add+0x79/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:539 rxe_newlink+0x31/0x90 drivers/infiniband/sw/rxe/rxe.c:318 nldev_newlink+0x403/0x4a0 drivers/infiniband/core/nldev.c:1538 rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline] rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] rdma_nl_rcv+0x701/0xa20 drivers/infiniband/core/netlink.c:259 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x766/0x920 net/netlink/af_netlink.c:1328 netlink_sendmsg+0xa2b/0xd40 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline]Quoted 8 lines
____sys_sendmsg+0x4f7/0x7f0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x1ed/0x290 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbeFall back to
NUMA_NO_NODEif needed.
Quoted 11 lines
Review static void rds_ib_add_one(struct ib_dev · line 143
Quoted 10 lines
+++
b/net/rds/ib.c(quoted diff) +2
-1@@ -137,7 +137,8 @@ static void rds_ib_add_one(struct ib_dev return; rds_ibdev = kzalloc_node(sizeof(struct rds_ib_device), GFP_KERNEL, - ibdev_to_node(device)); + device->dev.parent ? + ibdev_to_node(device) : NUMA_NO_NODE); if (!rds_ibdev) return;This seems good. Can you please post it as properly formatted patch ?
Reminder please, this still shows in the dashboards?
Jason