[v5.15] KASAN: use-after-free Read in __efivar_entry_iter

0 views
Skip to first unread message

syzbot

unread,
Jul 26, 2023, 6:23:47 PM7/26/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5c6a716301d9 Linux 5.15.122
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14b8f1d9a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=616b77968d97faf
dashboard link: https://syzkaller.appspot.com/bug?extid=2c66b80123d5608d940b
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/3b30110d1623/disk-5c6a7163.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ba1423987c1b/vmlinux-5c6a7163.xz
kernel image: https://storage.googleapis.com/syzbot-assets/57bc384b5a07/Image-5c6a7163.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2c66b8...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __efivar_entry_iter+0x10c/0x19c
Read of size 8 at addr ffff00012c838828 by task syz-executor.0/8402

CPU: 0 PID: 8402 Comm: syz-executor.0 Not tainted 5.15.122-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/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_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
__efivar_entry_iter+0x10c/0x19c
efivarfs_kill_sb+0x3c/0x4c fs/efivarfs/super.c:249
deactivate_locked_super+0xb8/0x13c fs/super.c:335
deactivate_super+0x108/0x128 fs/super.c:366
cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
__cleanup_mnt+0x20/0x30 fs/namespace.c:1150
task_work_run+0x130/0x1e4 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
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 8402:
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]
efivarfs_callback+0x118/0x674 fs/efivarfs/super.c:119
efivar_init+0x614/0x9f4 drivers/firmware/efi/vars.c:474
efivarfs_fill_super+0x1c4/0x260 fs/efivarfs/super.c:222
vfs_get_super fs/super.c:1150 [inline]
get_tree_single+0xb8/0x170 fs/super.c:1188
efivarfs_get_tree+0x28/0x38 fs/efivarfs/super.c:231
vfs_get_tree+0x90/0x274 fs/super.c:1508
do_new_mount+0x25c/0x8c4 fs/namespace.c:2994
path_mount+0x590/0x104c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__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 8401:
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
efivarfs_destroy+0x48/0x5c fs/efivarfs/super.c:189
__efivar_entry_iter+0x11c/0x19c drivers/firmware/efi/vars.c:1089
efivarfs_kill_sb+0x3c/0x4c fs/efivarfs/super.c:249
deactivate_locked_super+0xb8/0x13c fs/super.c:335
deactivate_super+0x108/0x128 fs/super.c:366
cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
__cleanup_mnt+0x20/0x30 fs/namespace.c:1150
task_work_run+0x130/0x1e4 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
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 ffff00012c838000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2088 bytes inside of
4096-byte region [ffff00012c838000, ffff00012c839000)
The buggy address belongs to the page:
page:00000000b86182b2 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16c838
head:00000000b86182b2 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0002a80
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff00012c838700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff00012c838780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff00012c838800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff00012c838880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff00012c838900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
list_del corruption, ffff00012c838828->next is LIST_POISON1 (dead000000000100)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:55!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 8402 Comm: syz-executor.0 Tainted: G B 5.15.122-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __list_del_entry_valid+0x110/0x150 lib/list_debug.c:53
lr : __list_del_entry_valid+0x110/0x150 lib/list_debug.c:53
sp : ffff8000279778b0
x29: ffff8000279778b0 x28: 1ffff00002921a9d x27: 0000000000000000
x26: dfff800000000000 x25: dead000000000100 x24: ffff80001490d320
x23: dfff800000000000 x22: dead000000000100 x21: dfff800000000000
x20: dead000000000122 x19: ffff00012c838828 x18: 1fffe000368feb8e
x17: 1fffe000368feb8e x16: ffff800011967f54 x15: ffff8000149af100
x14: ffff0001b47f5c80 x13: ffffffffffffffff x12: 0000000000000000
x11: ff8080000832d958 x10: 0000000000000000 x9 : 41a46bcf0f0ee600
x8 : 41a46bcf0f0ee600 x7 : 0000000000000000 x6 : ffff800008268c70
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000a958860
x2 : ffff0001b47f5d10 x1 : 0000000100000000 x0 : 000000000000004e
Call trace:
__list_del_entry_valid+0x110/0x150 lib/list_debug.c:53
__list_del_entry include/linux/list.h:132 [inline]
list_del include/linux/list.h:146 [inline]
efivar_entry_remove+0x64/0x14c drivers/firmware/efi/vars.c:539
efivarfs_destroy+0x20/0x5c fs/efivarfs/super.c:185
__efivar_entry_iter+0x11c/0x19c drivers/firmware/efi/vars.c:1089
efivarfs_kill_sb+0x3c/0x4c fs/efivarfs/super.c:249
deactivate_locked_super+0xb8/0x13c fs/super.c:335
deactivate_super+0x108/0x128 fs/super.c:366
cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
__cleanup_mnt+0x20/0x30 fs/namespace.c:1150
task_work_run+0x130/0x1e4 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
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: 91088000 aa1303e1 f2fbd5a2 95beabf8 (d4210000)
---[ end trace df912851df6064ca ]---


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

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

syzbot

unread,
Nov 3, 2023, 6:23:18 PM11/3/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages