“11100b1dfb6e9444d54d38e822753f59ee42a7e6”上不存在“arch/um/include/shared/kern_util.h”
提交 81e68102 编写于 作者: T Thomas Gleixner 提交者: Lin Wang

x86/pkeys: Revert a5eff725 ("x86/pkeys: Add PKRU value to init_fpstate")

mainline inclusion
from mainline-v5.14-rc1
commit b3607269
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I590ZC
CVE: NA

Intel-SIG: commit b3607269 x86/pkeys: Revert a5eff725 ("x86/pkeys: Add PKRU value to init_fpstate").

--------------------------------

This cannot work and it's unclear how that ever made a difference.

init_fpstate.xsave.header.xfeatures is always 0 so get_xsave_addr() will
always return a NULL pointer, which will prevent storing the default PKRU
value in init_fpstate.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Reviewed-by: NBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121451.451391598@linutronix.deSigned-off-by: NLin Wang <lin.x.wang@intel.com>
上级 5d55ecf9
...@@ -468,8 +468,6 @@ static bool pku_disabled; ...@@ -468,8 +468,6 @@ static bool pku_disabled;
static __always_inline void setup_pku(struct cpuinfo_x86 *c) static __always_inline void setup_pku(struct cpuinfo_x86 *c)
{ {
struct pkru_state *pk;
/* check the boot processor, plus compile options for PKU: */ /* check the boot processor, plus compile options for PKU: */
if (!cpu_feature_enabled(X86_FEATURE_PKU)) if (!cpu_feature_enabled(X86_FEATURE_PKU))
return; return;
...@@ -480,9 +478,6 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c) ...@@ -480,9 +478,6 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c)
return; return;
cr4_set_bits(X86_CR4_PKE); cr4_set_bits(X86_CR4_PKE);
pk = get_xsave_addr(&init_fpstate.xsave, XFEATURE_PKRU);
if (pk)
pk->pkru = init_pkru_value;
/* /*
* Seting X86_CR4_PKE will cause the X86_FEATURE_OSPKE * Seting X86_CR4_PKE will cause the X86_FEATURE_OSPKE
* cpuid bit to be set. We need to ensure that we * cpuid bit to be set. We need to ensure that we
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <asm/cpufeature.h> /* boot_cpu_has, ... */ #include <asm/cpufeature.h> /* boot_cpu_has, ... */
#include <asm/mmu_context.h> /* vma_pkey() */ #include <asm/mmu_context.h> /* vma_pkey() */
#include <asm/fpu/internal.h> /* init_fpstate */
int __execute_only_pkey(struct mm_struct *mm) int __execute_only_pkey(struct mm_struct *mm)
{ {
...@@ -154,7 +153,6 @@ static ssize_t init_pkru_read_file(struct file *file, char __user *user_buf, ...@@ -154,7 +153,6 @@ static ssize_t init_pkru_read_file(struct file *file, char __user *user_buf,
static ssize_t init_pkru_write_file(struct file *file, static ssize_t init_pkru_write_file(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos) const char __user *user_buf, size_t count, loff_t *ppos)
{ {
struct pkru_state *pk;
char buf[32]; char buf[32];
ssize_t len; ssize_t len;
u32 new_init_pkru; u32 new_init_pkru;
...@@ -177,10 +175,6 @@ static ssize_t init_pkru_write_file(struct file *file, ...@@ -177,10 +175,6 @@ static ssize_t init_pkru_write_file(struct file *file,
return -EINVAL; return -EINVAL;
WRITE_ONCE(init_pkru_value, new_init_pkru); WRITE_ONCE(init_pkru_value, new_init_pkru);
pk = get_xsave_addr(&init_fpstate.xsave, XFEATURE_PKRU);
if (!pk)
return -EINVAL;
pk->pkru = new_init_pkru;
return count; return count;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册