All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/speculation: Check whether speculation is force disabled
@ 2020-06-03  7:12 Tada, Kenta (Sony)
  2020-06-03 15:39 ` Waiman Long
  0 siblings, 1 reply; 6+ messages in thread
From: Tada, Kenta (Sony) @ 2020-06-03  7:12 UTC (permalink / raw)
  To: x86, tglx, mingo, bp, hpa, jpoimboe, peterz, tony.luck, longman,
	pawan.kumar.gupta
  Cc: linux-kernel

Once PR_SPEC_FORCE_DISABLE is set, users cannot set PR_SPEC_ENABLE.
This commit checks whether PR_SPEC_FORCE_DISABLE was previously set.

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
---
 arch/x86/kernel/cpu/bugs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index ed54b3b21c39..678ace157035 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1173,6 +1173,9 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl)
 		if (spectre_v2_user == SPECTRE_V2_USER_STRICT ||
 		    spectre_v2_user == SPECTRE_V2_USER_STRICT_PREFERRED)
 			return -EPERM;
+		/* If speculation is force disabled, enable is not allowed */
+		if (task_spec_ib_force_disable(task))
+			return -EPERM;
 		task_clear_spec_ib_disable(task);
 		task_update_spec_tif(task);
 		break;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-17  0:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  7:12 [PATCH] x86/speculation: Check whether speculation is force disabled Tada, Kenta (Sony)
2020-06-03 15:39 ` Waiman Long
2020-06-04  7:29   ` Tada, Kenta (Sony)
2020-06-04 16:10     ` Waiman Long
2020-06-05 12:07       ` Tada, Kenta (Sony)
2020-06-17  0:15         ` Tada, Kenta (Sony)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.