linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] arm32: spectre-v2: using raw_smp_processor_id() for preemptible
@ 2019-04-05  3:04 Hanjun Guo
  0 siblings, 0 replies; only message in thread
From: Hanjun Guo @ 2019-04-05  3:04 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Marc Zyngier, Hanjun Guo, linux-arm-kernel, Jason Yan

When enabling CONFIG_DEBUG_PREEMPT, there is a BUG report:

BUG: using smp_processor_id() in preemptible [00000000] code: remap_file_page/29696
caller is __do_user_fault+0x34/0x114

It turns out that in harden_branch_predictor() using smp_processor_id()
to get current cpu's callback for harden_branch_predictor().

This seems to be a false positive report as we need this running cpu's
callback to clean the cache or BTB event it's preemptible, so using
raw_smp_processor_id() instead to eliminate the false positive report.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
Hi,

Not sure I'm doing the right thing, so send as RFC.

 arch/arm/include/asm/system_misc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
index 66f6a3a..55e3b2b 100644
--- a/arch/arm/include/asm/system_misc.h
+++ b/arch/arm/include/asm/system_misc.h
@@ -22,7 +22,7 @@
 static inline void harden_branch_predictor(void)
 {
 	harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn,
-						  smp_processor_id());
+						  raw_smp_processor_id());
 	if (fn)
 		fn();
 }
-- 
1.7.12.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-05  3:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05  3:04 [RFC PATCH] arm32: spectre-v2: using raw_smp_processor_id() for preemptible Hanjun Guo

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).