syzbot


BUG: unable to handle kernel NULL pointer dereference in tty_write_room

Status: auto-obsoleted due to no activity on 2023/10/05 13:52
Subsystems: serial
[Documentation on labels]
Reported-by: syzbot+4e24c3e417773c914ee4@syzkaller.appspotmail.com
First crash: 601d, last: 464d
Cause bisection: failed (error log, bisect log)
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [kernel?] BUG: unable to handle kernel NULL pointer dereference in tty_write_room 0 (1) 2023/05/01 12:16
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in tty_write_room (2) 1 15d 15d 0/3 upstream: reported on 2024/09/18 00:19
upstream KASAN: use-after-free Read in tty_write_room serial 12 760d 1018d 0/28 auto-obsoleted due to no activity on 2023/01/01 23:03
upstream KASAN: slab-use-after-free Read in tty_write_room (2) serial syz error error 17 3d01h 261d 0/28 upstream: reported syz repro on 2024/01/16 15:06
upstream KASAN: slab-use-after-free Read in tty_write_room serial 1 361d 357d 0/28 auto-obsoleted due to no activity on 2024/01/09 18:18
linux-5.15 KASAN: use-after-free Read in tty_write_room 1 350d 350d 0/3 auto-obsoleted due to no activity on 2024/01/27 09:51
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/08/25 07:50 26m retest repro upstream OK log
2023/05/02 02:24 19m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 58390c8ce1bd OK log
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/05/31 12:16 37m bisect fix upstream OK (0) job log log

Sample crash report:
ieee802154 phy0 wpan0: encryption failed: -22
ieee802154 phy1 wpan1: encryption failed: -22
==================================================================
BUG: KASAN: slab-use-after-free in tty_write_room+0x35/0x80 drivers/tty/tty_ioctl.c:80
Read of size 8 at addr ffff88807eb7d018 by task aoe_tx0/1216

CPU: 0 PID: 1216 Comm: aoe_tx0 Not tainted 6.3.0-syzkaller-12049-g58390c8ce1bd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:351 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:462
 kasan_report+0x176/0x1b0 mm/kasan/report.c:572
 tty_write_room+0x35/0x80 drivers/tty/tty_ioctl.c:80
 handle_tx+0x164/0x620 drivers/net/caif/caif_serial.c:226
 __netdev_start_xmit include/linux/netdevice.h:4915 [inline]
 netdev_start_xmit include/linux/netdevice.h:4929 [inline]
 xmit_one net/core/dev.c:3578 [inline]
 dev_hard_start_xmit+0x241/0x750 net/core/dev.c:3594
 __dev_queue_xmit+0x19b9/0x38b0 net/core/dev.c:4244
 dev_queue_xmit include/linux/netdevice.h:3085 [inline]
 tx+0x6a/0x110 drivers/block/aoe/aoenet.c:63
 kthread+0x238/0x440 drivers/block/aoe/aoecmd.c:1229
 kthread+0x2b8/0x350 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 5196:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:680 [inline]
 alloc_tty_struct+0xa9/0x7a0 drivers/tty/tty_io.c:3090
 tty_init_dev+0x5b/0x4b0 drivers/tty/tty_io.c:1408
 ptmx_open+0xda/0x2b0 drivers/tty/pty.c:824
 chrdev_open+0x54e/0x630 fs/char_dev.c:414
 do_dentry_open+0x7f9/0x10f0 fs/open.c:920
 do_open fs/namei.c:3636 [inline]
 path_openat+0x27b3/0x3170 fs/namei.c:3791
 do_filp_open+0x234/0x490 fs/namei.c:3818
 do_sys_openat2+0x13f/0x500 fs/open.c:1356
 do_sys_open fs/open.c:1372 [inline]
 __do_sys_openat fs/open.c:1388 [inline]
 __se_sys_openat fs/open.c:1383 [inline]
 __x64_sys_openat+0x247/0x290 fs/open.c:1383
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5079:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:162 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook mm/slub.c:1807 [inline]
 slab_free mm/slub.c:3786 [inline]
 __kmem_cache_free+0x264/0x3c0 mm/slub.c:3799
 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405
 worker_thread+0xa63/0x1210 kernel/workqueue.c:2552
 kthread+0x2b8/0x350 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Last potentially related work creation:
 kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491
 insert_work+0x54/0x3d0 kernel/workqueue.c:1365
 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526
 queue_work_on+0x14f/0x250 kernel/workqueue.c:1554
 tty_release_struct+0xbc/0xe0 drivers/tty/tty_io.c:1700
 tty_release+0xcff/0x12b0 drivers/tty/tty_io.c:1860
 __fput+0x3b7/0x890 fs/file_table.c:321
 task_work_run+0x24a/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297
 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88807eb7d000
 which belongs to the cache kmalloc-cg-2k of size 2048
The buggy address is located 24 bytes inside of
 freed 2048-byte region [ffff88807eb7d000, ffff88807eb7d800)

The buggy address belongs to the physical page:
page:ffffea0001fade00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7eb78
head:ffffea0001fade00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88802c081481
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff88801244f3c0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000080008 00000001ffffffff ffff88802c081481
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5194, tgid 5193 (syz-executor.0), ts 131832049084, free_ts 131262644214
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1722
 prep_new_page mm/page_alloc.c:1729 [inline]
 get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3493
 __alloc_pages+0x255/0x670 mm/page_alloc.c:4759
 alloc_slab_page+0x6a/0x160 mm/slub.c:1851
 allocate_slab mm/slub.c:1998 [inline]
 new_slab+0x84/0x2f0 mm/slub.c:2051
 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192
 __slab_alloc mm/slub.c:3291 [inline]
 __slab_alloc_node mm/slub.c:3344 [inline]
 slab_alloc_node mm/slub.c:3441 [inline]
 __kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490
 __do_kmalloc_node mm/slab_common.c:965 [inline]
 __kmalloc_node_track_caller+0xa5/0x230 mm/slab_common.c:986
 kmemdup+0x2a/0x60 mm/util.c:131
 neigh_sysctl_register+0xb4/0x4d0 net/core/neighbour.c:3783
 devinet_sysctl_register+0x9d/0x1a0 net/ipv4/devinet.c:2627
 inetdev_init+0x291/0x4c0 net/ipv4/devinet.c:286
 inetdev_event+0x342/0x1580 net/ipv4/devinet.c:1538
 notifier_call_chain+0x18c/0x3a0 kernel/notifier.c:93
 call_netdevice_notifiers_info net/core/dev.c:1935 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:1973 [inline]
 call_netdevice_notifiers+0x149/0x1c0 net/core/dev.c:1987
 register_netdevice+0x1349/0x1790 net/core/dev.c:10118
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1302 [inline]
 free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2555
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2650
 discard_slab mm/slub.c:2097 [inline]
 __unfreeze_partials+0x1b1/0x1f0 mm/slub.c:2636
 put_cpu_partial+0x116/0x180 mm/slub.c:2712
 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711
 slab_alloc_node mm/slub.c:3451 [inline]
 __kmem_cache_alloc_node+0x14c/0x290 mm/slub.c:3490
 __do_kmalloc_node mm/slab_common.c:965 [inline]
 __kmalloc_node+0xa7/0x230 mm/slab_common.c:973
 kmalloc_node include/linux/slab.h:579 [inline]
 kvmalloc_node+0x72/0x180 mm/util.c:604
 kvmalloc include/linux/slab.h:697 [inline]
 kvzalloc include/linux/slab.h:705 [inline]
 bucket_table_alloc lib/rhashtable.c:184 [inline]
 rhashtable_rehash_alloc+0x9e/0x280 lib/rhashtable.c:363
 rht_deferred_worker+0x491/0x2080 lib/rhashtable.c:423
 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405
 worker_thread+0xa63/0x1210 kernel/workqueue.c:2552
 kthread+0x2b8/0x350 kernel/kthread.c:379

Memory state around the buggy address:
 ffff88807eb7cf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807eb7cf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807eb7d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88807eb7d080: fb fb fb f

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/01 12:15 upstream 58390c8ce1bd 62df2017 .config console log report syz [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in tty_write_room
2023/02/09 21:34 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci eaed33698e35 07980f9d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in tty_write_room
2023/06/24 14:54 upstream a92b7d26c743 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in tty_write_room
2023/05/01 04:34 upstream 58390c8ce1bd 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in tty_write_room
2023/04/20 05:23 upstream 789b4a41c247 a219f34e .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in tty_write_room
2023/06/27 13:52 linux-next 60e7c4a25da6 4cd5bb25 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in tty_write_room
* Struck through repros no longer work on HEAD.