syzbot


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

Status: upstream: reported on 2025/01/10 13:31
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+0c88dda7b07b78c42447@syzkaller.appspotmail.com
First crash: 181d, last: 17d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [sound?] KASAN: slab-use-after-free Read in snd_pcm_action_single 0 (1) 2025/01/10 13:31

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
Read of size 1 at addr ffff888012f23180 by task syz.1.11491/10264

CPU: 0 UID: 0 PID: 10264 Comm: syz.1.11491 Not tainted 6.16.0-rc2-syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:408 [inline]
 print_report+0xcd/0x680 mm/kasan/report.c:521
 kasan_report+0xe0/0x110 mm/kasan/report.c:634
 __kasan_check_byte+0x36/0x50 mm/kasan/common.c:557
 kasan_check_byte include/linux/kasan.h:399 [inline]
 lock_acquire kernel/locking/lockdep.c:5845 [inline]
 lock_acquire+0xfc/0x350 kernel/locking/lockdep.c:5828
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
 __wake_up_common_lock kernel/sched/wait.c:105 [inline]
 __wake_up+0x1c/0x60 kernel/sched/wait.c:127
 snd_pcm_action_single+0x10a/0x150 sound/core/pcm_native.c:1306
 snd_pcm_action+0x70/0x90 sound/core/pcm_native.c:1387
 loopback_check_format sound/drivers/aloop.c:362 [inline]
 loopback_trigger+0xd5a/0x1ec0 sound/drivers/aloop.c:410
 snd_pcm_do_start sound/core/pcm_native.c:1448 [inline]
 snd_pcm_do_start+0xd4/0x1f0 sound/core/pcm_native.c:1441
 snd_pcm_action_single+0x80/0x150 sound/core/pcm_native.c:1304
 snd_pcm_action+0x70/0x90 sound/core/pcm_native.c:1387
 __snd_pcm_lib_xfer+0x1404/0x1ec0 sound/core/pcm_lib.c:2405
 snd_pcm_oss_write3+0xcf/0x1e0 sound/core/oss/pcm_oss.c:1241
 io_playback_transfer+0x26e/0x2f0 sound/core/oss/io.c:47
 snd_pcm_plug_write_transfer+0x2cc/0x400 sound/core/oss/pcm_plugin.c:630
 snd_pcm_oss_write2+0x24a/0x410 sound/core/oss/pcm_oss.c:1373
 snd_pcm_oss_sync1+0x1b7/0x540 sound/core/oss/pcm_oss.c:1615
 snd_pcm_oss_sync+0x5ef/0x840 sound/core/oss/pcm_oss.c:1691
 snd_pcm_oss_release+0x28b/0x310 sound/core/oss/pcm_oss.c:2574
 __fput+0x402/0xb70 fs/file_table.c:465
 task_work_run+0x150/0x240 kernel/task_work.c:227
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop+0xeb/0x110 kernel/entry/common.c:114
 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 __do_fast_syscall_32+0x2ac/0x3a0 arch/x86/entry/syscall_32.c:309
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:331
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e
RIP: 0023:0xf7f43579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000ffdda39c EFLAGS: 00000202 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 000000000000001e
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 10266:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kzalloc_noprof include/linux/slab.h:1039 [inline]
 snd_pcm_attach_substream+0x441/0xd60 sound/core/pcm.c:938
 snd_pcm_open_substream+0x8d/0x17f0 sound/core/pcm_native.c:2750
 snd_pcm_oss_open_file sound/core/oss/pcm_oss.c:2438 [inline]
 snd_pcm_oss_open+0x735/0x1400 sound/core/oss/pcm_oss.c:2519
 soundcore_open+0x40c/0x580 sound/sound_core.c:594
 chrdev_open+0x234/0x6a0 fs/char_dev.c:414
 do_dentry_open+0x741/0x1c10 fs/open.c:964
 vfs_open+0x82/0x3f0 fs/open.c:1094
 do_open fs/namei.c:3887 [inline]
 path_openat+0x1de4/0x2cb0 fs/namei.c:4046
 do_filp_open+0x20b/0x470 fs/namei.c:4073
 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437
 do_sys_open fs/open.c:1452 [inline]
 __do_compat_sys_openat fs/open.c:1514 [inline]
 __se_compat_sys_openat fs/open.c:1512 [inline]
 __ia32_compat_sys_openat+0x16d/0x210 fs/open.c:1512
 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline]
 __do_fast_syscall_32+0x7c/0x3a0 arch/x86/entry/syscall_32.c:306
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:331
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Freed by task 10266:
 kasan_save_stack+0x33/0x60 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:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2381 [inline]
 slab_free mm/slub.c:4643 [inline]
 kfree+0x2b4/0x4d0 mm/slub.c:4842
 snd_pcm_detach_substream+0x1d7/0x380 sound/core/pcm.c:1003
 snd_pcm_release_substream+0x5b/0x70 sound/core/pcm_native.c:2723
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2397 [inline]
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2389 [inline]
 snd_pcm_oss_release+0x16f/0x310 sound/core/oss/pcm_oss.c:2576
 __fput+0x402/0xb70 fs/file_table.c:465
 task_work_run+0x150/0x240 kernel/task_work.c:227
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop+0xeb/0x110 kernel/entry/common.c:114
 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 do_int80_emulation+0x352/0x460 arch/x86/entry/syscall_32.c:175
 asm_int80_emulation+0x1a/0x20 arch/x86/include/asm/idtentry.h:626

The buggy address belongs to the object at ffff888012f23000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 384 bytes inside of
 freed 2048-byte region [ffff888012f23000, ffff888012f23800)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12f20
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801b842f00 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801b842f00 dead000000000100 dead000000000122
head: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea00004bc801 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 7729, tgid 7728 (syz.5.10770), ts 1675749572134, free_ts 1675506183556
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1704
 prep_new_page mm/page_alloc.c:1712 [inline]
 get_page_from_freelist+0x1321/0x3890 mm/page_alloc.c:3669
 __alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:4959
 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2419
 alloc_slab_page mm/slub.c:2451 [inline]
 allocate_slab mm/slub.c:2619 [inline]
 new_slab+0x23b/0x330 mm/slub.c:2673
 ___slab_alloc+0xd9c/0x1940 mm/slub.c:3859
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3949
 __slab_alloc_node mm/slub.c:4024 [inline]
 slab_alloc_node mm/slub.c:4185 [inline]
 __do_kmalloc_node mm/slub.c:4327 [inline]
 __kmalloc_node_track_caller_noprof+0x2ee/0x510 mm/slub.c:4347
 kmemdup_noprof+0x29/0x60 mm/util.c:137
 kmemdup_noprof include/linux/fortify-string.h:765 [inline]
 sctp_sysctl_net_register+0x30/0x200 net/sctp/sysctl.c:606
 sctp_defaults_init+0x6c4/0xd80 net/sctp/protocol.c:1413
 ops_init+0x1e2/0x5f0 net/core/net_namespace.c:138
 setup_net+0x1ff/0x510 net/core/net_namespace.c:442
 copy_net_ns+0x2a6/0x5f0 net/core/net_namespace.c:574
 create_new_namespaces+0x3ea/0xa90 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0xc0/0x1f0 kernel/nsproxy.c:218
page last free pid 7696 tgid 7695 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1248 [inline]
 __free_frozen_pages+0x7fe/0x1180 mm/page_alloc.c:2706
 vfree+0x1fd/0xb50 mm/vmalloc.c:3426
 __vmalloc_area_node mm/vmalloc.c:3775 [inline]
 __vmalloc_node_range_noprof+0x1162/0x14b0 mm/vmalloc.c:3885
 __bpf_map_area_alloc+0x12e/0x200 kernel/bpf/syscall.c:397
 prealloc_init kernel/bpf/hashtab.c:324 [inline]
 htab_map_alloc+0xa04/0x1570 kernel/bpf/hashtab.c:561
 map_create+0x592/0x1db0 kernel/bpf/syscall.c:1477
 __sys_bpf+0x47cc/0x4d80 kernel/bpf/syscall.c:5818
 __do_sys_bpf kernel/bpf/syscall.c:5943 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5941 [inline]
 __ia32_sys_bpf+0x76/0xe0 kernel/bpf/syscall.c:5941
 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline]
 __do_fast_syscall_32+0x7c/0x3a0 arch/x86/entry/syscall_32.c:306
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:331
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Memory state around the buggy address:
 ffff888012f23080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888012f23100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888012f23180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888012f23200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888012f23280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	ret
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/16 17:16 upstream e04c78d86a96 d1716036 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in snd_pcm_action_single
2025/04/12 19:53 upstream 3bde70a2c827 0bd6db41 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in snd_pcm_action_single
2025/01/13 15:15 upstream 5bc55a333a2f 249ceea9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in snd_pcm_action_single
2025/01/03 00:41 upstream 0bc21e701a6f d3ccff63 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in snd_pcm_action_single
* Struck through repros no longer work on HEAD.