KASAN: slab-use-after-free Read in em28xx_init_extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!
I found a potential bug titled "KASAN: slab-use-after-free Read in
em28xx_init_extension"
This bug may be related to the previous bugs but new modules are in the traces,
such as security/tomoyo. Unfortunately, I didn't get the repro from syzkaller.

Similar reports & bugs:
1. https://groups.google.com/g/syzkaller-bugs/c/3Cmf7yuRTo8/m/XiHMsxW6BAAJ
2. https://groups.google.com/g/syzkaller-bugs/c/xJlNyYnPiYI/m/tboOjArwBAAJ
3. https://groups.google.com/g/syzkaller-bugs/c/gPfdAdmsuhc/m/mpnerq76AQAJ

kernel version: v6.8
kernel config: attachment
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

If you fix this issue, please add the following tag to the commit:
Reported-by: Shichao Lai <shichaorai@xxxxxxxxx>
Thanks!

==================================================================
BUG: KASAN: slab-use-after-free in
__list_add_valid_or_report+0xe3/0x100 lib/list_debug.c:32
Read of size 8 at addr ffff888111948250 by task kworker/0:4/4049

CPU: 0 PID: 4049 Comm: kworker/0:4 Not tainted 6.8.0 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
Workqueue: events request_module_async
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc1/0x5e0 mm/kasan/report.c:488
 kasan_report+0xbe/0xf0 mm/kasan/report.c:601
 __list_add_valid_or_report+0xe3/0x100 lib/list_debug.c:32
 __list_add_valid include/linux/list.h:88 [inline]
 __list_add include/linux/list.h:150 [inline]
 list_add_tail include/linux/list.h:183 [inline]
 em28xx_init_extension+0x48/0x1f0 drivers/media/usb/em28xx/em28xx-core.c:1113
 request_module_async+0x61/0x70 drivers/media/usb/em28xx/em28xx-cards.c:3405
 process_one_work+0x878/0x15c0 kernel/workqueue.c:2633
 process_scheduled_works kernel/workqueue.c:2706 [inline]
 worker_thread+0x855/0x1200 kernel/workqueue.c:2787
 kthread+0x2cc/0x3b0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:243
 </TASK>

Allocated by task 2395:
 kasan_save_stack+0x24/0x40 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0x7b/0x90 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slub.c:3981 [inline]
 __kmalloc+0x1f0/0x440 mm/slub.c:3994
 kmalloc include/linux/slab.h:594 [inline]
 tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x290/0x3a0 security/tomoyo/file.c:771
 tomoyo_file_open+0x6f/0x90 security/tomoyo/tomoyo.c:334
 security_file_open+0x49/0xa0 security/security.c:2933
 do_dentry_open+0x576/0x16f0 fs/open.c:940
 do_open fs/namei.c:3645 [inline]
 path_openat+0x1b1f/0x2660 fs/namei.c:3802
 do_filp_open+0x1c9/0x410 fs/namei.c:3829
 do_sys_openat2+0x160/0x1c0 fs/open.c:1404
 do_sys_open fs/open.c:1419 [inline]
 __do_sys_openat fs/open.c:1435 [inline]
 __se_sys_openat fs/open.c:1430 [inline]
 __x64_sys_openat+0x140/0x1f0 fs/open.c:1430
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Freed by task 2395:
 kasan_save_stack+0x24/0x40 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:589
 poison_slab_object mm/kasan/common.c:240 [inline]
 poison_slab_object mm/kasan/common.c:211 [inline]
 __kasan_slab_free+0x102/0x190 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2121 [inline]
 slab_free mm/slub.c:4299 [inline]
 kfree+0xed/0x340 mm/slub.c:4409
 tomoyo_realpath_from_path+0x190/0x600 security/tomoyo/realpath.c:286
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x290/0x3a0 security/tomoyo/file.c:771
 tomoyo_file_open+0x6f/0x90 security/tomoyo/tomoyo.c:334
 security_file_open+0x49/0xa0 security/security.c:2933
 do_dentry_open+0x576/0x16f0 fs/open.c:940
 do_open fs/namei.c:3645 [inline]
 path_openat+0x1b1f/0x2660 fs/namei.c:3802
 do_filp_open+0x1c9/0x410 fs/namei.c:3829
 do_sys_openat2+0x160/0x1c0 fs/open.c:1404
 do_sys_open fs/open.c:1419 [inline]
 __do_sys_openat fs/open.c:1435 [inline]
 __se_sys_openat fs/open.c:1430 [inline]
 __x64_sys_openat+0x140/0x1f0 fs/open.c:1430
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

The buggy address belongs to the object at ffff888111948000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 592 bytes inside of
 freed 4096-byte region [ffff888111948000, ffff888111949000)

The buggy address belongs to the physical page:
page:ffffea0004465200 refcount:1 mapcount:0 mapping:0000000000000000
index:0x0 pfn:0x111948
head:ffffea0004465200 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x200000000000840(slab|head|node=0|zone=2)
page_type: 0xffffffff()
raw: 0200000000000840 ffff888100042140 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask
0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL),
pid 2380, tgid 2380 (systemd-journal), ts 138489329275, free_ts
138483811668
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d9/0x350 mm/page_alloc.c:1533
 prep_new_page mm/page_alloc.c:1540 [inline]
 get_page_from_freelist+0x1008/0x2e40 mm/page_alloc.c:3311
 __alloc_pages+0x210/0x2060 mm/page_alloc.c:4569
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 alloc_slab_page mm/slub.c:2190 [inline]
 allocate_slab mm/slub.c:2354 [inline]
 new_slab+0xd3/0x3b0 mm/slub.c:2407
 ___slab_alloc+0x945/0x1700 mm/slub.c:3540
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625
 __slab_alloc_node mm/slub.c:3678 [inline]
 slab_alloc_node mm/slub.c:3850 [inline]
 __do_kmalloc_node mm/slub.c:3980 [inline]
 __kmalloc+0x3a8/0x440 mm/slub.c:3994
 kmalloc include/linux/slab.h:594 [inline]
 tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x22f/0x420 security/tomoyo/file.c:822
 security_inode_getattr+0xd3/0x140 security/security.c:2238
 vfs_getattr fs/stat.c:173 [inline]
 vfs_fstat+0x4a/0xc0 fs/stat.c:198
 __do_sys_newfstat+0x7a/0xf0 fs/stat.c:478
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
page last free pid 2380 tgid 2380 stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1140 [inline]
 free_unref_page_prepare+0x4f2/0xad0 mm/page_alloc.c:2346
 free_unref_page+0x33/0x2d0 mm/page_alloc.c:2486
 __put_partials+0x154/0x170 mm/slub.c:2922
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x50/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x45/0x60 mm/kasan/common.c:322
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3813 [inline]
 slab_alloc_node mm/slub.c:3860 [inline]
 kmem_cache_alloc+0x12a/0x2e0 mm/slub.c:3867
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:140
 getname_flags include/linux/audit.h:322 [inline]
 getname+0x92/0xd0 fs/namei.c:219
 do_sys_openat2+0xe8/0x1c0 fs/open.c:1398
 do_sys_open fs/open.c:1419 [inline]
 __do_sys_openat fs/open.c:1435 [inline]
 __se_sys_openat fs/open.c:1430 [inline]
 __x64_sys_openat+0x140/0x1f0 fs/open.c:1430
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Memory state around the buggy address:
 ffff888111948100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888111948180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888111948200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888111948280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888111948300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Attachment: .config
Description: Binary data


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux