Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1414248imm; Tue, 3 Jul 2018 10:40:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe+Pf0H5mIzMjnjRkF6825aCG7QMyazR6cQaTUtsn3JzQefHwryNSOtV5pwlU2cgnF3tpEK X-Received: by 2002:a65:6110:: with SMTP id z16-v6mr14361921pgu.412.1530639629497; Tue, 03 Jul 2018 10:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530639629; cv=none; d=google.com; s=arc-20160816; b=Y0CvzweGMBxK0vkbowu7CnTPKIznjhmTcyOLfA8mHIVAkdHfObP2KoQCQbHinMsdfB yvQaZhnbXVaWvGXQ5jpgGBdFTfI62k2RD9FHfZVjXntGXRhzSEX5AtWuHKmntMV7FWty 47+DZExFNnnHT+SF1S44ZEz1+rnH14iRPhkIorrmh3j59YUCdf2ak519ghjLJ6nQzpTQ EOHghqMTlY4PvHSb78Mz7zcFjp4DuSi4DQfgT5vSXQm+HKb1J+mUVi8ve93+99wKmmmH IYTpyRsfYkMMED0Un6edMGK3uquApsNuIuZ9H3VUk6ScO0dM5zcMClSdhOMC8NNCrLTZ 4FeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter :arc-authentication-results; bh=Z+6XUbJW3XsQ3K4R6g/oDi3s1GKmuJoAdXwHAySA55w=; b=0rvw5Q6xylZ9HvIVWUpEpFClnUkoSAEgU3er8Pqzq1DjvW7OILhCyo8UEY+nFqrgkl UPsJI13K95GxQIWIOZiqYXdku+nA55TSTFDzh20uaPd0mOvBkhSxfuGIDk94Z4f//f29 8r3KwlvxXaz4t+6lIFFirLa6aUBehrmQH8q9feNr428Q379lEw0c2qhUe84ip2Od91FC DlOv8TjozYywHt83RSdHjZcsGrLAWvlP22rMARqpKN/HTCRufQUcHFOF0rJ+zzdkv6oV R+YMxECKsGF5gtKsjTnHXQkwVedvpP9y87PYN5Djx2lLvFxRBkEASyauclmsAfz7TCHj hQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=We5U+lEc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n68-v6si1422101pga.662.2018.07.03.10.40.14; Tue, 03 Jul 2018 10:40:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=We5U+lEc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934303AbeGCRjC (ORCPT + 99 others); Tue, 3 Jul 2018 13:39:02 -0400 Received: from mail.efficios.com ([167.114.142.138]:57094 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933063AbeGCRjB (ORCPT ); Tue, 3 Jul 2018 13:39:01 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 9AF032305A4; Tue, 3 Jul 2018 13:39:00 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id NP_DPV-yewK8; Tue, 3 Jul 2018 13:39:00 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id E629A2305A0; Tue, 3 Jul 2018 13:38:59 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com E629A2305A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1530639539; bh=Z+6XUbJW3XsQ3K4R6g/oDi3s1GKmuJoAdXwHAySA55w=; h=Date:From:To:Message-ID:MIME-Version; b=We5U+lEcmE8SlTieV6/xEBtM8Q+o5KNbG5Zk8RLA/hgDYn/9wVNzYnJ1J10Ha7lMq yhJ2la1s5LJqlEbix3yUdj9mSGqwYVVCUAt0blpZDIdAsIv/9WewbJicD8qsLeV88O 4DqHgjFomWPVKCqAkvD+d8PDCAaCvvHU/rTbxdbOcT0QDf8AfFhRJynoOVxqfJCNSE J6wFUpzCX6601Brb8guXUbXcGX5oWzEijpVpwCsDiLbKowDIKhfjcKfbjB5+UueB8O yUHLXo0SnJTWyUm7TbgwnrUmnuTUzo8gSBVhiEinCoqQYr8sEyz+8SqiyNaurJOQf0 8BdkY4B+5DKDA== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id Z65sK-yiY4Q4; Tue, 3 Jul 2018 13:38:59 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id C398C23059A; Tue, 3 Jul 2018 13:38:59 -0400 (EDT) Date: Tue, 3 Jul 2018 13:38:59 -0400 (EDT) From: Mathieu Desnoyers To: Peter Zijlstra Cc: Linus Torvalds , Andi Kleen , heiko carstens , Andy Lutomirski , Thomas Gleixner , linux-kernel , linux-api , "Paul E. McKenney" , Boqun Feng , Dave Watson , Paul Turner , Andrew Morton , Russell King , Ingo Molnar , "H. Peter Anvin" , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes , Michal Simek , schwidefsky , gor Message-ID: <399697782.11820.1530639539750.JavaMail.zimbra@efficios.com> In-Reply-To: <20180703173451.GX2494@hirez.programming.kicks-ass.net> References: <858886246.10882.1530583291379.JavaMail.zimbra@efficios.com> <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> Subject: Re: [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.8_GA_2096 (ZimbraWebClient - FF52 (Linux)/8.8.8_GA_1703) Thread-Topic: rseq: use __u64 for rseq_cs fields, validate user inputs Thread-Index: jY49ZLr6KS8Cu4ynVzBYdM/e7Jj2VA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jul 3, 2018, at 1:34 PM, Peter Zijlstra peterz@infradead.org wrote: > On Tue, Jul 03, 2018 at 10:10:37AM -0700, Linus Torvalds wrote: >> On Tue, Jul 3, 2018 at 9:40 AM Andi Kleen wrote: >> > >> > So it sounds like architectures that don't have an instruction atomic u64 >> > *_user need to disable interrupts during the access, and somehow handle that >> > case when a page fault happens? >> >> No. It's actually the store by *user* space that is the critical one. >> Not the whole 64-bit value, just the low pointer part. >> >> The kernel could do it as a byte-by-byte load, really. It's >> per-thread, and once the kernel is running, it's not going to change. >> The kernel never changes the value, it just loads it from user space. > > The kernel doesn't change _this_ value, but the kernel does change other > values, like for instance rseq->cpu_id. But even there, it could use > byte stores and it is again the userspace load of that field that is > critical again and needs to be a single op. I can simply document that loads/stores from/to all struct rseq fields should be thread-local then ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com