linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: linke li <lilinke99@qq.com>
Cc: xujianhao01@gmail.com, linke li <lilinke99@qq.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/efi: mark racy access on efi_rts_work.efi_rts_id
Date: Sat, 27 Apr 2024 13:25:07 +0800	[thread overview]
Message-ID: <tencent_E910110547D287B13FEDB6E161D8874E6E06@qq.com> (raw)

In efi_crash_gracefully_on_page_fault(), efi_rts_work.efi_rts_id can by
changed by other thread from the comment. Mark possible data race on 
efi_rts_work.efi_rts_id as benign using READ_ONCE.

This patch is aimed at reducing the number of benign races reported by
KCSAN in order to focus future debugging effort on harmful races.

Signed-off-by: linke li <lilinke99@qq.com>
---
 arch/x86/platform/efi/quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index f0cc00032751..4acb81700caf 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -751,7 +751,7 @@ void efi_crash_gracefully_on_page_fault(unsigned long phys_addr)
 	 * because this case occurs *very* rarely and hence could be improved
 	 * on a need by basis.
 	 */
-	if (efi_rts_work.efi_rts_id == EFI_RESET_SYSTEM) {
+	if (READ_ONCE(efi_rts_work.efi_rts_id) == EFI_RESET_SYSTEM) {
 		pr_info("efi_reset_system() buggy! Reboot through BIOS\n");
 		machine_real_restart(MRR_BIOS);
 		return;
-- 
2.39.3 (Apple Git-146)


             reply	other threads:[~2024-04-27  5:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-27  5:25 linke li [this message]
2024-04-29 15:40 ` [PATCH] x86/efi: mark racy access on efi_rts_work.efi_rts_id Ard Biesheuvel
2024-05-01  2:59   ` linke li

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=tencent_E910110547D287B13FEDB6E161D8874E6E06@qq.com \
    --to=lilinke99@qq.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xujianhao01@gmail.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).