lkml.org 
[lkml]   [2019]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-04-10 23:25    [W:0.077 / U:3.116 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site