[syzbot] [net?] kernel BUG in __nla_validate_parse

18 views
Skip to first unread message

syzbot

unread,
Mar 9, 2024, 10:13:35 AMMar 9
to da...@davemloft.net, dsa...@kernel.org, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2f901582f032 Merge tag 'for-net-next-2024-03-08' of git://..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=112f130a180000
kernel config: https://syzkaller.appspot.com/x/.config?x=63afafeedf00ef8f
dashboard link: https://syzkaller.appspot.com/bug?extid=65bb09a7208ce3d4a633
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b03984cb5619/disk-2f901582.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/41787ac7c9d9/vmlinux-2f901582.xz
kernel image: https://storage.googleapis.com/syzbot-assets/da7931fd36f6/bzImage-2f901582.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+65bb09...@syzkaller.appspotmail.com

------------[ cut here ]------------
kernel BUG at lib/nlattr.c:411!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 PID: 14369 Comm: syz-executor.2 Not tainted 6.8.0-rc7-syzkaller-02415-g2f901582f032 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
RIP: 0010:validate_nla lib/nlattr.c:411 [inline]
RIP: 0010:__nla_validate_parse+0x2f61/0x2f70 lib/nlattr.c:635
Code: 48 8b 4c 24 18 80 e1 07 38 c1 0f 8c e0 f7 ff ff 48 8b 7c 24 18 e8 ff 0e 1d fd e9 d1 f7 ff ff e8 d5 c2 91 06 e8 50 64 ba fc 90 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 90 90 90 90 90 90 90
RSP: 0018:ffffc90003c1eec0 EFLAGS: 00010287
RAX: ffffffff84d90ad0 RBX: ffffffff8caa11b0 RCX: 0000000000040000
RDX: ffffc9000499a000 RSI: 000000000000065e RDI: 000000000000065f
RBP: ffffc90003c1f100 R08: ffffffff84d8df5b R09: 0000000000000000
R10: ffffc90003c1f1a0 R11: fffff52000783e46 R12: 0000000000000008
R13: 1ffff1100f9c4183 R14: 000000000000006e R15: 0000000000000005
FS: 00007f5fe2d916c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000440 CR3: 00000000229a2000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__nla_parse+0x40/0x60 lib/nlattr.c:732
__nlmsg_parse include/net/netlink.h:756 [inline]
nlmsg_parse include/net/netlink.h:777 [inline]
rtm_del_nexthop+0x257/0x6d0 net/ipv4/nexthop.c:3256
rtnetlink_rcv_msg+0x89b/0x10d0 net/core/rtnetlink.c:6595
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2556
netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361
netlink_sendmsg+0x8e0/0xcb0 net/netlink/af_netlink.c:1902
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
do_syscall_64+0xf9/0x240
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7f5fe207dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5fe2d910c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f5fe21abf80 RCX: 00007f5fe207dda9
RDX: 0000000000000000 RSI: 0000000020000440 RDI: 0000000000000003
RBP: 00007f5fe20ca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f5fe21abf80 R15: 00007fff7d5a1278
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:validate_nla lib/nlattr.c:411 [inline]
RIP: 0010:__nla_validate_parse+0x2f61/0x2f70 lib/nlattr.c:635
Code: 48 8b 4c 24 18 80 e1 07 38 c1 0f 8c e0 f7 ff ff 48 8b 7c 24 18 e8 ff 0e 1d fd e9 d1 f7 ff ff e8 d5 c2 91 06 e8 50 64 ba fc 90 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 90 90 90 90 90 90 90
RSP: 0018:ffffc90003c1eec0 EFLAGS: 00010287
RAX: ffffffff84d90ad0 RBX: ffffffff8caa11b0 RCX: 0000000000040000
RDX: ffffc9000499a000 RSI: 000000000000065e RDI: 000000000000065f
RBP: ffffc90003c1f100 R08: ffffffff84d8df5b R09: 0000000000000000
R10: ffffc90003c1f1a0 R11: fffff52000783e46 R12: 0000000000000008
R13: 1ffff1100f9c4183 R14: 000000000000006e R15: 0000000000000005
FS: 00007f5fe2d916c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000c00104bb94 CR3: 00000000229a2000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Eric Dumazet

unread,
Mar 9, 2024, 10:25:35 AMMar 9
to syzbot, Petr Machata, da...@davemloft.net, dsa...@kernel.org, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Petr, can you take a look ?

Thanks !


commit 2118f9390d83cf942de8b34faf3d35b54f9f4eee
Author: Petr Machata <pe...@nvidia.com>
Date: Wed Mar 6 13:49:15 2024 +0100

net: nexthop: Adjust netlink policy parsing for a new attribute

syzbot

unread,
Mar 9, 2024, 11:02:34 AMMar 9
to da...@davemloft.net, dsa...@kernel.org, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, pe...@nvidia.com, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: d7e14e534493 Merge tag 'mlx5-socket-direct-v3' of git://gi..
git tree: net-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1179b11e180000
kernel config: https://syzkaller.appspot.com/x/.config?x=63afafeedf00ef8f
dashboard link: https://syzkaller.appspot.com/bug?extid=65bb09a7208ce3d4a633
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=113a3399180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=156404d6180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6e15425ce891/disk-d7e14e53.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/290e40cea50b/vmlinux-d7e14e53.xz
kernel image: https://storage.googleapis.com/syzbot-assets/099bac6ed92e/bzImage-d7e14e53.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+65bb09...@syzkaller.appspotmail.com

------------[ cut here ]------------
kernel BUG at lib/nlattr.c:411!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 PID: 5074 Comm: syz-executor243 Not tainted 6.8.0-rc7-syzkaller-02431-gd7e14e534493 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
RIP: 0010:validate_nla lib/nlattr.c:411 [inline]
RIP: 0010:__nla_validate_parse+0x2f61/0x2f70 lib/nlattr.c:635
Code: 48 8b 4c 24 18 80 e1 07 38 c1 0f 8c e0 f7 ff ff 48 8b 7c 24 18 e8 ff 0e 1d fd e9 d1 f7 ff ff e8 d5 c2 91 06 e8 50 64 ba fc 90 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 90 90 90 90 90 90 90
RSP: 0018:ffffc900041b6ec0 EFLAGS: 00010293
RAX: ffffffff84d90ad0 RBX: ffffffff8caa11e0 RCX: ffff8880283bd940
RDX: 0000000000000000 RSI: 000000000000004e RDI: 0000000000000015
RBP: ffffc900041b7100 R08: ffffffff84d8df5b R09: 0000000000000000
R10: ffffc900041b71a0 R11: fffff52000836e46 R12: 0000000000000008
R13: 1ffff11003d97c83 R14: 000000000000004e R15: 0000000000000008
FS: 0000555556b10380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000045ad50 CR3: 000000007aa22000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__nla_parse+0x40/0x60 lib/nlattr.c:732
__nlmsg_parse include/net/netlink.h:756 [inline]
nlmsg_parse include/net/netlink.h:777 [inline]
rtm_del_nexthop+0x257/0x6d0 net/ipv4/nexthop.c:3256
rtnetlink_rcv_msg+0x89b/0x10d0 net/core/rtnetlink.c:6595
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2556
netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361
netlink_sendmsg+0x8e0/0xcb0 net/netlink/af_netlink.c:1902
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
do_syscall_64+0xf9/0x240
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7f70bac1d369
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcffdc2f38 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ffcffdc3108 RCX: 00007f70bac1d369
RDX: 0000000000000000 RSI: 0000000020000640 RDI: 0000000000000003
RBP: 00007f70bac90610 R08: 0000000000000000 R09: 00007ffcffdc3108
R10: 00007f70bac589e3 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffcffdc30f8 R14: 0000000000000001 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:validate_nla lib/nlattr.c:411 [inline]
RIP: 0010:__nla_validate_parse+0x2f61/0x2f70 lib/nlattr.c:635
Code: 48 8b 4c 24 18 80 e1 07 38 c1 0f 8c e0 f7 ff ff 48 8b 7c 24 18 e8 ff 0e 1d fd e9 d1 f7 ff ff e8 d5 c2 91 06 e8 50 64 ba fc 90 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 90 90 90 90 90 90 90
RSP: 0018:ffffc900041b6ec0 EFLAGS: 00010293
RAX: ffffffff84d90ad0 RBX: ffffffff8caa11e0 RCX: ffff8880283bd940
RDX: 0000000000000000 RSI: 000000000000004e RDI: 0000000000000015
RBP: ffffc900041b7100 R08: ffffffff84d8df5b R09: 0000000000000000
R10: ffffc900041b71a0 R11: fffff52000836e46 R12: 0000000000000008
R13: 1ffff11003d97c83 R14: 000000000000004e R15: 0000000000000008
FS: 0000555556b10380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000045ad50 CR3: 000000007aa22000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

Jakub Kicinski

unread,
Mar 9, 2024, 1:41:03 PMMar 9
to Eric Dumazet, syzbot, Petr Machata, da...@davemloft.net, dsa...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
On Sat, 9 Mar 2024 16:25:18 +0100 Eric Dumazet wrote:
> On Sat, Mar 9, 2024 at 4:13 PM syzbot
> > ..
> Petr, can you take a look ?
>
> Thanks !
>
>
> commit 2118f9390d83cf942de8b34faf3d35b54f9f4eee
> Author: Petr Machata <pe...@nvidia.com>
> Date: Wed Mar 6 13:49:15 2024 +0100
>
> net: nexthop: Adjust netlink policy parsing for a new attribute

Yeah

+static const struct nla_policy rtm_nh_policy_del[] = {
+ [NHA_ID] = { .type = NLA_U32 },
+};

+ err = nlmsg_parse(nlh, sizeof(struct nhmsg), tb, NHA_MAX,
+ rtm_nh_policy_del, extack);

The policy size must be >= max_attr (NHA_MAX).

syzbot

unread,
Mar 10, 2024, 12:44:04 AMMar 10
to da...@davemloft.net, dsa...@kernel.org, edum...@google.com, ido...@nvidia.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, pe...@nvidia.com, syzkall...@googlegroups.com
syzbot has bisected this issue to:

commit 2118f9390d83cf942de8b34faf3d35b54f9f4eee
Author: Petr Machata <pe...@nvidia.com>
Date: Wed Mar 6 12:49:15 2024 +0000

net: nexthop: Adjust netlink policy parsing for a new attribute

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13293b36180000
start commit: d7e14e534493 Merge tag 'mlx5-socket-direct-v3' of git://gi..
git tree: net-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=10a93b36180000
console output: https://syzkaller.appspot.com/x/log.txt?x=17293b36180000
Reported-by: syzbot+65bb09...@syzkaller.appspotmail.com
Fixes: 2118f9390d83 ("net: nexthop: Adjust netlink policy parsing for a new attribute")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

David Ahern

unread,
Mar 10, 2024, 6:37:17 AMMar 10
to Jakub Kicinski, Eric Dumazet, syzbot, Petr Machata, da...@davemloft.net, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
ARRAY_SIZE is sufficient for both tb and parse. That is what the rest of
the file uses.
Reply all
Reply to author
Forward
0 new messages