syzbot


KASAN: invalid-free in raw_release

Status: closed as dup on 2024/09/21 21:01
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+b5e01354ba4aea02654b@syzkaller.appspotmail.com
First crash: 55d, last: now
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: invalid-free in dev_free usb C 665 6h26m 51d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [usb?] KASAN: invalid-free in raw_release 1 (2) 2024/09/21 21:01
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: invalid-free in raw_release 3 3d08h 40d 0/3 upstream: reported on 2024/08/28 08:13

Sample crash report:
==================================================================
BUG: KASAN: double-free in dev_free drivers/usb/gadget/legacy/raw_gadget.c:225 [inline]
BUG: KASAN: double-free in kref_put+0x4ab/0x7c0 include/linux/kref.h:65
Free of addr ffff88802128bea0 by task syz.0.515/6836

CPU: 1 UID: 0 PID: 6836 Comm: syz.0.515 Not tainted 6.12.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report_invalid_free+0x11a/0x140 mm/kasan/report.c:563
 check_slab_allocation+0xc6/0x110
 kasan_slab_pre_free include/linux/kasan.h:195 [inline]
 slab_free_hook mm/slub.c:2287 [inline]
 slab_free mm/slub.c:4579 [inline]
 kfree+0x151/0x440 mm/slub.c:4727
 dev_free drivers/usb/gadget/legacy/raw_gadget.c:225 [inline]
 kref_put+0x4ab/0x7c0 include/linux/kref.h:65
 raw_release+0x135/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:473
 __fput+0x23f/0x880 fs/file_table.c:431
 task_work_run+0x24f/0x310 kernel/task_work.c:228
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0xa2f/0x28e0 kernel/exit.c:939
 do_group_exit+0x207/0x2c0 kernel/exit.c:1088
 get_signal+0x16a3/0x1740 kernel/signal.c:2917
 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe3b9b7cc8a
Code: Unable to access opcode bytes at 0x7fe3b9b7cc60.
RSP: 002b:00007fe3baa34ff0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00007fe3b9d35f80 RCX: 00007fe3b9b7cc8a
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007fe3b9bf0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe3b9d35f80 R15: 00007fe3b9e5fa28
 </TASK>

Allocated by task 6844:
 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:4264 [inline]
 __kmalloc_node_track_caller_noprof+0x225/0x440 mm/slub.c:4283
 memdup_user+0x2b/0xc0 mm/util.c:226
 raw_ioctl_ep_enable drivers/usb/gadget/legacy/raw_gadget.c:847 [inline]
 raw_ioctl+0xd0c/0x3cd0 drivers/usb/gadget/legacy/raw_gadget.c:1318
 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

Freed by task 6836:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:2342 [inline]
 slab_free mm/slub.c:4579 [inline]
 kfree+0x1a0/0x440 mm/slub.c:4727
 dev_free drivers/usb/gadget/legacy/raw_gadget.c:225 [inline]
 kref_put+0x4ab/0x7c0 include/linux/kref.h:65
 raw_release+0x135/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:473
 __fput+0x23f/0x880 fs/file_table.c:431
 __do_sys_close fs/open.c:1565 [inline]
 __se_sys_close fs/open.c:1550 [inline]
 __x64_sys_close+0x7f/0x110 fs/open.c:1550
 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 ffff88802128bea0
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 0 bytes inside of
 16-byte region [ffff88802128bea0, ffff88802128beb0)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2128b
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801ac41640 ffffea00009ab700 dead000000000002
raw: 0000000000000000 0000000000800080 00000001f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 3641023664, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1545 [inline]
 get_page_from_freelist+0x3045/0x3190 mm/page_alloc.c:3457
 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4733
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 alloc_slab_page+0x6a/0x120 mm/slub.c:2412
 allocate_slab+0x5a/0x2f0 mm/slub.c:2578
 new_slab mm/slub.c:2631 [inline]
 ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3818
 __slab_alloc+0x58/0xa0 mm/slub.c:3908
 __slab_alloc_node mm/slub.c:3961 [inline]
 slab_alloc_node mm/slub.c:4122 [inline]
 __do_kmalloc_node mm/slub.c:4263 [inline]
 __kmalloc_noprof+0x25a/0x400 mm/slub.c:4276
 kmalloc_noprof include/linux/slab.h:882 [inline]
 kzalloc_noprof include/linux/slab.h:1014 [inline]
 acpi_ns_get_normalized_pathname+0x106/0x1a0 drivers/acpi/acpica/nsnames.c:306
 acpi_ns_evaluate+0x1f1/0xa40 drivers/acpi/acpica/nseval.c:96
 acpi_evaluate_object+0x59b/0xaf0 drivers/acpi/acpica/nsxfeval.c:354
 acpi_evaluate_integer+0x11b/0x300 drivers/acpi/utils.c:260
 acpi_bus_get_status_handle drivers/acpi/bus.c:82 [inline]
 acpi_bus_get_status+0x17e/0x430 drivers/acpi/bus.c:111
 acpi_bus_attach+0x302/0xcb0 drivers/acpi/scan.c:2285
 device_for_each_child+0x118/0x1b0 drivers/base/core.c:4004
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88802128bd80: 00 00 fc fc 00 00 fc fc 00 00 fc fc 00 00 fc fc
 ffff88802128be00: 00 00 fc fc 00 00 fc fc 00 00 fc fc 00 00 fc fc
>ffff88802128be80: 00 00 fc fc fa fb fc fc 00 00 fc fc 00 00 fc fc
                               ^
 ffff88802128bf00: 00 00 fc fc 00 00 fc fc fa fb fc fc 00 00 fc fc
 ffff88802128bf80: 00 00 fc fc 00 00 fc fc 00 00 fc fc 00 00 fc fc
==================================================================

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/07 12:45 upstream 8cf0b93919e1 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/09/30 07:04 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/09/29 01:17 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: invalid-free in raw_release
2024/09/25 00:18 upstream 97d8894b6f4c 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/09/13 11:56 upstream 196145c606d0 73e8a465 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/09/09 03:15 upstream 5dadc1be8fc5 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/09/01 09:21 upstream e8784b0aef62 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/08/31 08:27 upstream 1934261d8974 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/08/28 00:48 upstream 3ec3f5fc4a91 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/08/28 00:39 upstream 3ec3f5fc4a91 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/08/26 22:42 upstream 5be63fc19fca 9aee4e0b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/08/12 21:16 upstream d74da846046a 7b0f4b46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: invalid-free in raw_release
2024/09/30 12:37 upstream 9852d85ec9d4 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 KASAN: invalid-free in raw_release
2024/09/21 23:11 upstream 88264981f208 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 KASAN: invalid-free in raw_release
2024/09/08 08:23 upstream d1f2d51b711a 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 KASAN: invalid-free in raw_release
2024/09/29 23:10 linux-next 40e0c9d414f5 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: invalid-free in raw_release
* Struck through repros no longer work on HEAD.