[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <162448615063.395.10363501284970136257.tip-bot2@tip-bot2>
Date: Wed, 23 Jun 2021 22:09:10 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...e.de>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/fpu] x86/pkru: Provide pkru_get_init_value()
The following commit has been merged into the x86/fpu branch of tip:
Commit-ID: 739e2eec0f4849eb411567407d61491f923db405
Gitweb: https://git.kernel.org/tip/739e2eec0f4849eb411567407d61491f923db405
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Wed, 23 Jun 2021 14:02:08 +02:00
Committer: Borislav Petkov <bp@...e.de>
CommitterDate: Wed, 23 Jun 2021 19:02:49 +02:00
x86/pkru: Provide pkru_get_init_value()
When CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is disabled then the following
code fails to compile:
if (cpu_feature_enabled(X86_FEATURE_OSPKE)) {
u32 pkru = READ_ONCE(init_pkru_value);
..
}
because init_pkru_value is defined as '0' which makes READ_ONCE() upset.
Provide an accessor macro to avoid #ifdeffery all over the place.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Borislav Petkov <bp@...e.de>
Link: https://lkml.kernel.org/r/20210623121455.404880646@linutronix.de
---
arch/x86/include/asm/pkru.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/asm/pkru.h b/arch/x86/include/asm/pkru.h
index ec8dd28..19d3d7b 100644
--- a/arch/x86/include/asm/pkru.h
+++ b/arch/x86/include/asm/pkru.h
@@ -10,8 +10,10 @@
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
extern u32 init_pkru_value;
+#define pkru_get_init_value() READ_ONCE(init_pkru_value)
#else
#define init_pkru_value 0
+#define pkru_get_init_value() 0
#endif
static inline bool __pkru_allows_read(u32 pkru, u16 pkey)
Powered by blists - more mailing lists