# Re: \[PATCH 6/9\] x86, pkeys: add pkey set/get syscalls

- From: Ingo Molnar \<mingo@kernel.org\>
- Date: 2016-07-18 09:57:07 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2016/07/4796906
- Thread: https://ratatoskr.run/linux-api/2016/07/4790123/t.md

```text

* Andy Lutomirski [ref] wrote:

> On Thu, Jul 14, 2016 at 1:07 AM, Ingo Molnar [ref] wrote:
> >
> > * Andy Lutomirski [ref] wrote:
> >
> >> On Wed, Jul 13, 2016 at 12:56 AM, Ingo Molnar [ref] wrote:
> >> >
> >> > * Andy Lutomirski [ref] wrote:
> >> >
> >> >> > If we push a PKRU value into a thread between the rdpkru() and wrpkru(), we'll
> >> >> > lose the content of that "push".  I'm not sure there's any way to guarantee
> >> >> > this with a user-controlled register.
> >> >>
> >> >> We could try to insist that user code uses some vsyscall helper that tracks
> >> >> which bits are as-yet-unassigned.  That's quite messy, though.
> >> >
> >> > Actually, if we turned the vDSO into something more like a minimal user-space
> >> > library with the ability to run at process startup as well to prepare stuff
> >> > then it's painful to get right only *once*, and there will be tons of other
> >> > areas where a proper per thread data storage on the user-space side would be
> >> > immensely useful!
> >>
> >> Doing this could be tricky: how exactly is the vDSO supposed to find per-thread
> >> data without breaking existing glibc?
> >
> > So I think the way this could be done is by allocating it itself. The vDSO vma
> > itself is 'external' to glibc as well to begin with - this would be a small
> > extension to that concept.
> 
> But how does the vdso code find it?  FS and GS are both spoken for by existing 
> userspace.

Minimally relinking itself on a per mm basis?

Thanks,

	Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
```
