Kuniyuki Iwashima
3b3186c770
netlink: Add __sock_i_ino() for __netlink_diag_dump().
[ Upstream commit 25a9c8a443 ]
syzbot reported a warning in __local_bh_enable_ip(). [0]
Commit 8d61f926d4 ("netlink: fix potential deadlock in
netlink_set_err()") converted read_lock(&nl_table_lock) to
read_lock_irqsave() in __netlink_diag_dump() to prevent a deadlock.
However, __netlink_diag_dump() calls sock_i_ino() that uses
read_lock_bh() and read_unlock_bh(). If CONFIG_TRACE_IRQFLAGS=y,
read_unlock_bh() finally enables IRQ even though it should stay
disabled until the following read_unlock_irqrestore().
Using read_lock() in sock_i_ino() would trigger a lockdep splat
in another place that was fixed in commit f064af1e50 ("net: fix
a lockdep splat"), so let's add __sock_i_ino() that would be safe
to use under BH disabled.
[0]:
WARNING: CPU: 0 PID: 5012 at kernel/softirq.c:376 __local_bh_enable_ip+0xbe/0x130 kernel/softirq.c:376
Modules linked in:
CPU: 0 PID: 5012 Comm: syz-executor487 Not tainted 6.4.0-rc7-syzkaller-00202-g6f68fc395f49 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
RIP: 0010:__local_bh_enable_ip+0xbe/0x130 kernel/softirq.c:376
Code: 45 bf 01 00 00 00 e8 91 5b 0a 00 e8 3c 15 3d 00 fb 65 8b 05 ec e9 b5 7e 85 c0 74 58 5b 5d c3 65 8b 05 b2 b6 b4 7e 85 c0 75 a2 <0f> 0b eb 9e e8 89 15 3d 00 eb 9f 48 89 ef e8 6f 49 18 00 eb a8 0f
RSP: 0018:ffffc90003a1f3d0 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000201 RCX: 1ffffffff1cf5996
RDX: 0000000000000000 RSI: 0000000000000201 RDI: ffffffff8805c6f3
RBP: ffffffff8805c6f3 R08: 0000000000000001 R09: ffff8880152b03a3
R10: ffffed1002a56074 R11: 0000000000000005 R12: 00000000000073e4
R13: dffffc0000000000 R14: 0000000000000002 R15: 0000000000000000
FS: 0000555556726300(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000045ad50 CR3: 000000007c646000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
sock_i_ino+0x83/0xa0 net/core/sock.c:2559
__netlink_diag_dump+0x45c/0x790 net/netlink/diag.c:171
netlink_diag_dump+0xd6/0x230 net/netlink/diag.c:207
netlink_dump+0x570/0xc50 net/netlink/af_netlink.c:2269
__netlink_dump_start+0x64b/0x910 net/netlink/af_netlink.c:2374
netlink_dump_start include/linux/netlink.h:329 [inline]
netlink_diag_handler_dump+0x1ae/0x250 net/netlink/diag.c:238
__sock_diag_cmd net/core/sock_diag.c:238 [inline]
sock_diag_rcv_msg+0x31e/0x440 net/core/sock_diag.c:269
netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2547
sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365
netlink_sendmsg+0x925/0xe30 net/netlink/af_netlink.c:1914
sock_sendmsg_nosec net/socket.c:724 [inline]
sock_sendmsg+0xde/0x190 net/socket.c:747
____sys_sendmsg+0x71c/0x900 net/socket.c:2503
___sys_sendmsg+0x110/0x1b0 net/socket.c:2557
__sys_sendmsg+0xf7/0x1c0 net/socket.c:2586
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5303aaabb9
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc7506e548 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5303aaabb9
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00007f5303a6ed60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5303a6edf0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
Fixes: 8d61f926d4 ("netlink: fix potential deadlock in netlink_set_err()")
Reported-by: syzbot+5da61cf6a9bc1902d422@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=5da61cf6a9bc1902d422
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230626164313.52528-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-19 16:21:13 +02:00
..
2022-10-05 07:05:41 +09:00
2023-06-14 11:15:28 +02:00
2021-07-01 13:19:48 -07:00
2021-11-19 11:52:25 +00:00
2023-06-28 11:12:32 +02:00
2023-06-14 11:15:17 +02:00
2021-11-17 20:17:05 -08:00
2022-07-22 12:53:22 +01:00
2023-03-11 13:55:26 +01:00
2023-03-11 13:55:28 +01:00
2020-02-28 14:51:30 +01:00
2022-09-09 08:24:41 +01:00
2022-07-28 10:42:44 -07:00
2019-05-30 11:26:41 -07:00
2022-09-01 11:44:13 +01:00
2022-06-22 12:59:43 +01:00
2022-08-23 10:43:11 +02:00
2017-11-02 11:10:55 +01:00
2022-07-22 12:53:22 +01:00
2022-02-21 11:44:30 +00:00
2017-11-02 11:10:55 +01:00
2022-07-28 22:06:15 -07:00
2022-08-09 22:14:02 -07:00
2021-12-13 12:34:09 +00:00
2022-09-16 14:34:01 +01:00
2023-05-11 23:03:41 +09:00
2022-07-22 12:53:22 +01:00
2023-05-30 14:03:20 +01:00
2021-03-26 17:43:55 +01:00
2022-08-24 13:46:58 +01:00
2019-05-21 11:28:45 +02:00
2019-06-19 17:09:55 +02:00
2022-08-25 11:07:26 +02:00
2022-05-22 21:51:54 +01:00
2022-03-11 10:57:22 +00:00
2020-07-15 07:45:24 -07:00
2020-03-27 19:40:38 -07:00
2021-12-22 15:03:47 -08:00
2022-07-22 12:53:22 +01:00
2021-12-22 15:03:51 -08:00
2022-07-24 18:39:17 -06:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-09-30 18:17:16 -07:00
2022-09-07 15:28:08 +01:00
2022-09-30 18:17:17 -07:00
2019-12-16 16:09:44 -08:00
2021-11-29 19:50:45 -08:00
2022-10-03 07:52:13 +01:00
2020-05-08 21:33:33 -07:00
2022-12-31 13:33:02 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2020-04-20 07:34:16 +02:00
2022-07-22 12:53:22 +01:00
2021-12-06 16:06:02 -08:00
2019-12-24 22:37:30 -08:00
2021-12-16 07:18:35 -08:00
2022-07-28 22:21:54 -07:00
2022-09-20 09:13:38 +02:00
2022-09-20 09:13:38 +02:00
2022-10-03 12:41:59 +01:00
2017-11-02 11:10:55 +01:00
2022-07-11 19:49:38 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-10-18 12:54:41 +01:00
2022-10-24 19:08:46 -07:00
2019-03-22 12:09:31 -07:00
2021-01-29 20:39:14 -08:00
2017-11-02 11:10:55 +01:00
2022-08-25 16:07:42 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-06-28 14:29:45 -07:00
2022-02-04 16:25:21 +01:00
2022-10-07 08:42:00 +01:00
2022-04-06 22:09:39 -07:00
2019-04-22 21:50:53 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-29 11:58:54 +01:00
2022-07-22 12:53:22 +01:00
2022-08-24 19:30:07 -07:00
2022-02-07 20:12:45 -08:00
2021-10-15 11:33:08 +01:00
2022-07-22 12:53:22 +01:00
2023-01-12 12:02:15 +01:00
2023-06-05 09:26:16 +02:00
2023-01-12 12:02:15 +01:00
2019-02-08 21:50:15 -08:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2022-02-17 11:44:20 -08:00
2022-07-22 12:53:22 +01:00
2022-04-25 11:40:45 +01:00
2022-04-11 17:37:50 -07:00
2022-10-03 07:59:06 +01:00
2023-05-24 17:32:39 +01:00
2023-06-05 09:26:16 +02:00
2022-09-29 07:18:00 +02:00
2022-07-22 12:53:22 +01:00
2022-02-04 14:15:11 -08:00
2022-09-02 20:34:32 -07:00
2022-11-17 10:42:45 +01:00
2018-03-27 09:51:23 +02:00
2019-06-19 17:09:55 +02:00
2020-06-20 17:22:22 -07:00
2018-07-11 23:10:19 -07:00
2021-03-23 14:14:50 -07:00
2017-11-02 11:10:55 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-12-07 20:44:59 -08:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-28 11:29:36 +02:00
2021-11-07 19:25:29 +00:00
2021-08-30 01:51:36 +02:00
2023-02-01 08:34:35 +01:00
2022-04-25 20:51:12 +02:00
2022-09-23 06:56:08 -07:00
2022-04-01 12:04:15 +01:00
2021-10-29 13:23:51 +01:00
2020-03-02 11:16:27 -08:00
2021-03-26 15:14:56 -07:00
2022-07-22 12:53:22 +01:00
2020-05-29 21:20:20 -07:00
2023-01-07 11:11:44 +01:00
2022-12-31 13:33:02 +01:00
2022-07-22 12:53:22 +01:00
2022-03-03 11:55:12 -08:00
2023-06-21 16:01:03 +02:00
2022-05-11 12:43:10 +01:00
2018-05-28 22:59:54 -04:00
2022-07-11 16:25:14 +02:00
2017-11-02 11:10:55 +01:00
2021-12-10 06:38:26 -08:00
2022-07-22 12:53:22 +01:00
2019-05-21 11:28:45 +02:00
2022-11-01 21:29:06 -07:00
2019-11-12 08:18:03 -08:00
2022-07-22 12:53:22 +01:00
2021-09-24 14:07:10 +01:00
2022-09-02 19:59:08 -07:00
2017-11-08 16:12:33 +09:00
2022-07-22 12:53:22 +01:00
2023-06-05 09:26:20 +02:00
2020-03-04 13:25:55 -08:00
2023-06-14 11:15:16 +02:00
2022-10-02 16:07:17 +01:00
2023-06-14 11:15:21 +02:00
2022-07-22 12:53:22 +01:00
2022-07-15 18:50:35 -07:00
2021-08-09 15:34:21 -07:00
2022-07-22 12:53:22 +01:00
2023-04-13 16:55:23 +02:00
2022-06-19 10:00:02 +01:00
2022-10-11 17:42:58 -06:00
2023-07-19 16:21:10 +02:00
2022-02-02 14:45:18 +00:00
2022-08-01 11:59:23 -07:00
2022-07-25 13:25:39 +01:00
2023-06-14 11:15:20 +02:00
2018-03-13 18:37:02 +02:00
2022-04-13 12:46:26 +01:00
2019-04-22 21:47:25 -07:00
2023-06-21 16:01:01 +02:00
2023-05-11 23:03:18 +09:00
2022-07-22 12:53:22 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2022-01-04 12:17:35 +00:00
2021-04-28 14:06:45 -07:00
2018-04-11 10:33:46 -04:00
2022-07-27 13:24:42 +01:00
2019-10-05 16:29:00 -07:00
2022-12-31 13:32:04 +01:00
2023-07-19 16:21:13 +02:00
2021-08-03 13:05:26 +01:00
2022-07-22 12:53:22 +01:00
2022-07-18 11:24:10 +01:00
2022-06-29 20:37:36 -07:00
2019-05-30 11:26:32 -07:00
2023-06-09 10:34:05 +02:00
2019-05-30 11:26:32 -07:00
2018-05-08 00:02:41 -04:00
2019-10-04 14:07:07 -07:00
2023-06-05 09:26:18 +02:00
2022-07-22 12:53:22 +01:00
2020-06-18 20:46:23 -07:00
2022-07-22 12:53:22 +01:00
2022-09-01 11:42:12 +01:00
2022-10-12 17:50:37 -07:00
2022-10-12 17:50:37 -07:00
2019-11-14 18:12:17 -08:00
2022-03-01 08:38:02 +00:00
2018-01-24 19:13:45 -05:00
2019-12-09 10:28:43 -08:00
2017-11-02 11:10:55 +01:00
2022-07-22 12:53:22 +01:00
2022-09-30 07:55:46 -07:00
2021-12-29 08:48:14 -08:00
2022-09-26 13:28:19 -07:00
2023-06-28 11:12:28 +02:00
2023-05-11 23:03:21 +09:00