Messages in this thread | | | Date | Wed, 10 Apr 2019 23:25:02 +0200 | From | Sebastian Andrzej Siewior <> | Subject | Re: [PATCH 12/27] x86/pkru: Provide .*_pkru_ins() functions |
| |
On 2019-04-10 18:52:41 [+0200], Borislav Petkov wrote: > On Wed, Apr 10, 2019 at 06:36:15PM +0200, Borislav Petkov wrote: > > Well, this is going in the wrong direction. The proper thing to do would > > be to have: > > > > rdpkru() > > wrpkru() > > > > which only do the inline asm with the respective opcodes. Just like > > rdtsc(), clflush(), etc. > > IOW, like this: > > --- > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h > index 2779ace16d23..e2948ce1376c 100644 > --- a/arch/x86/include/asm/pgtable.h > +++ b/arch/x86/include/asm/pgtable.h > @@ -127,14 +127,14 @@ static inline int pte_dirty(pte_t pte) > static inline u32 read_pkru(void) > { > if (boot_cpu_has(X86_FEATURE_OSPKE)) > - return __read_pkru(); > + return rdpkru(); > return 0; > } > > static inline void write_pkru(u32 pkru) > { > if (boot_cpu_has(X86_FEATURE_OSPKE)) > - __write_pkru(pkru); > + wrpkru(pkru);
I think if this is a simple
's@__write_pkru_ins@wrpkru@g' 's@__read_pkru_ins@rdpkru@g'
then it should work just fine and match what Dave asked for.
> } > > static inline int pte_young(pte_t pte)
Sebastian
| |