Skip to contentSkip to conversation

arm32: spectre-v2: using raw_smp_processor_id() for preemptible

RFC PATCH New Hanjun Guo 1 participant 1 message Apr 5, 2019 Arm (32-bit)

lore
Share & tools
lore

Hanjun Guo

author
#0 lore raw

RFC PATCH 1/1 arm32: spectre-v2: using raw_smp_processor_id() for preemptible

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.

---
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(-)
arch/arm/include/asm/system_misc.h +1 -1
index 66f6a3a..55e3b2b 100644
@@ -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();
 }
Signature · 7 lines
1.7.12.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel