lkml.org 
[lkml]   [2022]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/fpu: Allow PKRU to be (once again) written by ptrace.

* Kyle Huey <me@kylehuey.com> wrote:

> > Also, what's the security model for this register, do we trust all
> > input values user-space provides for the PKRU field in the XSTATE? I
> > realize that WRPKRU already gives user-space write access to the
> > register - but does the CPU write it all into the XSTATE, with no
> > restrictions on content whatsoever?
>
> There is no security model for this register. The CPU does write whatever
> is given to WRPKRU (or XRSTOR) into the PKRU register. The pkeys(7) man
> page notes:
>
> Protection keys have the potential to add a layer of security and
> reliability to applications. But they have not been primarily designed as
> a security feature. For instance, WRPKRU is a completely unprivileged
> instruction, so pkeys are useless in any case that an attacker controls
> the PKRU register or can execute arbitrary instructions.

Ok - allowing ptrace to set the full 32 bits of the PKRU register seems OK
then, and is 100% equivalent to using WRPKRU, right? So there's no implicit
masking/clearing of bits depending on how many keys are available, or other
details where WRPKRU might differ from a pure 32-bit per thread write,
correct?

Thanks,

Ingo

\
 
 \ /
  Last update: 2022-08-03 19:26    [W:0.049 / U:3.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site