lkml.org 
[lkml]   [2017]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectnet/ipv6: null-ptr-deref in ip6_route_del/lock_acquire
Hi,

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

On commit e5d56efc97f8240d0b5d66c03949382b6d7e5570 (Feb 26).

A reproducer and .config are attached.

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: 0 PID: 4045 Comm: a.out Not tainted 4.10.0+ #54
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff88006b6bac00 task.stack: ffff88006a688000
RIP: 0010:__lock_acquire+0xac4/0x3270 kernel/locking/lockdep.c:3224
RSP: 0018:ffff88006a68f250 EFLAGS: 00010006
RAX: dffffc0000000000 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: 0000000000000006 RSI: 0000000000000000 RDI: 1ffff1000d4d1ea4
RBP: ffff88006a68f788 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000030 R11: 0000000000000000 R12: ffff88006b6bac00
R13: 0000000000000000 R14: ffffffff86e64ec0 R15: 0000000000000001
FS: 00007fda492ff700(0000) GS:ffff88006ca00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000208c4000 CR3: 000000006a7e9000 CR4: 00000000000006f0
Call Trace:
lock_acquire+0x241/0x580 kernel/locking/lockdep.c:3753
__raw_write_lock_bh ./include/linux/rwlock_api_smp.h:203
_raw_write_lock_bh+0x3a/0x50 kernel/locking/spinlock.c:319
__ip6_del_rt_siblings net/ipv6/route.c:2177
ip6_route_del+0x4dd/0xa70 net/ipv6/route.c:2257
ipv6_route_ioctl+0x62d/0x790 net/ipv6/route.c:2620
inet6_ioctl+0xef/0x1e0 net/ipv6/af_inet6.c:520
sock_do_ioctl+0x65/0xb0 net/socket.c:895
sock_ioctl+0x28f/0x440 net/socket.c:993
vfs_ioctl fs/ioctl.c:43
do_vfs_ioctl+0x1bf/0x1780 fs/ioctl.c:683
SYSC_ioctl fs/ioctl.c:698
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:689
entry_SYSCALL_64_fastpath+0x1f/0xc2 arch/x86/entry/entry_64.S:204
RIP: 0033:0x7fda48a10b79
RSP: 002b:00007ffc4988a7b8 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffc4988a910 RCX: 00007fda48a10b79
RDX: 00000000208c4000 RSI: 000000000000890c RDI: 0000000000000003
RBP: 00000000004004a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007ffc4988a910 R14: 0000000000000000 R15: 0000000000000000
Code: e9 03 f3 48 ab 48 81 c4 10 05 00 00 44 89 e8 5b 41 5c 41 5d 41
5e 41 5f 5d c3 4c 89 d2 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80>
3c 02 00 0f 85 07 26 00 00 49 81 3a c0 0a 1d 86 41 bf 00 00
RIP: __lock_acquire+0xac4/0x3270 RSP: ffff88006a68f250
---[ end trace f196d3fa9c5673b5 ]---
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: disabled
---[ end Kernel panic - not syncing: Fatal exception in interrupt
// autogenerated by syzkaller (http://github.com/google/syzkaller)

#ifndef __NR_mmap
#define __NR_mmap 9
#endif
#ifndef __NR_socket
#define __NR_socket 41
#endif
#ifndef __NR_ioctl
#define __NR_ioctl 16
#endif

#define _GNU_SOURCE

#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <linux/capability.h>
#include <linux/if.h>
#include <linux/if_tun.h>
#include <linux/kvm.h>
#include <linux/sched.h>
#include <net/if_arp.h>

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <pthread.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

static uintptr_t execute_syscall(int nr, uintptr_t a0, uintptr_t a1,
uintptr_t a2, uintptr_t a3,
uintptr_t a4, uintptr_t a5,
uintptr_t a6, uintptr_t a7,
uintptr_t a8)
{
switch (nr) {
default:
return syscall(nr, a0, a1, a2, a3, a4, a5);
}
}

long r[3];
int main()
{
memset(r, -1, sizeof(r));
r[0] = execute_syscall(__NR_mmap, 0x20000000ul, 0x8ce000ul, 0x3ul,
0x32ul, 0xfffffffffffffffful, 0x0ul, 0, 0, 0);
r[1] = execute_syscall(__NR_socket, 0xaul, 0x2ul, 0x0ul, 0, 0, 0, 0,
0, 0);
r[2] = execute_syscall(__NR_ioctl, r[1], 0x890cul, 0x208c4000ul, 0, 0,
0, 0, 0, 0);
return 0;
}
[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2017-02-27 19:24    [W:0.079 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site