mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>,
	<linux-kernel@vger.kernel.org>
Cc: <x86@kernel.org>, <tglx@linutronix.de>, <bp@alien8.de>,
	<mingo@kernel.org>, <chao.gao@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Eric Biggers <ebiggers@google.com>,
	"Rik van Riel" <riel@redhat.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH] [v2] x86/fpu: Delay instruction pointer fixup until after warning
Date: Thu, 26 Jun 2025 21:04:09 +0900	[thread overview]
Message-ID: <83f82177-8349-427e-b670-ef0a9ff94c9e@intel.com> (raw)
In-Reply-To: <20250624210148.97126F9E@davehans-spike.ostc.intel.com>

On 6/25/2025 6:01 AM, Dave Hansen wrote:
> 
> Right now, if XRSTOR fails a console message like this is be printed:
> 
> 	Bad FPU state detected at restore_fpregs_from_fpstate+0x9a/0x170, reinitializing FPU registers.
> 
> However, the text location (...+0x9a in this case) is the instruction
> *AFTER* the XRSTOR. The highlighted instruction in the "Code:" dump
> also points one instruction late.
> 
> The reason is that the "fixup" moves RIP up to pass the bad XRSTOR and
> keep on running after returning from the #GP handler. But it does this
> fixup before warning.
> 
> The resulting warning output is nonsensical because it looks like the
> non-FPU-related instruction is #GP'ing.
> 
> Do not fix up RIP until after printing the warning. Do this by using> the more generic and standard ex_handler_default().

Indeed, the fix looks obvious and correct.

Also, the trick you previously shared for reproducing the fault is very 
useful for testing cases like this.

I would be happy to provide my tag:
Reviewed-by: Chang S. Bae <chang.seok.bae@intel.com>

Thanks,
Chang

      parent reply	other threads:[~2025-06-26 12:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 21:01 Dave Hansen
2025-06-25  2:02 ` Chao Gao
2025-06-25  8:57 ` Peter Zijlstra
2025-06-25 23:21   ` Dave Hansen
2025-06-26 12:04 ` Chang S. Bae [this message]

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=83f82177-8349-427e-b670-ef0a9ff94c9e@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=ebiggers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=riel@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®