linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Aili Yao <yaoaili@kingsoft.com>
Cc: tony.luck@intel.com, mingo@redhat.com, tglx@linutronix.de,
	hpa@zytor.com, x86@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org, yangfeng1@kingsoft.com
Subject: Re: [PATCH v2] x86/mce: fix wrong no-return-ip logic in do_machine_check()
Date: Tue, 23 Feb 2021 10:43:00 +0100	[thread overview]
Message-ID: <20210223094300.GA26060@zn.tnic> (raw)
In-Reply-To: <20210223102755.13cbdffd@alex-virtual-machine>

On Tue, Feb 23, 2021 at 10:27:55AM +0800, Aili Yao wrote:
> When Guest access one address with UE error, it will exit guest mode,
> the host will do the recovery job, and then one SIGBUS is send to
> the VCPU and qemu will catch the signal, there is only address and
> error level no RIPV in signal, so qemu will assume RIPV is cleared and
> inject the error into guest OS.

Lemme see:

void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)

    /* If we get an action required MCE, it has been injected by KVM
     * while the VM was running.  An action optional MCE instead should
     * be coming from the main thread, which qemu_init_sigbus identifies
     * as the "early kill" thread.
     */
    assert(code == BUS_MCEERR_AR || code == BUS_MCEERR_AO);

    ...

	kvm_mce_inject(cpu, paddr, code);

in that function:

    if (code == BUS_MCEERR_AR) {
        status |= MCI_STATUS_AR | 0x134;
        mcg_status |= MCG_STATUS_EIPV;
    } else {
        status |= 0xc0;
        mcg_status |= MCG_STATUS_RIPV;
    }

That looks like a valid RIP bit to me. Then cpu_x86_inject_mce() gets
that mcg_status and injects it into the guest.

So I can't follow your claim - qemu does handle RIPV just fine, it
seems.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2021-02-23  9:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  3:31 x86/mce: fix wrong no-return-ip logic in do_machine_check() Aili Yao
2021-02-22  3:50 ` [PATCH v2] " Aili Yao
2021-02-22  9:24   ` Borislav Petkov
2021-02-22  9:31     ` Aili Yao
2021-02-22 10:03       ` Borislav Petkov
2021-02-22 10:08         ` Aili Yao
2021-02-22 10:22           ` Borislav Petkov
2021-02-22 11:21             ` Aili Yao
2021-02-22 12:17               ` Aili Yao
2021-02-22 12:22                 ` Borislav Petkov
2021-02-22 12:35                   ` Aili Yao
2021-02-22 12:45                     ` Borislav Petkov
2021-02-23  2:27                       ` Aili Yao
2021-02-23  9:43                         ` Borislav Petkov [this message]
2021-02-23  9:56                           ` Aili Yao
2021-02-23 10:05                             ` Borislav Petkov
2021-02-23 11:27                               ` Aili Yao
2021-02-23 16:12                                 ` Luck, Tony
2021-02-24  2:39                                   ` Aili Yao
2021-03-24  2:59                                     ` Aili Yao
2021-03-24  8:03                                       ` Aili Yao

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=20210223094300.GA26060@zn.tnic \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=yangfeng1@kingsoft.com \
    --cc=yaoaili@kingsoft.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;
as well as URLs for NNTP newsgroup(s).