Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Mathias Krause <minipli@grsecurity.net>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Andrew Jones <andrew.jones@linux.dev>,
	Eric Auger <eric.auger@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [kvm-unit-tests PATCH v2 0/4] Better backtraces for leaf functions
Date: Tue, 18 Nov 2025 12:56:11 +0100	[thread overview]
Message-ID: <8a42b563-71b7-4bab-9f1d-248c81295704@grsecurity.net> (raw)
In-Reply-To: <d67ede24-0b75-4bdb-bdc9-272b9608f632@grsecurity.net>

On 18.11.25 05:04, Mathias Krause wrote:
> On 18.11.25 02:47, Mathias Krause wrote:
>> On 18.11.25 02:33, Mathias Krause wrote:
>>> On 17.11.25 23:19, Sean Christopherson wrote:
>>>> Spoke too soon :-(
>>>>
>>>> The x86 change breaks the realmode test.  I didn't try hard to debug, as that
>>>> test is brittle, e.g. see https://lore.kernel.org/all/20240604143507.1041901-1-pbonzini@redhat.com.
>>
>> Bleh, I just noticed, f01ea38a385a ("x86: Better backtraces for leaf
>> functions") broke vmx_sipi_signal_test too :(
>>
>> Looking into it!
> 
> Can't see it. The issue is, the call to hypercall(1) does return in
> x86/vmx.c:guest_entry() with f01ea38a385a applied but not w/o it. But
> that makes no sense to me whatsoever. :/

After some sleep it makes lot more sense. Well, not really, but it's a
race that f01ea38a385a, apparently, makes easier to hit.

> 
> Below debug diff shows the issue:
> 
> diff --git a/x86/vmx.c b/x86/vmx.c
> index c803eaa67ac6..e49668f5ff95 100644
> --- a/x86/vmx.c
> +++ b/x86/vmx.c
> @@ -806,4 +806,5 @@ asm(
>         "       mov $1, %edi\n\t"
>         "       call hypercall\n\t"
> +       "       ud2"
>  );
That hypercall call shouldn't return, as it's HYPERCALL_VMEXIT which
makes vmx_run() return and not re-enter the guest. But, apparently, it
does so and it does so because the guest/VMM shared variable
'hypercall_field' to communicate to the VMM what to do can also be
modified concurrently by the other CPU/guest #2 after it was written by
CPU/guest #1 but before read by the VMM. Bummer!

I'll send a fix in a few.

Thanks,
Mathias

  reply	other threads:[~2025-11-18 11:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 21:54 [kvm-unit-tests PATCH v2 0/4] Better backtraces for leaf functions Mathias Krause
2025-09-15 21:54 ` [kvm-unit-tests PATCH v2 1/4] Makefile: Provide a concept of late CFLAGS Mathias Krause
2025-09-15 21:54 ` [kvm-unit-tests PATCH v2 2/4] x86: Better backtraces for leaf functions Mathias Krause
2025-10-10  6:03   ` Mathias Krause
2025-09-15 21:54 ` [kvm-unit-tests PATCH v2 3/4] arm64: " Mathias Krause
2025-09-15 21:54 ` [kvm-unit-tests PATCH v2 4/4] arm: Fix backtraces involving " Mathias Krause
2025-09-16 13:04 ` [kvm-unit-tests PATCH v2 0/4] Better backtraces for " Andrew Jones
2025-11-14 15:58 ` Mathias Krause
2025-11-14 16:39   ` Sean Christopherson
2025-11-14 18:25 ` Sean Christopherson
2025-11-15  4:56   ` Mathias Krause
2025-11-17 22:19     ` Sean Christopherson
2025-11-18  1:33       ` Mathias Krause
2025-11-18  1:47         ` Mathias Krause
2025-11-18  4:04           ` Mathias Krause
2025-11-18 11:56             ` Mathias Krause [this message]
2025-11-18 12:10               ` Mathias Krause
2025-11-21 16:44           ` Mathias Krause
2025-12-18  1:44             ` Sean Christopherson
2025-12-18 10:07               ` Mathias Krause
2025-12-18 18:26                 ` Sean Christopherson
2025-12-19 13:19                   ` Mathias Krause

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a42b563-71b7-4bab-9f1d-248c81295704@grsecurity.net \
    --to=minipli@grsecurity.net \
    --cc=alexandru.elisei@arm.com \
    --cc=andrew.jones@linux.dev \
    --cc=eric.auger@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox