mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: "Xin Li (Intel)" <xin@zytor.com>, linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	peterz@infradead.org, andrew.cooper3@citrix.com
Subject: Re: [PATCH v3 1/1] x86/fred: Clear WFE in missing-ENDBRANCH #CPs
Date: Wed, 13 Nov 2024 09:49:00 -0800	[thread overview]
Message-ID: <8211a3d2-66e0-4563-b804-8aa4bd0f0de9@intel.com> (raw)
In-Reply-To: <20241113091313.3717338-1-xin@zytor.com>

On 11/13/24 01:13, Xin Li (Intel) wrote:
> An indirect branch instruction sets the CPU indirect branch tracker
> (IBT) into WAIT_FOR_ENDBRANCH (WFE) state, and WFE stays asserted
> across the instruction boundary.  When decoder finds an instruction
> and WFE is set, and the instruction is not the appropriate ENDBR, it
> raises a #CP fault.
> 
> For the kernel IBT no ENDBR selftest where #CPs are deliberately
> triggerred, the WFE state of the interrupted context needs to be
> cleared to let execution continue.  Otherwise when the CPU resumes
> from the instruction that just caused the previous #CP, another
> missing-ENDBRANCH #CP is raised and the CPU enters a dead loop.
> 
> This is not a problem with IDT because it doesn't preserve WFE and
> IRET doesn't set WFE.  But FRED provides space on the entry stack
> (in an expanded CS area) to save and restore the WFE state, thus the
> WFE state is no longer clobbered, so software must clear it.
> 
> Clear WFE to avoid dead looping in ibt_clear_fred_wfe() and the
> !ibt_fatal code path when execution is allowed to continue.
> 
> Clobbering WFE in any other circumstance is a security-relevant bug.

With the minor fixes Ingo mentioned:

Acked-by: Dave Hansen <dave.hansen@linux.intel.com>


      parent reply	other threads:[~2024-11-13 17:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13  9:13 Xin Li (Intel)
2024-11-13  9:56 ` Ingo Molnar
2024-11-13 17:42   ` Xin Li
2024-11-13 17:49 ` Dave Hansen [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=8211a3d2-66e0-4563-b804-8aa4bd0f0de9@intel.com \
    --to=dave.hansen@intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xin@zytor.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

all inboxes | Powered by JetHome®