net/ipv6: GPF in rt6_ifdown

From: Andrey Konovalov
Date: Wed Jun 21 2017 - 08:09:04 EST


Hi,

I've got the following error report while fuzzing the kernel with syzkaller.

On commit 9705596d08ac87c18aee32cc97f2783b7d14624e (4.12-rc6+).

It might be related to:
https://groups.google.com/forum/#!topic/syzkaller/ZJaqAiFLe3k

I only have a reproducer in the form of a syzkaller program, attached
together with my .config.

It can be executed as described here:
https://github.com/google/syzkaller/blob/master/docs/executing_syzkaller_programs.md

With the following flags:
./syz-execprog -repeat=0 -procs=8 -sandbox=namespace ./log

Since I'm able to reproduce it, I can apply debug patches and test
with them if required.

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN
Modules linked in:
CPU: 1 PID: 4499 Comm: syz-executor Not tainted 4.12.0-rc6+ #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff880068e88000 task.stack: ffff88005e0a0000
RIP: 0010:rt6_uncached_list_flush_dev net/ipv6/route.c:167
RIP: 0010:rt6_ifdown+0x3d4/0x910 net/ipv6/route.c:2824
RSP: 0018:ffff88005e0a6e38 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc900029a2000
RDX: 0000000000002dce RSI: ffffffff83ea9ee8 RDI: ffff88006ca25444
RBP: ffff88005e0a6f98 R08: 0000000000000001 R09: c9811a8e00000000
R10: ffff880068e88810 R11: dffffc0000000000 R12: ffff88005e0ad518
R13: ffff88005e0ad500 R14: ffff88006200b300 R15: dffffc0000000000
FS: 00007f4ccaad9700(0000) GS:ffff88006cb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000002000f000 CR3: 00000000672e8000 CR4: 00000000000006e0
Call Trace:
addrconf_ifdown+0x1a8/0x1a30 net/ipv6/addrconf.c:3588
addrconf_notify+0x1cf/0x2630 net/ipv6/addrconf.c:3512
notifier_call_chain+0x14a/0x2e0 kernel/notifier.c:93
__raw_notifier_call_chain kernel/notifier.c:394
raw_notifier_call_chain+0x32/0x40 kernel/notifier.c:401
call_netdevice_notifiers_info+0x56/0x90 net/core/dev.c:1650
call_netdevice_notifiers net/core/dev.c:1666
__dev_notify_flags+0x202/0x330 net/core/dev.c:6647
dev_change_flags+0xfa/0x150 net/core/dev.c:6678
dev_ifsioc+0x62f/0x9f0 net/core/dev_ioctl.c:254
dev_ioctl+0x24e/0x1160 net/core/dev_ioctl.c:532
sock_do_ioctl+0x99/0xb0 net/socket.c:913
sock_ioctl+0x294/0x440 net/socket.c:1004
vfs_ioctl fs/ioctl.c:45
do_vfs_ioctl+0x1c4/0x1660 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700
SyS_ioctl+0x94/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe arch/x86/entry/entry_64.S:203
RIP: 0033:0x446349
RSP: 002b:00007f4ccaad8c08 EFLAGS: 00000282 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000003210 RCX: 0000000000446349
RDX: 00000000208befe0 RSI: 0000000000008914 RDI: 0000000000000018
RBP: 00000000ffffffff R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000282 R12: 0000000000000018
R13: 0000000000003210 R14: 00000000006e42d0 R15: 0000000000008914
Code: 49 8b 9d 58 01 00 00 4c 89 e0 48 c1 e8 03 42 80 3c 38 00 0f 85
6d 04 00 00 49 8b 45 18 48 89 85 f0 fe ff ff 48 89 d8 48 c1 e8 03 <42>
80 3c 38 00 0f 85 5d 04 00 00 4c 3b 33 0f 84 d7 01 00 00 e8
RIP: rt6_ifdown+0x3d4/0x910 RSP: ffff88005e0a6e38
---[ end trace f2e889448df70bb4 ]---
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: disabled
---[ end Kernel panic - not syncing: Fatal exception in interrupt

Attachment: rt6_ifdown-poc-prog
Description: Binary data

Attachment: .config
Description: Binary data