KASAN: use-after-free Write in __get_vm_area_node

8 views
Skip to first unread message

syzbot

unread,
Apr 9, 2018, 10:02:03 AM4/9/18
to syzkaller-upst...@googlegroups.com
Hello,

syzbot hit the following crash on net-next commit
17dec0a949153d9ac00760ba2f5b78cb583e995f (Wed Apr 4 02:15:32 2018 +0000)
Merge branch 'userns-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=c81b83fc8b16ad38fdb9

Unfortunately, I don't have any reproducer for this crash yet.
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5076637578166272
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 8.0.1 20180301 (experimental)
CC: [core...@netfilter.org da...@davemloft.net f...@strlen.de
kad...@blackhole.kfki.hu kuz...@ms2.inr.ac.ru linux-...@vger.kernel.org
net...@vger.kernel.org netfilt...@vger.kernel.org pa...@netfilter.org
yosh...@linux-ipv6.org]

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+c81b83...@syzkaller.appspotmail.com
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.

==================================================================
BUG: KASAN: use-after-free in setup_vmalloc_vm mm/vmalloc.c:1366 [inline]
BUG: KASAN: use-after-free in __get_vm_area_node+0x373/0x390
mm/vmalloc.c:1415
Write of size 8 at addr ffff8801b2b1ea98 by task syz-executor3/4486

CPU: 1 PID: 4486 Comm: syz-executor3 Not tainted 4.16.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b9/0x29f lib/dump_stack.c:53
print_address_description+0x6c/0x20b mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
__asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:438
setup_vmalloc_vm mm/vmalloc.c:1366 [inline]
__get_vm_area_node+0x373/0x390 mm/vmalloc.c:1415
__vmalloc_node_range+0xc4/0x720 mm/vmalloc.c:1754
__vmalloc_node mm/vmalloc.c:1804 [inline]
__vmalloc_node_flags mm/vmalloc.c:1818 [inline]
vzalloc+0x45/0x50 mm/vmalloc.c:1857
alloc_counters.isra.11+0xaf/0x830 net/ipv6/netfilter/ip6_tables.c:818
copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:840 [inline]
get_entries net/ipv6/netfilter/ip6_tables.c:1043 [inline]
do_ip6t_get_ctl+0x7e3/0xc30 net/ipv6/netfilter/ip6_tables.c:1711
nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
nf_getsockopt+0x80/0xe0 net/netfilter/nf_sockopt.c:122
ipv6_getsockopt+0x1d9/0x300 net/ipv6/ipv6_sockglue.c:1370
tcp_getsockopt+0x93/0xe0 net/ipv4/tcp.c:3346
sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:2998
__sys_getsockopt+0x1a5/0x370 net/socket.c:1940
SYSC_getsockopt net/socket.c:1951 [inline]
SyS_getsockopt+0x34/0x50 net/socket.c:1948
do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x457d4a
RSP: 002b:0000000000a3e328 EFLAGS: 00000212 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 0000000000a3e350 RCX: 0000000000457d4a
RDX: 0000000000000041 RSI: 0000000000000029 RDI: 0000000000000013
RBP: 00000000007010a0 R08: 0000000000a3e34c R09: 0000000000004000
R10: 0000000000a3e450 R11: 0000000000000212 R12: 0000000000000000
R13: 0000000000000013 R14: 0000000000000029 R15: 00000000007009e0

Allocated by task 1343:
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:552
kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3608
kmalloc include/linux/slab.h:512 [inline]
kzalloc include/linux/slab.h:701 [inline]
ext4_htree_create_dir_info fs/ext4/dir.c:416 [inline]
ext4_dx_readdir fs/ext4/dir.c:535 [inline]
ext4_readdir+0x2722/0x3bb0 fs/ext4/dir.c:123
iterate_dir+0x4b0/0x5d0 fs/readdir.c:51
SYSC_getdents fs/readdir.c:231 [inline]
SyS_getdents+0x22c/0x450 fs/readdir.c:212
do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 1343:
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
__kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
__cache_free mm/slab.c:3486 [inline]
kfree+0xd9/0x260 mm/slab.c:3801
ext4_htree_free_dir_info fs/ext4/dir.c:427 [inline]
ext4_release_dir+0x4c/0x60 fs/ext4/dir.c:624
__fput+0x34d/0x890 fs/file_table.c:209
____fput+0x15/0x20 fs/file_table.c:243
task_work_run+0x1e4/0x290 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x2bd/0x310 arch/x86/entry/common.c:166
prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
do_syscall_64+0x792/0x9d0 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801b2b1ea80
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 24 bytes inside of
64-byte region [ffff8801b2b1ea80, ffff8801b2b1eac0)
The buggy address belongs to the page:
page:ffffea0006cac780 count:1 mapcount:0 mapping:ffff8801b2b1e000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801b2b1e000 0000000000000000 0000000100000020
raw: ffffea00075b8260 ffffea0007162a20 ffff8801dac00340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801b2b1e980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8801b2b1ea00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
> ffff8801b2b1ea80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff8801b2b1eb00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8801b2b1eb80: fb fb fb fb fb fb fb fb fc fc fc 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.
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
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.
To upstream this report, please reply with:
#syz upstream

Dmitry Vyukov

unread,
May 26, 2018, 1:47:59 PM5/26/18
to syzbot, 'Dmitry Vyukov' via syzkaller-upstream-moderation
On Mon, Apr 9, 2018 at 4:02 PM, syzbot
<syzbot+c81b83...@syzkaller.appspotmail.com> wrote:
> Hello,
>
> syzbot hit the following crash on net-next commit
> 17dec0a949153d9ac00760ba2f5b78cb583e995f (Wed Apr 4 02:15:32 2018 +0000)
> Merge branch 'userns-linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
> syzbot dashboard link:
> https://syzkaller.appspot.com/bug?extid=c81b83fc8b16ad38fdb9
>
> Unfortunately, I don't have any reproducer for this crash yet.
> Raw console output:
> https://syzkaller.appspot.com/x/log.txt?id=5076637578166272
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> compiler: gcc (GCC) 8.0.1 20180301 (experimental)
> CC: [core...@netfilter.org da...@davemloft.net f...@strlen.de
> kad...@blackhole.kfki.hu kuz...@ms2.inr.ac.ru linux-...@vger.kernel.org
> net...@vger.kernel.org netfilt...@vger.kernel.org pa...@netfilter.org
> yosh...@linux-ipv6.org]
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+c81b83...@syzkaller.appspotmail.com
> 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.

This looks like something induced by a previous silent memory
corruption. Happened only once.

#syz invalid
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-upstream-moderation/0000000000009f753c05696ad90b%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages