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

0 views
Skip to first unread message

syzbot

unread,
Sep 30, 2018, 3:14:05 PM9/30/18
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 291d0e5d81e1 Merge tag 'for-linus-20180929' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=101e6259400000
kernel config: https://syzkaller.appspot.com/x/.config?x=a8212f992609a887
dashboard link: https://syzkaller.appspot.com/bug?extid=ab85197cf31762f0f21d
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
userspace arch: i386
CC: [jmo...@namei.org john.j...@canonical.com
linux-...@vger.kernel.org linux-secu...@vger.kernel.org
se...@hallyn.com]

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+ab8519...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in memcmp+0xe3/0x160 lib/string.c:861
Read of size 1 at addr ffff8801cf7698c0 by task syz-executor3/13552

CPU: 1 PID: 13552 Comm: syz-executor3 Not tainted 4.19.0-rc5+ #164
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+0x1c4/0x2b4 lib/dump_stack.c:113
print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
memcmp+0xe3/0x160 lib/string.c:861
strnstr+0x4b/0x70 lib/string.c:934
__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:1298
proc_pid_attr_write+0x301/0x540 fs/proc/base.c:2555
__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:0xf7f52ca9
Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 0c 24 c3 8b 1c 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:00000000f5f4e0cc EFLAGS: 00000296 ORIG_RAX: 0000000000000004
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000200000c0
RDX: 00000000200000ec 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 13551:
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:157 [inline]
dup_task_struct kernel/fork.c:802 [inline]
copy_process+0x1ff4/0x8780 kernel/fork.c:1707
_do_fork+0x1cb/0x11d0 kernel/fork.c:2166
__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:406

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8801cf768100
which belongs to the cache task_struct(65:syz3) of size 6080
The buggy address is located 0 bytes to the right of
6080-byte region [ffff8801cf768100, ffff8801cf7698c0)
The buggy address belongs to the page:
page:ffffea00073dda00 count:1 mapcount:0 mapping:ffff8801c6c8d080 index:0x0
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea00075d1988 ffff8801cc24b648 ffff8801c6c8d080
raw: 0000000000000000 ffff8801cf768100 0000000100000001 ffff8801c7f921c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801c7f921c0

Memory state around the buggy address:
ffff8801cf769780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801cf769800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff8801cf769880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff8801cf769900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801cf769980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
syzbot.

Dmitry Vyukov

unread,
Oct 1, 2018, 2:54:15 AM10/1/18
to syzbot, 'Dmitry Vyukov' via syzkaller-upstream-moderation
#syz dup: KASAN: stack-out-of-bounds Read in __aa_lookupn_ns
> --
> 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/000000000000f407dc05771b7d9b%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages