KASAN: use-after-free Read in __pagevec_lru_add_fn

23 views
Skip to first unread message

syzbot

unread,
Dec 22, 2017, 4:37:04 PM12/22/17
to ak...@linux-foundation.org, dan.j.w...@intel.com, ja...@suse.cz, jgl...@redhat.com, linux-...@vger.kernel.org, linu...@kvack.org, mgo...@techsingularity.net, mho...@suse.com, sh...@fb.com, syzkall...@googlegroups.com, vba...@suse.cz, ying....@intel.com
Hello,

syzkaller hit the following crash on
e7655085973bd33ee47bb12de663d31c81717404
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.
C reproducer is attached
syzkaller reproducer is attached. See https://goo.gl/kgGztJ
for information about syzkaller reproducers


==================================================================
BUG: KASAN: use-after-free in list_add include/linux/list.h:79 [inline]
BUG: KASAN: use-after-free in add_page_to_lru_list
include/linux/mm_inline.h:51 [inline]
BUG: KASAN: use-after-free in __pagevec_lru_add_fn+0xe49/0xf40 mm/swap.c:896
Read of size 8 at addr ffff8801da2c36d0 by task modprobe/9844

CPU: 1 PID: 9844 Comm: modprobe Not tainted 4.15.0-rc3+ #157
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+0x194/0x257 lib/dump_stack.c:53
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x25b/0x340 mm/kasan/report.c:409
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
list_add include/linux/list.h:79 [inline]
add_page_to_lru_list include/linux/mm_inline.h:51 [inline]
__pagevec_lru_add_fn+0xe49/0xf40 mm/swap.c:896
pagevec_lru_move_fn+0x13b/0x230 mm/swap.c:209
__pagevec_lru_add mm/swap.c:907 [inline]
lru_add_drain_cpu+0x283/0x460 mm/swap.c:609
lru_add_drain+0x1c/0x30 mm/swap.c:680
shift_arg_pages+0x1c3/0x460 fs/exec.c:651
setup_arg_pages+0x637/0x8e0 fs/exec.c:759
load_elf_binary+0xaa6/0x4b50 fs/binfmt_elf.c:882
search_binary_handler+0x142/0x6b0 fs/exec.c:1638
exec_binprm fs/exec.c:1680 [inline]
do_execveat_common.isra.30+0x1754/0x23c0 fs/exec.c:1802
do_execve+0x31/0x40 fs/exec.c:1847
call_usermodehelper_exec_async+0x457/0x8f0 kernel/umh.c:100
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:441

Allocated by task 0:
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
kmem_cache_alloc_node_trace+0x150/0x750 mm/slab.c:3653
kmalloc_node include/linux/slab.h:537 [inline]
kzalloc_node include/linux/slab.h:699 [inline]
alloc_mem_cgroup_per_node_info mm/memcontrol.c:4167 [inline]
mem_cgroup_alloc+0x33e/0x9d0 mm/memcontrol.c:4234
mem_cgroup_css_alloc+0x8ee/0xfe0 mm/memcontrol.c:4271
cgroup_init_subsys+0x224/0x529 kernel/cgroup/cgroup.c:5152
cgroup_init+0x3f3/0xb1b kernel/cgroup/cgroup.c:5278
start_kernel+0x6da/0x754 init/main.c:700
x86_64_start_reservations+0x2a/0x2c arch/x86/kernel/head64.c:378
x86_64_start_kernel+0x77/0x7a arch/x86/kernel/head64.c:359
secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:237

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8801da2c36c0
which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 16 bytes inside of
1024-byte region [ffff8801da2c36c0, ffff8801da2c3ac0)
The buggy address belongs to the page:
page:00000000f329749d count:1 mapcount:0 mapping:000000002e58e71a index:0x0
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801da2c2040 0000000000000000 0000000100000007
raw: ffffea00076c8120 ffffea000768f320 ffff8801db000ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801da2c3580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801da2c3600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801da2c3680: fb fb fb fb fb fb fb fb fb fb fb fb 00 00 00 00
^
ffff8801da2c3700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801da2c3780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
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.
Please credit me with: Reported-by: syzbot <syzk...@googlegroups.com>

syzbot will keep track of this bug report.
Once a fix for this bug is merged into any tree, 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.
config.txt
raw.log
repro.txt
repro.c

Eric Biggers

unread,
Dec 22, 2017, 5:25:46 PM12/22/17
to syzbot, ak...@linux-foundation.org, dan.j.w...@intel.com, ja...@suse.cz, jgl...@redhat.com, linux-...@vger.kernel.org, linu...@kvack.org, mgo...@techsingularity.net, mho...@suse.com, sh...@fb.com, syzkall...@googlegroups.com, vba...@suse.cz, ying....@intel.com
This is yet another one where the reproducer is using AF_ALG and binding to the
"pcrypt(gcm_base(ctr(aes-aesni),ghash-generic))" algorithm, so it's running into
the pcrypt_free() bug which is causing slab cache corruption:

https://groups.google.com/forum/#!topic/syzkaller-bugs/NKn_ivoPOpk

https://patchwork.kernel.org/patch/10126761/

So let's mark it as a duplicate:

#syz dup: KASAN: use-after-free Read in __list_del_entry_valid (2)

Eric
Reply all
Reply to author
Forward
0 new messages