================================================================== BUG: KASAN: slab-out-of-bounds in smk_access+0xae/0x4e0 security/smack/smack_access.c:147 Read of size 8 at addr ffff88807b66c560 by task syz.0.354/6855 CPU: 0 UID: 3327 PID: 6855 Comm: syz.0.354 Not tainted 6.11.0-syzkaller-04744-gbdf56c7580d2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 smk_access+0xae/0x4e0 security/smack/smack_access.c:147 smack_watch_key+0x2f4/0x3a0 security/smack/smack_lsm.c:4656 security_watch_key+0x86/0x250 security/security.c:4448 keyctl_watch_key+0x2b7/0x480 security/keys/keyctl.c:1813 __do_sys_keyctl security/keys/keyctl.c:2021 [inline] __se_sys_keyctl+0x106/0xa50 security/keys/keyctl.c:1874 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fcef2d7def9 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:00007fcef3c07038 EFLAGS: 00000246 ORIG_RAX: 00000000000000fa RAX: ffffffffffffffda RBX: 00007fcef2f35f80 RCX: 00007fcef2d7def9 RDX: 0000000000000008 RSI: 000000002749020c RDI: 0000000000000020 RBP: 00007fcef2df0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fcef2f35f80 R15: 00007ffd09b74098 Allocated by task 6855: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4265 [inline] __kmalloc_node_track_caller_noprof+0x225/0x440 mm/slub.c:4284 kmemdup_noprof+0x2a/0x60 mm/util.c:133 key_alloc+0x388/0xff0 security/keys/key.c:282 construct_alloc_key security/keys/request_key.c:395 [inline] construct_key_and_link security/keys/request_key.c:515 [inline] request_key_and_link+0xace/0x19c0 security/keys/request_key.c:653 __do_sys_request_key security/keys/keyctl.c:222 [inline] __se_sys_request_key+0x271/0x3b0 security/keys/keyctl.c:167 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88807b66c560 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of allocated 6-byte region [ffff88807b66c560, ffff88807b66c566) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b66c anon flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff88801ac41500 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000800080 00000001fdffffff 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 0x152cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 6076, tgid 6074 (syz.0.232), ts 148471580372, free_ts 147982106180 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3446 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4702 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263 alloc_slab_page+0x6a/0x130 mm/slub.c:2413 allocate_slab+0x5a/0x2f0 mm/slub.c:2579 new_slab mm/slub.c:2632 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3819 __slab_alloc+0x58/0xa0 mm/slub.c:3909 __slab_alloc_node mm/slub.c:3962 [inline] slab_alloc_node mm/slub.c:4123 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_node_track_caller_noprof+0x281/0x440 mm/slub.c:4284 memdup_user+0x2b/0xc0 mm/util.c:226 raw_alloc_io_data drivers/usb/gadget/legacy/raw_gadget.c:673 [inline] raw_ioctl_ep0_write drivers/usb/gadget/legacy/raw_gadget.c:763 [inline] raw_ioctl+0x1f00/0x3cd0 drivers/usb/gadget/legacy/raw_gadget.c:1312 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 4672 tgid 4672 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0xd19/0xea0 mm/page_alloc.c:2619 discard_slab mm/slub.c:2678 [inline] __put_partials+0xeb/0x130 mm/slub.c:3146 put_cpu_partial+0x17c/0x250 mm/slub.c:3221 __slab_free+0x2ea/0x3d0 mm/slub.c:4450 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4086 [inline] slab_alloc_node mm/slub.c:4135 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1a6/0x400 mm/slub.c:4277 kmalloc_noprof include/linux/slab.h:882 [inline] tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x2b7/0x740 security/tomoyo/file.c:822 security_inode_getattr+0x130/0x330 security/security.c:2371 vfs_getattr+0x45/0x430 fs/stat.c:204 vfs_fstat fs/stat.c:229 [inline] vfs_fstatat+0xe4/0x190 fs/stat.c:338 __do_sys_newfstatat fs/stat.c:505 [inline] __se_sys_newfstatat fs/stat.c:499 [inline] __x64_sys_newfstatat+0x11d/0x1a0 fs/stat.c:499 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88807b66c400: fa fc fc fc fa fc fc fc 04 fc fc fc fa fc fc fc ffff88807b66c480: fa fc fc fc 04 fc fc fc fa fc fc fc 05 fc fc fc >ffff88807b66c500: 05 fc fc fc fa fc fc fc 00 fc fc fc 06 fc fc fc ^ ffff88807b66c580: 01 fc fc fc 02 fc fc fc 00 fc fc fc 02 fc fc fc ffff88807b66c600: 05 fc fc fc fa fc fc fc fa fc fc fc 06 fc fc fc ==================================================================