Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7427029ybp; Wed, 16 Oct 2019 08:29:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwc8vE9ZRdPrlu7jmhy9OdToCqLBAP4vVMk8I3UfdE/zBNG2G4tntd3ZCo4TDYN3uf+um70 X-Received: by 2002:a50:b2c4:: with SMTP id p62mr39285107edd.128.1571239783935; Wed, 16 Oct 2019 08:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571239783; cv=none; d=google.com; s=arc-20160816; b=cYHqzWXWvQVM0gU9g+kUsnpSQ6TD9sSPMoR9ElVj2i9t+Chh8NeUBY68XZMukm+W7F 2Ee9ruCUze9xqaau4NTak0NltpboKmWBGlgu1+TSvjPWty1wtuZWND/ld2Gtj3SV3CcH 3oWDshGogGIfnFUDnvGuPpmgoRNdfnDwdheb3ZswrrYZ/S8vu9agTM+ioVyuh3fvb3/h od6YiXZgOO/xV/tx6tHkHdJ+bGKb4kBpDE3eRrweaFJx+hsx5zwZcDgTJ53qZQOfd1x/ BnlZbj3qzBpNZxDLQ1k4GG4Z6ESGCwFSohm0A6i8PkVxLJ+lwKsHDaSYkUzLc+js4DFj T4LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=sp+TOI7hFkgBjviVfJR41zFXBwGqiD7LhdYiUqjtUsw=; b=clNfxzze/qrSwQKkKHiZBFAeFaxj5kv0QSW2p34TmFims0TKLVfiyqePgfg5yvVt2d SIetjRF/EDzlrm5fXEM+BaLJ+z7GftBi80JpEzR2s/xh5+Buy5cw+mWtwkMV5nK7zK+0 +WqOlQZnOUzILZavIBkbC8Rxkyl2T5pu1DNda0rQBHso2f6csc5cgMS/NwyveShBEjIY VjFp2JGZ5c4S4Vo7Ic0QbeKJYCKpMHHapFQmuIZ6sOgXrOM1N9C+SJBPNGcYqlcea5lM nVvWsRM/UPE5Gm3+ccTDh5VnNBM1z5bGxEK3k8knYxfljGvW84k8Zq1yMDbbadJfDaqK bJVw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j38si18026826ede.374.2019.10.16.08.29.20; Wed, 16 Oct 2019 08:29:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393018AbfJPMYp (ORCPT + 99 others); Wed, 16 Oct 2019 08:24:45 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:50136 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392991AbfJPMYo (ORCPT ); Wed, 16 Oct 2019 08:24:44 -0400 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iKiLZ-0004qc-D2; Wed, 16 Oct 2019 14:24:09 +0200 Date: Wed, 16 Oct 2019 14:24:08 +0200 (CEST) From: Thomas Gleixner To: Al Viro cc: Linus Torvalds , Guenter Roeck , Linux Kernel Mailing List , linux-fsdevel , Ingo Molnar , Peter Zijlstra , Darren Hart , linux-arch@vger.kernel.org Subject: Re: [RFC] change of calling conventions for arch_futex_atomic_op_inuser() In-Reply-To: <20191016121232.GA28742@ZenIV.linux.org.uk> Message-ID: References: <20191010195504.GI26530@ZenIV.linux.org.uk> <20191011001104.GJ26530@ZenIV.linux.org.uk> <20191013181333.GK26530@ZenIV.linux.org.uk> <20191013191050.GL26530@ZenIV.linux.org.uk> <20191013195949.GM26530@ZenIV.linux.org.uk> <20191015180846.GA31707@ZenIV.linux.org.uk> <20191016121232.GA28742@ZenIV.linux.org.uk> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Oct 2019, Al Viro wrote: > On Tue, Oct 15, 2019 at 07:08:46PM +0100, Al Viro wrote: > > [futex folks and linux-arch Cc'd] > > > Another question: right now we have > > if (!access_ok(uaddr, sizeof(u32))) > > return -EFAULT; > > > > ret = arch_futex_atomic_op_inuser(op, oparg, &oldval, uaddr); > > if (ret) > > return ret; > > in kernel/futex.c. Would there be any objections to moving access_ok() > > inside the instances and moving pagefault_disable()/pagefault_enable() outside? > > > > Reasons: > > * on x86 that would allow folding access_ok() with STAC into > > user_access_begin(). The same would be doable on other usual suspects > > (arm, arm64, ppc, riscv, s390), bringing access_ok() next to their > > STAC counterparts. > > * pagefault_disable()/pagefault_enable() pair is universal on > > all architectures, really meant to by the nature of the beast and > > lifting it into kernel/futex.c would get the same situation as with > > futex_atomic_cmpxchg_inatomic(). Which also does access_ok() inside > > the primitive (also foldable into user_access_begin(), at that). > > * access_ok() would be closer to actual memory access (and > > out of the generic code). > > > > Comments? > > FWIW, completely untested patch follows; just the (semimechanical) conversion > of calling conventions, no per-architecture followups included. Could futex > folks ACK/NAK that in principle? Makes sense and does not change any of the futex semantics. Go wild. Thanks, tglx