Subject: general protection fault in ip6t_do_table

From: syzbot <[email-masked]>
Date: Sat, 27 Jan 2018 12:58:01 -0800

Hello,

syzbot hit the following crash on upstream commit
c4e0ca7fa24137e372d6135fe16e8df8e123f116 (Fri Jan 26 23:10:50 2018 +0000)
Merge tag 'riscv-for-linus-4.15-maintainers' of  
git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux

So far this crash happened 51 times on net-next, upstream.
C reproducer is attached.
syzkaller reproducer is attached.
Raw console output is attached.
compiler: gcc (GCC) 7.1.1 20170620
.config is attached.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: [email-masked]
It will help syzbot understand when the bug is fixed. See footer for  
details.
If you forward the report, please keep this part and the footer.

audit: type=1400 audit(1517077898.998:7): avc:  denied  { map } for   
pid=3675 comm="syzkaller168273" path="/root/syzkaller168273484" dev="sda1"  
ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023  
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
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
Dumping ftrace buffer:
    (ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 3675 Comm: syzkaller168273 Not tainted 4.15.0-rc9+ #283
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:ip6t_do_table+0x12de/0x19d0 net/ipv6/netfilter/ip6_tables.c:360
RSP: 0018:ffff8801db206c58 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8801d9aafb80 RCX: ffffffff84d30352
RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff8801d9aafcde
RBP: ffff8801db206e60 R08: 1ffff1003b640d54 R09: 0000000000000000
R10: 00000000000000d0 R11: 0000000000000000 R12: 0000000000000001
R13: 0000000000000000 R14: dffffc0000000000 R15: ffff8801d9aafc50
FS:  0000000000a5d880(0000) GS:ffff8801db200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000209f1000 CR3: 00000001bc9f8001 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  <IRQ>
  ip6table_security_hook+0x65/0x80 net/ipv6/netfilter/ip6table_security.c:45
  nf_hook_entry_hookfn include/linux/netfilter.h:108 [inline]
  nf_hook_slow+0xba/0x1a0 net/netfilter/core.c:467
  nf_hook include/linux/netfilter.h:205 [inline]
  NF_HOOK include/linux/netfilter.h:248 [inline]
  ip6_input+0x368/0x560 net/ipv6/ip6_input.c:327
  dst_input include/net/dst.h:466 [inline]
  ip6_rcv_finish+0x297/0x8c0 net/ipv6/ip6_input.c:71
  NF_HOOK include/linux/netfilter.h:250 [inline]
  ipv6_rcv+0xf37/0x1fa0 net/ipv6/ip6_input.c:208
  __netif_receive_skb_core+0x1a41/0x3460 net/core/dev.c:4484
  __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4549
  process_backlog+0x203/0x740 net/core/dev.c:5228
  napi_poll net/core/dev.c:5626 [inline]
  net_rx_action+0x792/0x1910 net/core/dev.c:5692
  __do_softirq+0x2d7/0xb85 kernel/softirq.c:285
  do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1150
  </IRQ>
  do_softirq.part.19+0x14d/0x190 kernel/softirq.c:329
  do_softirq kernel/softirq.c:177 [inline]
  __local_bh_enable_ip+0x1ee/0x230 kernel/softirq.c:182
  local_bh_enable include/linux/bottom_half.h:32 [inline]
  rcu_read_unlock_bh include/linux/rcupdate.h:727 [inline]
  ip6_finish_output2+0xba6/0x23a0 net/ipv6/ip6_output.c:121
  ip6_finish_output+0x302/0x930 net/ipv6/ip6_output.c:146
  NF_HOOK_COND include/linux/netfilter.h:239 [inline]
  ip6_output+0x1eb/0x840 net/ipv6/ip6_output.c:163
  dst_output include/net/dst.h:460 [inline]
  NF_HOOK include/linux/netfilter.h:250 [inline]
  ip6_xmit+0xe1f/0x2260 net/ipv6/ip6_output.c:269
  sctp_v6_xmit+0x438/0x630 net/sctp/ipv6.c:225
  sctp_packet_transmit+0x2270/0x3760 net/sctp/output.c:637
  sctp_outq_flush+0xab6/0x4060 net/sctp/outqueue.c:913
  sctp_outq_uncork+0x5a/0x70 net/sctp/outqueue.c:778
  sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1822 [inline]
  sctp_side_effects net/sctp/sm_sideeffect.c:1222 [inline]
  sctp_do_sm+0x50e/0x6a20 net/sctp/sm_sideeffect.c:1193
  sctp_primitive_ASSOCIATE+0x9d/0xd0 net/sctp/primitive.c:88
  sctp_sendmsg+0x13c3/0x3420 net/sctp/socket.c:2005
  inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:763
  sock_sendmsg_nosec net/socket.c:638 [inline]
  sock_sendmsg+0xca/0x110 net/socket.c:648
  SYSC_sendto+0x361/0x5c0 net/socket.c:1729
  SyS_sendto+0x40/0x50 net/socket.c:1697
  entry_SYSCALL_64_fastpath+0x29/0xa0
RIP: 0033:0x441489
RSP: 002b:00007ffcade3b008 EFLAGS: 00000203 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 0000000000441489
RDX: 0000000000000001 RSI: 00000000209f1000 RDI: 0000000000000005
RBP: 00000000006cb018 R08: 0000000020108fe4 R09: 000000000000001c
R10: 0000000000000000 R11: 0000000000000203 R12: 0000000000402db0
R13: 0000000000402e40 R14: 0000000000000000 R15: 0000000000000000
Code: 41 f6 87 83 00 00 00 04 75 37 e8 1e 28 9d fc 8b 85 54 fe ff ff 48 8b  
b5 90 fe ff ff 4c 8d 2c c6 44 8d 60 01 4c 89 e8 48 c1 e8 03 <42> 80 3c 30  
00 0f 85 5c 03 00 00 4d 89 7d 00 44 89 a5 54 fe ff
RIP: ip6t_do_table+0x12de/0x19d0 net/ipv6/netfilter/ip6_tables.c:360 RSP:  
ffff8801db206c58
---[ end trace 55a17899f19a20e3 ]---

---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to [email-masked].

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is  
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.