[Android 5.15] KASAN: slab-out-of-bounds Read in l2cap_sock_setsockopt

0 views
Skip to first unread message

syzbot

unread,
7:28 AM (8 hours ago) 7:28 AM
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 050dc55b0457 Revert "net/sched: act_connmark: handle errno..
git tree: android13-5.15-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=1386659a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7c25e09ce0f4abfd
dashboard link: https://syzkaller.appspot.com/bug?extid=d9c81a0b02cc40bcc07c
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=119d859a580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13ef0522580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/45501ad7c8cb/disk-050dc55b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/008893f41078/vmlinux-050dc55b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3c805ce08e8e/bzImage-050dc55b.xz

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

==================================================================
BUG: KASAN: slab-out-of-bounds in copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
BUG: KASAN: slab-out-of-bounds in copy_from_sockptr include/linux/sockptr.h:55 [inline]
BUG: KASAN: slab-out-of-bounds in l2cap_sock_setsockopt+0x1b8e/0x1f60 net/bluetooth/l2cap_sock.c:996
Read of size 4 at addr ffff88810f02dc5b by task syz.2.17/373

CPU: 0 PID: 373 Comm: syz.2.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
<TASK>
__dump_stack+0x21/0x30 lib/dump_stack.c:88
dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:427 [inline]
kasan_report+0xf1/0x140 mm/kasan/report.c:444
__asan_report_load_n_noabort+0xf/0x20 mm/kasan/report_generic.c:319
copy_from_sockptr_offset include/linux/sockptr.h:49 [inline]
copy_from_sockptr include/linux/sockptr.h:55 [inline]
l2cap_sock_setsockopt+0x1b8e/0x1f60 net/bluetooth/l2cap_sock.c:996
__sys_setsockopt+0x2f0/0x460 net/socket.c:2203
__do_sys_setsockopt net/socket.c:2214 [inline]
__se_sys_setsockopt net/socket.c:2211 [inline]
__x64_sys_setsockopt+0xbf/0xd0 net/socket.c:2211
x64_sys_call+0x982/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:55
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fc31a8c5749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc6e63fe98 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007fc31ab1bfa0 RCX: 00007fc31a8c5749
RDX: 0000000000000008 RSI: 0000000000000112 RDI: 0000000000000004
RBP: 00007fc31a949f91 R08: 0000000000000001 R09: 0000000000000000
R10: 0000200000000040 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc31ab1bfa0 R14: 00007fc31ab1bfa0 R15: 0000000000000005
</TASK>

Allocated by task 373:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:433 [inline]
____kasan_kmalloc mm/kasan/common.c:512 [inline]
__kasan_kmalloc+0xda/0x110 mm/kasan/common.c:521
kasan_kmalloc include/linux/kasan.h:227 [inline]
__kmalloc+0x13d/0x2c0 mm/slub.c:4436
kmalloc include/linux/slab.h:624 [inline]
__cgroup_bpf_run_filter_setsockopt+0x891/0xa40 kernel/bpf/cgroup.c:1511
__sys_setsockopt+0x413/0x460 net/socket.c:2186
__do_sys_setsockopt net/socket.c:2214 [inline]
__se_sys_setsockopt net/socket.c:2211 [inline]
__x64_sys_setsockopt+0xbf/0xd0 net/socket.c:2211
x64_sys_call+0x982/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:55
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88810f02dc58
which belongs to the cache kmalloc-8 of size 8
The buggy address is located 3 bytes inside of
8-byte region [ffff88810f02dc58, ffff88810f02dc60)
The buggy address belongs to the page:
page:ffffea00043c0b40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10f02d
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea00043202c0 0000000200000002 ffff888100042300
raw: 0000000000000000 0000000080660066 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 102, ts 5414180402, free_ts 5414145527
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
__alloc_pages+0x18f/0x440 mm/page_alloc.c:5808
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1937 [inline]
new_slab+0xa1/0x4d0 mm/slub.c:2000
___slab_alloc+0x381/0x810 mm/slub.c:3033
__slab_alloc+0x49/0x90 mm/slub.c:3120
slab_alloc_node mm/slub.c:3211 [inline]
slab_alloc mm/slub.c:3255 [inline]
__kmalloc+0x16a/0x2c0 mm/slub.c:4432
kmalloc include/linux/slab.h:624 [inline]
kernfs_fop_write_iter+0x156/0x400 fs/kernfs/file.c:273
call_write_iter include/linux/fs.h:2212 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x802/0xf70 fs/read_write.c:594
ksys_write+0x140/0x240 fs/read_write.c:647
__do_sys_write fs/read_write.c:659 [inline]
__se_sys_write fs/read_write.c:656 [inline]
__x64_sys_write+0x7b/0x90 fs/read_write.c:656
x64_sys_call+0x8ef/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1472 [inline]
free_pcp_prepare mm/page_alloc.c:1544 [inline]
free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534
free_unref_page+0xa2/0x550 mm/page_alloc.c:3616
free_the_page mm/page_alloc.c:805 [inline]
__free_pages+0x6c/0x100 mm/page_alloc.c:5884
free_pages+0x82/0x90 mm/page_alloc.c:5895
selinux_genfs_get_sid+0x20b/0x250 security/selinux/hooks.c:1381
inode_doinit_with_dentry+0x86e/0xd70 security/selinux/hooks.c:1576
selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6495
security_d_instantiate+0x9e/0xf0 security/security.c:2074
d_splice_alias+0x6d/0x390 fs/dcache.c:3073
kernfs_iop_lookup+0x2c2/0x310 fs/kernfs/dir.c:1175
lookup_open fs/namei.c:3448 [inline]
open_last_lookups fs/namei.c:3540 [inline]
path_openat+0xfcf/0x2f10 fs/namei.c:3747
do_filp_open+0x1b3/0x3e0 fs/namei.c:3777
do_sys_openat2+0x14c/0x7b0 fs/open.c:1236
do_sys_open fs/open.c:1252 [inline]
__do_sys_openat fs/open.c:1268 [inline]
__se_sys_openat fs/open.c:1263 [inline]
__x64_sys_openat+0x136/0x160 fs/open.c:1263
x64_sys_call+0x219/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80

Memory state around the buggy address:
ffff88810f02db00: fc fc fc 05 fc fc fc fc 05 fc fc fc fc fa fc fc
ffff88810f02db80: fc fc fa fc fc fc fc fa fc fc fc fc fb fc fc fc
>ffff88810f02dc00: fc fa fc fc fc fc 05 fc fc fc fc 01 fc fc fc fc
^
ffff88810f02dc80: fa fc fc fc fc 05 fc fc fc fc 05 fc fc fc fc fb
ffff88810f02dd00: fc fc fc fc 05 fc fc fc fc 05 fc fc fc fc 04 fc
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages