From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs Date: Tue, 3 Jul 2018 20:10:28 +0200 Message-ID: <20180703181028.GA2494@hirez.programming.kicks-ass.net> References: <20180703082955.GH3704@osiris> <20180703084312.GU2494@hirez.programming.kicks-ass.net> <20180703085546.GJ3704@osiris> <20180703092113.GV2494@hirez.programming.kicks-ass.net> <20180703164048.i2te5gjemcafqzwf@two.firstfloor.org> <20180703173451.GX2494@hirez.programming.kicks-ass.net> <399697782.11820.1530639539750.JavaMail.zimbra@efficios.com> <20180703174833.GZ2494@hirez.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Mathieu Desnoyers , Andi Kleen , Heiko Carstens , Andy Lutomirski , Thomas Gleixner , Linux Kernel Mailing List , Linux API , Paul McKenney , Boqun Feng , Dave Watson , Paul Turner , Andrew Morton , Russell King - ARM Linux , Ingo Molnar , Peter Anvin , Christoph Lameter , Ben Maurer , Steven Rostedt , Josh Triplett , Catalin Marinas List-Id: linux-api@vger.kernel.org On Tue, Jul 03, 2018 at 10:59:45AM -0700, Linus Torvalds wrote: > On Tue, Jul 3, 2018 at 10:49 AM Peter Zijlstra 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.