# Re: \[RFC PATCH for 4.18\] rseq: use \_\_u64 for rseq\_cs fields, validate user inputs

- From: Peter Zijlstra \<peterz@infradead.org\>
- Date: 2018-07-03 18:11:07 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2018/07/5323462
- Thread: https://ratatoskr.run/linux-api/2018/07/5322481/t.md

```text
On Tue, Jul 03, 2018 at 10:59:45AM -0700, Linus Torvalds wrote:
> On Tue, Jul 3, 2018 at 10:49 AM Peter Zijlstra [ref] wrote:
> >
> > > I can simply document that loads/stores from/to all struct rseq fields
> > > should be thread-local then ?
> >
> > I'm not sure that covers things sufficiently. You really want the
> > userspace load/stores to be single instructions.
> 
> Actually, I think we should try very hard to limit even that to _just_
> the rseq pointer itself.

> So I'd suggest that the only part we aim to have any "atomic" behavior
> at all is for the individual fields in "struct rseq" itself. So the
> cpu id and the base pointer and the flags. And even they are
> thread-local, so the atomicity is not about the kernel, but about user
> space needing to read and update them in word-sized chunks.
> 
> End result: absolutely nothing is atomic for the kernel.

Yes, agreed, that is what I meant but very poorly expressed. Only the
rseq bits themselves need this single-copy atomic stuff -- for
userspace.
```
