[syzbot] [kvm?] WARNING in __load_segment_descriptor

From: syzbot
Date: Thu Jul 13 2023 - 02:07:34 EST


Hello,

syzbot found the following issue on:

HEAD commit: 1c7873e33645 mm: lock newly mapped VMA with corrected orde..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=106f1664a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=7ad417033279f15a
dashboard link: https://syzkaller.appspot.com/bug?extid=5234e75fb68b86fe89e3
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=146864a8a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=134a32bca80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7eb52a4d9cf3/disk-1c7873e3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b9aa9a9e09e8/vmlinux-1c7873e3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/782d5e4196e2/bzImage-1c7873e3.xz

The issue was bisected to:

commit 65966aaca18a5cbf42ac22234cb9cbbf60a4d33c
Author: Sean Christopherson <seanjc@xxxxxxxxxx>
Date: Thu Feb 16 20:22:54 2023 +0000

KVM: x86: Assert that the emulator doesn't load CS with garbage in !RM

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16c70f4ca80000
final oops: https://syzkaller.appspot.com/x/report.txt?x=15c70f4ca80000
console output: https://syzkaller.appspot.com/x/log.txt?x=11c70f4ca80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5234e75fb68b86fe89e3@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 65966aaca18a ("KVM: x86: Assert that the emulator doesn't load CS with garbage in !RM")

kvm_intel: set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5022 at arch/x86/kvm/emulate.c:1648 __load_segment_descriptor+0xf89/0x1200 arch/x86/kvm/emulate.c:1648
Modules linked in:
CPU: 0 PID: 5022 Comm: syz-executor486 Not tainted 6.4.0-syzkaller-12454-g1c7873e33645 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
RIP: 0010:__load_segment_descriptor+0xf89/0x1200 arch/x86/kvm/emulate.c:1648
Code: 70 00 44 0f b6 7c 24 37 0f b6 7c 24 30 44 89 fe e8 4c f9 70 00 44 38 7c 24 30 0f 84 96 fb ff ff e9 06 f9 ff ff e8 d7 fd 70 00 <0f> 0b 44 0f b6 7c 24 20 e9 43 f2 ff ff e8 c5 fd 70 00 44 0f b6 7c
RSP: 0018:ffffc90003abf898 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
RDX: ffff8880275e5940 RSI: ffffffff8113e3b9 RDI: 0000000000000005
RBP: ffff8880765e8000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000050
R13: 0000000000000050 R14: ffff8880765e8030 R15: 0000000000000000
FS: 00005555566133c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020032008 CR3: 0000000025f5b000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
load_segment_descriptor arch/x86/kvm/emulate.c:1775 [inline]
__emulate_int_real+0x561/0x6f0 arch/x86/kvm/emulate.c:2061
emulate_int_real+0x7d/0xd0 arch/x86/kvm/emulate.c:2075
kvm_inject_realmode_interrupt+0x102/0x340 arch/x86/kvm/x86.c:8435
vmx_inject_exception+0x33b/0x470 arch/x86/kvm/vmx/vmx.c:1793
kvm_check_and_inject_events arch/x86/kvm/x86.c:10082 [inline]
vcpu_enter_guest+0x386/0x6020 arch/x86/kvm/x86.c:10646
vcpu_run arch/x86/kvm/x86.c:10951 [inline]
kvm_arch_vcpu_ioctl_run+0xa35/0x2820 arch/x86/kvm/x86.c:11172
kvm_vcpu_ioctl+0x574/0xe90 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4112
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x19d/0x210 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f281d28c749
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 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
RSP: 002b:00007ffced680a68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffced680a78 RCX: 00007f281d28c749
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00007ffced680a70 R08: 0000000000000000 R09: 00007f281d24d2d0
R10: 0000000000009120 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>


---
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 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