Re: net: heap out-of-bounds in fib6_clean_node/rt6_fill_node/fib6_age/fib6_prune_clone

From: Andrey Konovalov
Date: Thu Apr 20 2017 - 11:29:37 EST


On Thu, Apr 20, 2017 at 5:28 PM, Andrey Konovalov <andreyknvl@xxxxxxxxxx> wrote:
> I've extracted a reproducer for another bug.

It works for me as is, but you might need to run it in a loop.

>
> This one seems to be much closer to what Dmitry reported intially.
>
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 3892 at net/ipv6/ip6_fib.c:1472 fib6_del+0xa60/0xdc0
> Modules linked in:
> CPU: 1 PID: 3892 Comm: a.out Not tainted 4.11.0-rc7+ #251
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:16
> dump_stack+0x292/0x398 lib/dump_stack.c:52
> __warn+0x19f/0x1e0 kernel/panic.c:549
> warn_slowpath_null+0x2c/0x40 kernel/panic.c:584
> fib6_del+0xa60/0xdc0 net/ipv6/ip6_fib.c:1472
> fib6_clean_node+0x3ce/0x550 net/ipv6/ip6_fib.c:1652
> fib6_walk_continue+0x577/0x760 net/ipv6/ip6_fib.c:1578
> fib6_walk+0x91/0xf0 net/ipv6/ip6_fib.c:1623
> fib6_clean_tree+0x266/0x3c0 net/ipv6/ip6_fib.c:1695
> __fib6_clean_all+0x1f7/0x3b0 net/ipv6/ip6_fib.c:1711
> fib6_clean_all+0x27/0x30 net/ipv6/ip6_fib.c:1722
> rt6_ifdown+0xf7/0x910 net/ipv6/route.c:2820
> addrconf_ifdown+0x1a3/0x1aa0 net/ipv6/addrconf.c:3541
> addrconf_notify+0x1bb/0x2570 net/ipv6/addrconf.c:3466
> notifier_call_chain+0x145/0x2f0 kernel/notifier.c:93
> __raw_notifier_call_chain kernel/notifier.c:394
> raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
> call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1647
> call_netdevice_notifiers net/core/dev.c:1663
> __dev_notify_flags+0x1fd/0x320 net/core/dev.c:6499
> dev_change_flags+0xf5/0x140 net/core/dev.c:6530
> dev_ifsioc+0x62a/0x9f0 net/core/dev_ioctl.c:254
> dev_ioctl+0x249/0x1160 net/core/dev_ioctl.c:532
> sock_do_ioctl+0x94/0xb0 net/socket.c:913
> sock_ioctl+0x28f/0x440 net/socket.c:1004
> vfs_ioctl fs/ioctl.c:45
> do_vfs_ioctl+0x1bf/0x1780 fs/ioctl.c:685
> SYSC_ioctl fs/ioctl.c:700
> SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
> entry_SYSCALL_64_fastpath+0x1f/0xc2 arch/x86/entry/entry_64.S:204
> RIP: 0033:0x7f575ded4347
> RSP: 002b:00007fffc94d9948 EFLAGS: 00000217 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00007fffc94d9b30 RCX: 00007f575ded4347
> RDX: 00007fffc94d9980 RSI: 0000000000008914 RDI: 0000000000000006
> RBP: 00000000004004e0 R08: 0000000000000028 R09: 0101010101010101
> R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000000000
> R13: 00007fffc94d9b30 R14: 0000000000000000 R15: 0000000000000000
> ---[ end trace 9bda4459ad907043 ]---