Subject: general protection fault in cgroup_mt_destroy_v1

From: syzbot <[email-masked]>
Date: Sun, 28 Jan 2018 09:58:02 -0800

Hello,

syzbot hit the following crash on net-next commit
6bb46bc57c8e9ce947cc605e555b7204b44d2b10 (Fri Jan 26 16:00:23 2018 +0000)
Merge branch 'cxgb4-fix-dump-collection-when-firmware-crashed'

So far this crash happened 8 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(1517110122.627:7): avc:  denied  { map } for   
pid=3678 comm="syzkaller656826" path="/root/syzkaller656826707" 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
ipt_CLUSTERIP: Please specify destination IP
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: 1 PID: 3678 Comm: syzkaller656826 Not tainted 4.15.0-rc9+ #212
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:css_put include/linux/cgroup.h:386 [inline]
RIP: 0010:cgroup_put include/linux/cgroup.h:415 [inline]
RIP: 0010:cgroup_mt_destroy_v1+0xcc/0x310 net/netfilter/xt_cgroup.c:102
RSP: 0018:ffff8801d94af848 EFLAGS: 00010203
RAX: dffffc0000000000 RBX: 1ffff1003b295f09 RCX: ffffffff8473cb56
RDX: 000000000000000d RSI: ffffffff8709b4c0 RDI: 000000000000006d
RBP: ffff8801d94af8d0 R08: ffffed003b295f4d R09: 0000000000000000
R10: ffffffff88181ee0 R11: 0000000000000000 R12: 0000000000000001
R13: ffff8801d94af8a8 R14: dffffc0000000000 R15: ffffffff8473caa0
FS:  000000000107c880(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020012fc0 CR3: 00000001ba5ec004 CR4: 00000000001606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  cleanup_match+0x14e/0x220 net/ipv6/netfilter/ip6_tables.c:486
  find_check_entry.isra.8+0x513/0xcb0 net/ipv4/netfilter/ip_tables.c:570
  translate_table+0xed1/0x1610 net/ipv4/netfilter/ip_tables.c:730
  do_replace net/ipv4/netfilter/ip_tables.c:1146 [inline]
  do_ipt_set_ctl+0x370/0x5f0 net/ipv4/netfilter/ip_tables.c:1680
  nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
  nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
  ip_setsockopt+0xa1/0xb0 net/ipv4/ip_sockglue.c:1260
  tcp_setsockopt+0x82/0xd0 net/ipv4/tcp.c:2872
  sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
  SYSC_setsockopt net/socket.c:1849 [inline]
  SyS_setsockopt+0x189/0x360 net/socket.c:1828
  entry_SYSCALL_64_fastpath+0x29/0xa0
RIP: 0033:0x440999
RSP: 002b:00007ffe3e6eb0c8 EFLAGS: 00000203 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 0000000000440999
RDX: 0000000000000040 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006cc018 R08: 0000000000001328 R09: 0000000000000000
R10: 00000000203a2000 R11: 0000000000000203 R12: 00000000004022c0
R13: 0000000000402350 R14: 0000000000000000 R15: 0000000000000000
Code: 02 00 00 4d 8b a4 24 08 10 00 00 4d 85 e4 74 3c e8 8a 68 fc fc 49 8d  
7c 24 6c 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02  
48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85
RIP: css_put include/linux/cgroup.h:386 [inline] RSP: ffff8801d94af848
RIP: cgroup_put include/linux/cgroup.h:415 [inline] RSP: ffff8801d94af848
RIP: cgroup_mt_destroy_v1+0xcc/0x310 net/netfilter/xt_cgroup.c:102 RSP:  
ffff8801d94af848
---[ end trace 9ed0ef16a1d9ee41 ]---
Kernel panic - not syncing: Fatal exception
Dumping ftrace buffer:
    (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

---
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.