diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2021-06-23 14:02:09 +0200 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-06-23 19:09:53 +0200 |
commit | ff7ebff47c595e747aa1bb10d8a30b2acb7d425b (patch) | |
tree | bc54bc2926e01a72b21c1f82f970391d614f550a /arch/x86/include/asm/pkru.h | |
parent | 739e2eec0f4849eb411567407d61491f923db405 (diff) | |
download | linux-ff7ebff47c595e747aa1bb10d8a30b2acb7d425b.tar.bz2 |
x86/pkru: Provide pkru_write_default()
Provide a simple and trivial helper which just writes the PKRU default
value without trying to fiddle with the task's xsave buffer.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121455.513729794@linutronix.de
Diffstat (limited to 'arch/x86/include/asm/pkru.h')
-rw-r--r-- | arch/x86/include/asm/pkru.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pkru.h b/arch/x86/include/asm/pkru.h index 19d3d7b98465..7e4550911c51 100644 --- a/arch/x86/include/asm/pkru.h +++ b/arch/x86/include/asm/pkru.h @@ -60,4 +60,12 @@ static inline void write_pkru(u32 pkru) fpregs_unlock(); } +static inline void pkru_write_default(void) +{ + if (!cpu_feature_enabled(X86_FEATURE_OSPKE)) + return; + + wrpkru(pkru_get_init_value()); +} + #endif |