Hello,
syzbot found the following issue on:
HEAD commit: 1fe619a7d252 Linux 5.15.113
git tree: linux-5.15.y
console output:
https://syzkaller.appspot.com/x/log.txt?x=1437a7fe280000
kernel config:
https://syzkaller.appspot.com/x/.config?x=8f10ee30ae29b021
dashboard link:
https://syzkaller.appspot.com/bug?extid=899730ffdd53c2725cfa
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=121293d5280000
C reproducer:
https://syzkaller.appspot.com/x/repro.c?x=1202583e280000
Downloadable assets:
disk image:
https://storage.googleapis.com/syzbot-assets/1b707a1e1816/disk-1fe619a7.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/19cc598a8bbe/vmlinux-1fe619a7.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/a6cf7269bae5/Image-1fe619a7.gz.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+899730...@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: use-after-free in gsm_cleanup_mux+0x660/0x738 drivers/tty/n_gsm.c:2397
Read of size 4 at addr ffff0000c8b4a00c by task syz-executor242/3967
CPU: 0 PID: 3967 Comm: syz-executor242 Not tainted 5.15.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
__asan_report_load4_noabort+0x44/0x50 mm/kasan/report_generic.c:308
gsm_cleanup_mux+0x660/0x738 drivers/tty/n_gsm.c:2397
gsm_config drivers/tty/n_gsm.c:2653 [inline]
gsmld_ioctl+0xa48/0x13d8 drivers/tty/n_gsm.c:2986
tty_ioctl+0x954/0xdf4 drivers/tty/tty_io.c:2816
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
Allocated by task 3962:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
__kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
gsm_dlci_alloc+0x60/0x340 drivers/tty/n_gsm.c:1932
gsm_activate_mux+0x30/0x300 drivers/tty/n_gsm.c:2438
gsm_config drivers/tty/n_gsm.c:2677 [inline]
gsmld_ioctl+0xc1c/0x13d8 drivers/tty/n_gsm.c:2986
tty_ioctl+0x954/0xdf4 drivers/tty/tty_io.c:2816
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
Freed by task 3962:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0x178/0x410 mm/slub.c:4559
gsm_dlci_free+0x11c/0x168 drivers/tty/n_gsm.c:1978
tty_port_destructor drivers/tty/tty_port.c:265 [inline]
kref_put include/linux/kref.h:65 [inline]
tty_port_put+0x140/0x1bc drivers/tty/tty_port.c:273
dlci_put drivers/tty/n_gsm.c:1988 [inline]
gsm_dlci_release drivers/tty/n_gsm.c:2021 [inline]
gsm_cleanup_mux+0x488/0x738 drivers/tty/n_gsm.c:2415
gsm_config drivers/tty/n_gsm.c:2653 [inline]
gsmld_ioctl+0xa48/0x13d8 drivers/tty/n_gsm.c:2986
tty_ioctl+0x954/0xdf4 drivers/tty/tty_io.c:2816
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
The buggy address belongs to the object at ffff0000c8b4a000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 12 bytes inside of
2048-byte region [ffff0000c8b4a000, ffff0000c8b4a800)
The buggy address belongs to the page:
page:0000000003bf807d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108b48
head:0000000003bf807d order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000122 ffff0000c0002900
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff0000c8b49f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000c8b49f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c8b4a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000c8b4a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000c8b4a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Unable to handle kernel paging request at virtual address dfff80000000000a
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
[dfff80000000000a] address between user and kernel address ranges
Internal error: Oops: 96000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 3967 Comm: syz-executor242 Tainted: G B 5.15.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : tty_write_room+0x48/0x8c drivers/tty/tty_ioctl.c:78
lr : tty_write_room+0x3c/0x8c drivers/tty/tty_ioctl.c:78
sp : ffff80001cdc7810
x29: ffff80001cdc7810 x28: 0000000000000001 x27: dfff800000000000
x26: 1ffff000039b8f14 x25: 0000000000000000 x24: 1fffe00019984cc0
x23: dfff800000000000 x22: 0000000000000f7a x21: dfff800000000000
x20: 0000000000000050 x19: ffff0000c7838a00 x18: 0000000000000000
x17: ff8080000b3ef030 x16: 0000000000000000 x15: ffff80000b3ef030
x14: 0000000000000002 x13: ffffffffffffffff x12: 0000000000000000
x11: ff8080000b3d191c x10: 0000000000000000 x9 : ffff80001842e390
x8 : 000000000000000a x7 : 0000000000000000 x6 : ffff800008268c6c
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000b3d1934
x2 : 0000000000000000 x1 : 0000000000000008 x0 : 0000000000000000
Call trace:
tty_write_room+0x48/0x8c drivers/tty/tty_ioctl.c:78
gsmld_output+0x4c/0x1d0 drivers/tty/n_gsm.c:2698
gsm_send+0x4dc/0x798 drivers/tty/n_gsm.c:707
gsm_command drivers/tty/n_gsm.c:736 [inline]
gsm_dlci_begin_close drivers/tty/n_gsm.c:1801 [inline]
gsm_cleanup_mux+0x1a0/0x738 drivers/tty/n_gsm.c:2398
gsm_config drivers/tty/n_gsm.c:2653 [inline]
gsmld_ioctl+0xa48/0x13d8 drivers/tty/n_gsm.c:2986
tty_ioctl+0x954/0xdf4 drivers/tty/tty_io.c:2816
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
Code: 9753d81a f9400288 91014114 d343fe88 (38756908)
---[ end trace abbff69097bf988f ]---
----------------
Code disassembly (best guess):
0: 9753d81a bl 0xfffffffffd4f6068
4: f9400288 ldr x8, [x20]
8: 91014114 add x20, x8, #0x50
c: d343fe88 lsr x8, x20, #3
* 10: 38756908 ldrb w8, [x8, x21] <-- trapping instruction
If the bug is already fixed, 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 change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup