|
| 1 | +TITLE: KASAN: slab-use-after-free Read in chrdev_open |
| 2 | +ALT: bad-access in chrdev_open |
| 3 | +TYPE: KASAN |
| 4 | + |
| 5 | +================================================================== |
| 6 | +BUG: KASAN: slab-use-after-free in __list_add_valid_or_report+0x16a/0x1a0 |
| 7 | +Read of size 8 at addr ffff888012acfc20 by task syz-executor311/9489 |
| 8 | + |
| 9 | +CPU: 0 UID: 0 PID: 9489 Comm: syz-executor311 Not tainted 6.15.0-rc1 #1 PREEMPT(full) |
| 10 | +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 |
| 11 | +Call Trace: |
| 12 | + <TASK> |
| 13 | + dump_stack_lvl+0x116/0x1b0 |
| 14 | + print_report+0xc1/0x630 |
| 15 | + kasan_report+0x96/0xd0 |
| 16 | + __list_add_valid_or_report+0x16a/0x1a0 |
| 17 | + chrdev_open+0x3a7/0x590 |
| 18 | + do_dentry_open+0x786/0x1c90 |
| 19 | + vfs_open+0x82/0x3f0 |
| 20 | + path_openat+0x1f75/0x2980 |
| 21 | + do_filp_open+0x1f9/0x2f0 |
| 22 | + do_sys_openat2+0x4e3/0x710 |
| 23 | + do_sys_open+0xc6/0x150 |
| 24 | + __x64_sys_openat+0x9d/0x110 |
| 25 | + do_syscall_64+0xcf/0x260 |
| 26 | + entry_SYSCALL_64_after_hwframe+0x77/0x7f |
| 27 | +RIP: 0033:0x7fe80723d76d |
| 28 | +Code: c3 e8 17 2d 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 |
| 29 | +RSP: 002b:00007ffe67327788 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 |
| 30 | +RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fe80723d76d |
| 31 | +RDX: 0000000000000000 RSI: 0000000020002140 RDI: ffffffffffffff9c |
| 32 | +RBP: 0000000000000003 R08: 00007ffe67327ca9 R09: 00007ffe67327ca9 |
| 33 | +R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe673277ac |
| 34 | +R13: 00007ffe673277d0 R14: 00007ffe673277b0 R15: 0000000000000001 |
| 35 | + </TASK> |
| 36 | + |
| 37 | +Allocated by task 9483: |
| 38 | + kasan_save_stack+0x24/0x50 |
| 39 | + kasan_save_track+0x14/0x30 |
| 40 | + __kasan_slab_alloc+0x87/0x90 |
| 41 | + kmem_cache_alloc_lru_noprof+0x165/0x4a0 |
| 42 | + ntfs_alloc_inode+0x27/0x80 |
| 43 | + alloc_inode+0x67/0x1f0 |
| 44 | + new_inode+0x16/0x40 |
| 45 | + ntfs_new_inode+0x44/0x110 |
| 46 | + ntfs_create_inode+0x3e5/0x4200 |
| 47 | + ntfs_mknod+0x3c/0x50 |
| 48 | + vfs_mknod+0x5f3/0x900 |
| 49 | + do_mknodat+0x377/0x540 |
| 50 | + __x64_sys_mknodat+0xb0/0xe0 |
| 51 | + do_syscall_64+0xcf/0x260 |
| 52 | + entry_SYSCALL_64_after_hwframe+0x77/0x7f |
| 53 | + |
| 54 | +Freed by task 15: |
| 55 | + kasan_save_stack+0x24/0x50 |
| 56 | + kasan_save_track+0x14/0x30 |
| 57 | + kasan_save_free_info+0x3a/0x60 |
| 58 | + __kasan_slab_free+0x54/0x70 |
| 59 | + kmem_cache_free+0x14d/0x550 |
| 60 | + i_callback+0x46/0x70 |
| 61 | + rcu_core+0x7a4/0x1660 |
| 62 | + handle_softirqs+0x1be/0x850 |
| 63 | + run_ksoftirqd+0x3a/0x60 |
| 64 | + smpboot_thread_fn+0x3d2/0xaa0 |
| 65 | + kthread+0x447/0x8a0 |
| 66 | + ret_from_fork+0x48/0x80 |
| 67 | + ret_from_fork_asm+0x1a/0x30 |
| 68 | + |
| 69 | +Last potentially related work creation: |
| 70 | + kasan_save_stack+0x24/0x50 |
| 71 | + kasan_record_aux_stack+0xb0/0xc0 |
| 72 | + __call_rcu_common.constprop.0+0x99/0x820 |
| 73 | + destroy_inode+0x12b/0x1b0 |
| 74 | + evict+0x4d2/0x830 |
| 75 | + iput+0x513/0x820 |
| 76 | + dentry_unlink_inode+0x2cd/0x4c0 |
| 77 | + __dentry_kill+0x186/0x5b0 |
| 78 | + shrink_dentry_list+0x13d/0x650 |
| 79 | + shrink_dcache_parent+0x1c4/0x590 |
| 80 | + do_one_tree+0x11/0x50 |
| 81 | + shrink_dcache_for_umount+0x95/0x1c0 |
| 82 | + generic_shutdown_super+0x6c/0x390 |
| 83 | + kill_block_super+0x3b/0x90 |
| 84 | + ntfs3_kill_sb+0x40/0xf0 |
| 85 | + deactivate_locked_super+0xbb/0x130 |
| 86 | + deactivate_super+0xb1/0xd0 |
| 87 | + cleanup_mnt+0x378/0x510 |
| 88 | + task_work_run+0x172/0x280 |
| 89 | + syscall_exit_to_user_mode+0x29e/0x2a0 |
| 90 | + do_syscall_64+0xdc/0x260 |
| 91 | + entry_SYSCALL_64_after_hwframe+0x77/0x7f |
| 92 | + |
| 93 | +The buggy address belongs to the object at ffff888012acf580 |
| 94 | + which belongs to the cache ntfs_inode_cache of size 1752 |
| 95 | +The buggy address is located 1696 bytes inside of |
| 96 | + freed 1752-byte region [ffff888012acf580, ffff888012acfc58) |
| 97 | + |
| 98 | +The buggy address belongs to the physical page: |
| 99 | +page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12ac8 |
| 100 | +head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 |
| 101 | +memcg:ffff88801f47ab01 |
| 102 | +flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) |
| 103 | +page_type: f5(slab) |
| 104 | +raw: 00fff00000000040 ffff88801f352c80 dead000000000122 0000000000000000 |
| 105 | +raw: 0000000000000000 0000000000110011 00000000f5000000 ffff88801f47ab01 |
| 106 | +head: 00fff00000000040 ffff88801f352c80 dead000000000122 0000000000000000 |
| 107 | +head: 0000000000000000 0000000000110011 00000000f5000000 ffff88801f47ab01 |
| 108 | +head: 00fff00000000003 ffffea00004ab201 00000000ffffffff 00000000ffffffff |
| 109 | +head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 |
| 110 | +page dumped because: kasan: bad access detected |
| 111 | +page_owner tracks the page as allocated |
| 112 | +page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd2050(__GFP_RECLAIMABLE|__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 9483, tgid 9483 (syz-executor311), ts 123154831134, free_ts 103166767187 |
| 113 | + prep_new_page+0x1b0/0x1e0 |
| 114 | + get_page_from_freelist+0x1649/0x30f0 |
| 115 | + __alloc_frozen_pages_noprof+0x2fd/0x6d0 |
| 116 | + alloc_pages_mpol+0x209/0x550 |
| 117 | + new_slab+0x24b/0x340 |
| 118 | + ___slab_alloc+0xf0c/0x17c0 |
| 119 | + __slab_alloc.isra.0+0x56/0xb0 |
| 120 | + kmem_cache_alloc_lru_noprof+0x272/0x4a0 |
| 121 | + ntfs_alloc_inode+0x27/0x80 |
| 122 | + alloc_inode+0x67/0x1f0 |
| 123 | + iget5_locked+0x5f/0xa0 |
| 124 | + ntfs_iget5+0xda/0x3a10 |
| 125 | + ntfs_fill_super+0x1abd/0x3f10 |
| 126 | + get_tree_bdev_flags+0x38a/0x620 |
| 127 | + vfs_get_tree+0x93/0x340 |
| 128 | + path_mount+0x1270/0x1b90 |
| 129 | +page last free pid 6892 tgid 6892 stack trace: |
| 130 | + __free_frozen_pages+0x7cd/0x1320 |
| 131 | + __put_partials+0x14c/0x170 |
| 132 | + qlist_free_all+0x50/0x130 |
| 133 | + kasan_quarantine_reduce+0x168/0x1c0 |
| 134 | + __kasan_slab_alloc+0x67/0x90 |
| 135 | + __kmalloc_noprof+0x1c8/0x600 |
| 136 | + tomoyo_realpath_from_path+0xc3/0x600 |
| 137 | + tomoyo_path_perm+0x235/0x440 |
| 138 | + security_inode_getattr+0x122/0x2b0 |
| 139 | + vfs_getattr+0x26/0x70 |
| 140 | + vfs_fstat+0x50/0xa0 |
| 141 | + __do_sys_newfstat+0x83/0x100 |
| 142 | + do_syscall_64+0xcf/0x260 |
| 143 | + entry_SYSCALL_64_after_hwframe+0x77/0x7f |
| 144 | + |
| 145 | +Memory state around the buggy address: |
| 146 | + ffff888012acfb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb |
| 147 | + ffff888012acfb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb |
| 148 | +>ffff888012acfc00: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc |
| 149 | + ^ |
| 150 | + ffff888012acfc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc |
| 151 | + ffff888012acfd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc |
| 152 | +================================================================== |
0 commit comments