RE: WARNING in dma_map_page_attrs

From: Parav Pandit
Date: Mon Oct 26 2020 - 01:24:12 EST


Hi Christoph,

> From: Jakub Kicinski <kuba@xxxxxxxxxx>
> Sent: Saturday, October 24, 2020 11:45 PM
>
> CC: rdma, looks like rdma from the stack trace
>
> On Fri, 23 Oct 2020 20:07:17 -0700 syzbot wrote:
> > syzbot has found a reproducer for the following issue on:
> >
> > HEAD commit: 3cb12d27 Merge tag 'net-5.10-rc1' of git://git.kernel.org/..

In [1] you mentioned that dma_mask should not be set for dma_virt_ops.
So patch [2] removed it.

But check to validate the dma mask for all dma_ops was added in [3].

What is the right way? Did I misunderstood your comment about dma_mask in [1]?

[1] https://www.spinics.net/lists/linux-rdma/msg96374.html
[2] e0477b34d9d ("RDMA: Explicitly pass in the dma_device to ib_register_device")
[3] f959dcd6ddfd ("dma-direct: Fix potential NULL pointer dereference")

> > WARNING: CPU: 1 PID: 8488 at kernel/dma/mapping.c:149
> > dma_map_page_attrs+0x493/0x700 kernel/dma/mapping.c:149 Modules
> linked in:
> > dma_map_single_attrs include/linux/dma-mapping.h:279 [inline]
> > ib_dma_map_single include/rdma/ib_verbs.h:3967 [inline]
> > ib_mad_post_receive_mads+0x23f/0xd60
> > drivers/infiniband/core/mad.c:2715
> > ib_mad_port_start drivers/infiniband/core/mad.c:2862 [inline]
> > ib_mad_port_open drivers/infiniband/core/mad.c:3016 [inline]
> > ib_mad_init_device+0x72b/0x1400 drivers/infiniband/core/mad.c:3092
> > add_client_context+0x405/0x5e0 drivers/infiniband/core/device.c:680
> > enable_device_and_get+0x1d5/0x3c0
> > drivers/infiniband/core/device.c:1301
> > ib_register_device drivers/infiniband/core/device.c:1376 [inline]
> > ib_register_device+0x7a7/0xa40 drivers/infiniband/core/device.c:1335
> > rxe_register_device+0x46d/0x570
> > drivers/infiniband/sw/rxe/rxe_verbs.c:1182
> > rxe_add+0x12fe/0x16d0 drivers/infiniband/sw/rxe/rxe.c:247
> > rxe_net_add+0x8c/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:507
> > rxe_newlink drivers/infiniband/sw/rxe/rxe.c:269 [inline]
> > rxe_newlink+0xb7/0xe0 drivers/infiniband/sw/rxe/rxe.c:250
> > nldev_newlink+0x30e/0x540 drivers/infiniband/core/nldev.c:1555
> > rdma_nl_rcv_msg+0x367/0x690 drivers/infiniband/core/netlink.c:195
> > rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
> > rdma_nl_rcv+0x2f2/0x440 drivers/infiniband/core/netlink.c:259
> > netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
> > netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
> > netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
> > sock_sendmsg_nosec net/socket.c:651 [inline]
> > sock_sendmsg+0xcf/0x120 net/socket.c:671
> > ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353
> > ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
> > __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
> > do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
> > entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > RIP: 0033:0x443699
> > Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 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 db 0d fc ff c3 66 2e 0f 1f 84 00 00 00 00
> > RSP: 002b:00007ffc067db418 EFLAGS: 00000246 ORIG_RAX:
> 000000000000002e
> > RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000443699
> > RDX: 0000000000000000 RSI: 00000000200002c0 RDI: 0000000000000003
> > RBP: 00007ffc067db420 R08: 0000000001bbbbbb R09: 0000000001bbbbbb
> > R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc067db430
> > R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
> >