KASAN: use-after-free Read in __queue_work

4 views
Skip to first unread message

syzbot

unread,
Oct 27, 2017, 4:41:05 AM10/27/17
to syzkaller-upst...@googlegroups.com
Hello,

syzkaller hit the following crash on
720bbe532b7c8f5613b48dea627fc58ed9ace707
git://git.cmpxchg.org/linux-mmots.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

syzkaller reproducer is attached. See https://goo.gl/kgGztJ
for information about syzkaller reproducers
CC: [jiangs...@gmail.com linux-...@vger.kernel.org t...@kernel.org]

BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:276
[inline]
BUG: KASAN: use-after-free in list_empty include/linux/list.h:202 [inline]
BUG: KASAN: use-after-free in __queue_work+0x1029/0x1150
kernel/workqueue.c:1442
Read of size 8 at addr ffff8801d0ac0d00 by task syz-executor3/12844

CPU: 1 PID: 12844 Comm: syz-executor3 Not tainted 4.13.0-mm1+ #7
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x24e/0x340 mm/kasan/report.c:409
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
__read_once_size include/linux/compiler.h:276 [inline]
list_empty include/linux/list.h:202 [inline]
__queue_work+0x1029/0x1150 kernel/workqueue.c:1442
queue_work_on+0x16a/0x1c0 kernel/workqueue.c:1486
queue_work include/linux/workqueue.h:489 [inline]
strp_check_rcv+0x25/0x30 net/strparser/strparser.c:553
kcm_attach net/kcm/kcmsock.c:1439 [inline]
kcm_attach_ioctl net/kcm/kcmsock.c:1460 [inline]
kcm_ioctl+0x826/0x1610 net/kcm/kcmsock.c:1695
sock_do_ioctl+0x65/0xb0 net/socket.c:961
sock_ioctl+0x2c2/0x440 net/socket.c:1058
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x4520a9
RSP: 002b:00007f03b7352c08 EFLAGS: 00000216 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000007180b0 RCX: 00000000004520a9
RDX: 00000000209b9000 RSI: 00000000000089e0 RDI: 000000000000000a
RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000216 R12: 00000000004b73ea
R13: 00000000ffffffff R14: 0000000000000005 R15: 0000000020b4cfd0

Allocated by task 12844:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc+0x12e/0x760 mm/slab.c:3561
kmem_cache_zalloc include/linux/slab.h:656 [inline]
kcm_attach net/kcm/kcmsock.c:1394 [inline]
kcm_attach_ioctl net/kcm/kcmsock.c:1460 [inline]
kcm_ioctl+0x2d1/0x1610 net/kcm/kcmsock.c:1695
sock_do_ioctl+0x65/0xb0 net/socket.c:961
sock_ioctl+0x2c2/0x440 net/socket.c:1058
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 12852:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x77/0x280 mm/slab.c:3763
kcm_unattach+0xe50/0x1510 net/kcm/kcmsock.c:1563
kcm_unattach_ioctl net/kcm/kcmsock.c:1608 [inline]
kcm_ioctl+0xdf0/0x1610 net/kcm/kcmsock.c:1705
sock_do_ioctl+0x65/0xb0 net/socket.c:961
sock_ioctl+0x2c2/0x440 net/socket.c:1058
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe

The buggy address belongs to the object at ffff8801d0ac0bc0
which belongs to the cache kcm_psock_cache of size 664
The buggy address is located 320 bytes inside of
664-byte region [ffff8801d0ac0bc0, ffff8801d0ac0e58)
The buggy address belongs to the page:
page:ffffea000742b000 count:1 mapcount:0 mapping:ffff8801d0ac0200 index:0x0
compound_mapcount: 0
flags: 0x200000000008100(slab|head)
raw: 0200000000008100 ffff8801d0ac0200 0000000000000000 0000000100000009
raw: ffffea000743da20 ffffea0007420620 ffff8801d2e2f680 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801d0ac0c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801d0ac0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801d0ac0d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801d0ac0d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801d0ac0e00: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.

syzbot will keep track of this bug report.
Once a fix for this bug is committed, please reply to this email with:
#syz fix: exact-commit-title
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.
To upstream this report, please reply with:
#syz upstream
config.txt
raw.log
repro.txt

Dmitry Vyukov

unread,
Oct 27, 2017, 5:34:31 AM10/27/17
to syzbot, 'Dmitry Vyukov' via syzkaller-upstream-moderation
I was not able to reproduce this on current HEAD, and this happened only twice.

#syz invalid

On Fri, Oct 27, 2017 at 10:41 AM, syzbot
<bot+caa569914000a7e8ee...@syzkaller.appspotmail.com>
wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-upstream-moderation" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-upstream-m...@googlegroups.com.
> To post to this group, send email to
> syzkaller-upst...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-upstream-moderation/001a114a938ad06203055c833f5e%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages