lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200323191243.30002-1-ndesaulniers@google.com>
Date:   Mon, 23 Mar 2020 12:12:43 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     pbonzini@...hat.com, sean.j.christopherson@...el.com
Cc:     ndesaulniers@...gle.com, bp@...en8.de,
        clang-built-linux@...glegroups.com, dvyukov@...gle.com,
        glider@...gle.com, hpa@...or.com, jmattson@...gle.com,
        joro@...tes.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        mingo@...hat.com,
        syzbot+3f29ca2efb056a761e38@...kaller.appspotmail.com,
        syzkaller-bugs@...glegroups.com, tglx@...utronix.de,
        vkuznets@...hat.com, wanpengli@...cent.com, x86@...nel.org
Subject: [PATCH] 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@...gle.com>
Reported-by: syzbot+3f29ca2efb056a761e38@...kaller.appspotmail.com
Debugged-by: Alexander Potapenko <glider@...gle.com>
Debugged-by: Paolo Bonzini <pbonzini@...hat.com>
Debugged-by: Sean Christopherson <sean.j.christopherson@...el.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
---
 arch/x86/kvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 4d22b1b5e822..310e8c1169b8 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6277,7 +6277,7 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu)
 #endif
 		ASM_CALL_CONSTRAINT
 		:
-		THUNK_TARGET(entry),
+		[thunk_target]"r"(entry),
 		[ss]"i"(__KERNEL_DS),
 		[cs]"i"(__KERNEL_CS)
 	);
-- 
2.25.1.696.g5e7596f4ac-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ