]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: don't allow memory operands for inline asm that modifies SP
authorNick Desaulniers <ndesaulniers@google.com>
Mon, 23 Mar 2020 19:12:43 +0000 (12:12 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 23 Mar 2020 19:40:51 +0000 (15:40 -0400)
commit813df8d7a031db3f88be8fa19bf04e247065a4a2
treed1bea8dad55131c4a194b55895551a1a2d38a1fe
parent1a9947866a3259a40726afc4dd5a05ad3803eb88
KVM: VMX: don't allow memory operands for inline asm that modifies SP

THUNK_TARGET defines [thunk_target] as having "rm" input constraints
when CONFIG_RETPOLINE is not set, which isn't constrained enough for
this specific case.

For inline assembly that modifies the stack pointer before using this
input, the underspecification of constraints is dangerous, and results
in an indirect call to a previously pushed flags register.

In this case `entry`'s stack slot is good enough to satisfy the "m"
constraint in "rm", but the inline assembly in
handle_external_interrupt_irqoff() modifies the stack pointer via
push+pushf before using this input, which in this case results in
calling what was the previous state of the flags register, rather than
`entry`.

Be more specific in the constraints by requiring `entry` be in a
register, and not a memory operand.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: syzbot+3f29ca2efb056a761e38@syzkaller.appspotmail.com
Debugged-by: Alexander Potapenko <glider@google.com>
Debugged-by: Paolo Bonzini <pbonzini@redhat.com>
Debugged-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Message-Id: <20200323191243.30002-1-ndesaulniers@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c