[syzbot] [mm?] kernel BUG in resv_map_release

From: syzbot
Date: Fri Jan 26 2024 - 12:03:56 EST


Hello,

syzbot found the following issue on:

HEAD commit: 8bf1262c53f5 Add linux-next specific files for 20240124
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1267004be80000
kernel config: https://syzkaller.appspot.com/x/.config?x=ff4b59a824278780
dashboard link: https://syzkaller.appspot.com/bug?extid=26dcc7b3798d5bfdfbc3
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=166d5c80180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17e89b27e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7696d711072d/disk-8bf1262c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/92cd47c28072/vmlinux-8bf1262c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/add5c7493418/bzImage-8bf1262c.xz

The issue was bisected to:

commit 947b031634e7af3d265275c26ec17e2f96fdb5a1
Author: Breno Leitao <leitao@xxxxxxxxxx>
Date: Wed Jan 17 17:10:57 2024 +0000

mm/hugetlb: restore the reservation if needed

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=177c4fc3e80000
final oops: https://syzkaller.appspot.com/x/report.txt?x=14fc4fc3e80000
console output: https://syzkaller.appspot.com/x/log.txt?x=10fc4fc3e80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+26dcc7b3798d5bfdfbc3@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 947b031634e7 ("mm/hugetlb: restore the reservation if needed")

------------[ cut here ]------------
kernel BUG at mm/hugetlb.c:1129!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 PID: 5066 Comm: syz-executor406 Not tainted 6.8.0-rc1-next-20240124-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
RIP: 0010:resv_map_release mm/hugetlb.c:1129 [inline]
RIP: 0010:resv_map_release+0x1f3/0x290 mm/hugetlb.c:1114
Code: ab ff 48 85 db 75 1d e8 eb 37 ab ff 48 8b 7c 24 08 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e 41 5f e9 c3 07 fb ff e8 ce 37 ab ff 90 <0f> 0b 4c 89 ef e8 83 76 05 00 e9 3d ff ff ff 48 89 ef e8 86 75 05
RSP: 0018:ffffc900033f7b40 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81e0f3fb
RDX: ffff88802b4e9dc0 RSI: ffffffff81e0f422 RDI: 0000000000000007
RBP: ffff88807faaa060 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000001 R11: ffffffff8ae000e6 R12: ffff88807faaa060
R13: ffff88807faaa060 R14: ffff88801ea1e788 R15: dead000000000100
FS: 0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd2783df930 CR3: 000000000d57a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
kref_put include/linux/kref.h:65 [inline]
hugetlb_vm_op_close+0x4f5/0x5d0 mm/hugetlb.c:5165
remove_vma+0x8b/0x180 mm/mmap.c:141
exit_mmap+0x511/0xbe0 mm/mmap.c:3282
__mmput+0x12a/0x4d0 kernel/fork.c:1343
mmput+0x62/0x70 kernel/fork.c:1365
exit_mm kernel/exit.c:569 [inline]
do_exit+0x999/0x2ac0 kernel/exit.c:858
do_group_exit+0xd3/0x2a0 kernel/exit.c:1020
__do_sys_exit_group kernel/exit.c:1031 [inline]
__se_sys_exit_group kernel/exit.c:1029 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7fd2783fdc39
Code: Unable to access opcode bytes at 0x7fd2783fdc0f.
RSP: 002b:00007ffd48dc35f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd2783fdc39
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 00007fd278478270 R08: ffffffffffffffb8 R09: 0000000000000000
R10: 0000000000002012 R11: 0000000000000246 R12: 00007fd278478270
R13: 0000000000000000 R14: 00007fd278478cc0 R15: 00007fd2783cfa30
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:resv_map_release mm/hugetlb.c:1129 [inline]
RIP: 0010:resv_map_release+0x1f3/0x290 mm/hugetlb.c:1114
Code: ab ff 48 85 db 75 1d e8 eb 37 ab ff 48 8b 7c 24 08 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e 41 5f e9 c3 07 fb ff e8 ce 37 ab ff 90 <0f> 0b 4c 89 ef e8 83 76 05 00 e9 3d ff ff ff 48 89 ef e8 86 75 05
RSP: 0018:ffffc900033f7b40 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81e0f3fb
RDX: ffff88802b4e9dc0 RSI: ffffffff81e0f422 RDI: 0000000000000007
RBP: ffff88807faaa060 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000001 R11: ffffffff8ae000e6 R12: ffff88807faaa060
R13: ffff88807faaa060 R14: ffff88801ea1e788 R15: dead000000000100
FS: 0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd2783df930 CR3: 000000000d57a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
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 syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, 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 overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup