syzbot


KASAN: slab-out-of-bounds Read in __aa_lookupn_ns

Status: closed as dup on 2018/10/01 06:54
Subsystems: apparmor
[Documentation on labels]
Reported-by: syzbot+ab85197cf31762f0f21d@syzkaller.appspotmail.com
First crash: 2246d, last: 2212d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: stack-out-of-bounds Read in __aa_lookupn_ns apparmor C 52 2219d 2250d

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcmp+0xe3/0x160 lib/string.c:862
Read of size 1 at addr ffff8801c0b07c00 by task syz-executor5/31755

CPU: 0 PID: 31755 Comm: syz-executor5 Not tainted 4.19.0+ #219
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x244/0x39d lib/dump_stack.c:113
 print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 memcmp+0xe3/0x160 lib/string.c:862
 strnstr+0x4b/0x70 lib/string.c:935
 __aa_lookupn_ns+0xc1/0x570 security/apparmor/policy_ns.c:209
 aa_lookupn_ns+0x88/0x1e0 security/apparmor/policy_ns.c:240
 aa_fqlookupn_profile+0x1b9/0x1010 security/apparmor/policy.c:468
 fqlookupn_profile+0x80/0xc0 security/apparmor/label.c:1844
 aa_label_strn_parse+0xa3a/0x1230 security/apparmor/label.c:1908
 aa_label_parse+0x42/0x50 security/apparmor/label.c:1943
 aa_change_profile+0x513/0x3260 security/apparmor/domain.c:1362
 apparmor_setprocattr+0xa8b/0x1150 security/apparmor/lsm.c:656
 security_setprocattr+0x66/0xc0 security/security.c:1309
 proc_pid_attr_write+0x301/0x540 fs/proc/base.c:2569
 __vfs_write+0x119/0x9f0 fs/read_write.c:485
 vfs_write+0x1fc/0x560 fs/read_write.c:549
 ksys_write+0x101/0x260 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __ia32_sys_write+0x71/0xb0 fs/read_write.c:607
 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline]
 do_fast_syscall_32+0x34d/0xfb2 arch/x86/entry/common.c:397
 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
RIP: 0023:0xf7f5da29
Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 14 24 c3 8b 3c 24 c3 90 90 90 90 90 90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 002b:00000000f5f590cc EFLAGS: 00000296 ORIG_RAX: 0000000000000004
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000020000000
RDX: 0000000000000008 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 31754:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc_node+0x144/0x730 mm/slab.c:3644
 alloc_task_struct_node kernel/fork.c:158 [inline]
 dup_task_struct kernel/fork.c:843 [inline]
 copy_process+0x2026/0x87a0 kernel/fork.c:1751
 _do_fork+0x1cb/0x11d0 kernel/fork.c:2216
 __do_compat_sys_x86_clone arch/x86/ia32/sys_ia32.c:240 [inline]
 __se_compat_sys_x86_clone arch/x86/ia32/sys_ia32.c:236 [inline]
 __ia32_compat_sys_x86_clone+0xbc/0x140 arch/x86/ia32/sys_ia32.c:236
 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline]
 do_int80_syscall_32+0x1fe/0x890 arch/x86/entry/common.c:349
 entry_INT80_compat+0x74/0x7e arch/x86/entry/entry_64_compat.S:411

Freed by task 9:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x83/0x290 mm/slab.c:3760
 free_task_struct kernel/fork.c:163 [inline]
 free_task+0x16e/0x1f0 kernel/fork.c:457
 __put_task_struct+0x2e6/0x620 kernel/fork.c:730
 put_task_struct include/linux/sched/task.h:96 [inline]
 delayed_put_task_struct+0x2ff/0x4c0 kernel/exit.c:181
 __rcu_reclaim kernel/rcu/rcu.h:240 [inline]
 rcu_do_batch kernel/rcu/tree.c:2437 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2716 [inline]
 rcu_process_callbacks+0x100a/0x1ac0 kernel/rcu/tree.c:2697
 __do_softirq+0x308/0xb7e kernel/softirq.c:292

The buggy address belongs to the object at ffff8801c0b06440
 which belongs to the cache task_struct(97:syz5) of size 6080
The buggy address is located 0 bytes to the right of
 6080-byte region [ffff8801c0b06440, ffff8801c0b07c00)
The buggy address belongs to the page:
page:ffffea000702c180 count:1 mapcount:0 mapping:ffff8801b8438980 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000010200(slab|head)
raw: 02fffc0000010200 ffffea00063e1908 ffffea00062d9508 ffff8801b8438980
raw: 0000000000000000 ffff8801c0b06440 0000000100000001 ffff880190fca440
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff880190fca440

Memory state around the buggy address:
 ffff8801c0b07b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801c0b07b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8801c0b07c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8801c0b07c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801c0b07d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/11/03 06:08 upstream 8adcc59974b8 8bd6bd63 .config console log report ci-upstream-kasan-gce-386
2018/09/30 16:09 upstream 291d0e5d81e1 41e4b329 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.