syzbot


KASAN: use-after-free Read in __pagevec_lru_add_fn

Status: closed as dup on 2017/12/22 22:25
Reported-by: syzbot+39ea44e86d4b505fce2a77c845b7979cffd9bc07@syzkaller.appspotmail.com
First crash: 1817d, last: 1817d
Duplicate of (1):
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: use-after-free Read in __list_del_entry_valid (2) C 11 1816d 1817d

Sample crash report:
==================================================================
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
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-net-kasan-gce 2017/12/18 18:58 net-next e7655085973b 1c4160ef .config log report syz C
* Struck through repros no longer work on HEAD.