Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp669032pxk; Wed, 23 Sep 2020 12:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvwrJoEtWcdW6eCazAFJ2BqCAWH/diJQ1ZNsdQy+/OdTClzgZCqSBRXoXDUYLxzytkN9sT X-Received: by 2002:a50:e3c4:: with SMTP id c4mr1051478edm.90.1600890644042; Wed, 23 Sep 2020 12:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600890644; cv=none; d=google.com; s=arc-20160816; b=UmQAQ+uuSxBoTzVax9XDaZLIToJI9oZA65IsoONCPFut/4PlyJ5BGXJ+tK6A7PZYjh wzqpt5KPFokLeT/ExKGQK4xb1kRCIaTSTensXzcNBeTQfDKpUifbfzTS663zfwIB4rb+ RW/dQhat8AHNJ3SvL/RapsppgKTtAoDgqt21VooDN/n+erdwOE0Ubcl1SytrYBOkMpW0 K6ZotHHC27SjDyAN8783GngvkJcmaltSJlzzxlCyCL5cIj+g7fB/wCE8xwULngCwb45w /2+P9U80TqFnehbmawUvSr/sMr8HFtk8Qnh1S7fFxb5bd0M/R/6z735MOmjsKu0IT4zx nkjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=7LLD5PypAG0i0DPvnp2dtzH0HqeNHVwArplGuhCPaX8=; b=070DppbIublMRqlKQVRc15LZrnHBYwsVjn124DLBi4/1GjIyzA/U/t75dQWMUsNPtV Ix1Surc7IvyPim6gOwLXNIanN7H0gBsOWwJgloQSrZyulzb6F01Tr7Bqf2xiMn1ZiCn3 0TkwmpuVal+I8qzFsHg7HQ6Bq46SJJgrl/EACgnV8AEWKyXc5sP7+GwomvtE2I31hmSE ZNUc2xDev210Zu9lj/Kk/q9Ky5DAV6XhupbSFYXrS/9vUQYbwtPLhkfmAqzFWKG2xfDf u2gPkSHTp8/Sd5E1h0szyqRXlSH0t+T1TmGhDnwrH5YMElRLZ5ffygdH4ntYwFw6uKDB pQhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si701078edy.300.2020.09.23.12.50.20; Wed, 23 Sep 2020 12:50:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbgIWTsI (ORCPT + 99 others); Wed, 23 Sep 2020 15:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbgIWTsH (ORCPT ); Wed, 23 Sep 2020 15:48:07 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18231C0613CE; Wed, 23 Sep 2020 12:48:07 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLAk7-004l0B-Ms; Wed, 23 Sep 2020 19:47:55 +0000 Date: Wed, 23 Sep 2020 20:47:55 +0100 From: Al Viro To: Arnd Bergmann Cc: Christoph Hellwig , Andrew Morton , Jens Axboe , David Howells , David Laight , Linux ARM , "linux-kernel@vger.kernel.org" , "open list:BROADCOM NVRAM DRIVER" , Parisc List , linuxppc-dev , linux-s390 , sparclinux , linux-block , linux-scsi , Linux FS-devel Mailing List , linux-aio , io-uring@vger.kernel.org, linux-arch , Linux-MM , Networking , keyrings@vger.kernel.org, LSM List Subject: Re: [PATCH 5/9] fs: remove various compat readv/writev helpers Message-ID: <20200923194755.GR3421308@ZenIV.linux.org.uk> References: <20200923060547.16903-1-hch@lst.de> <20200923060547.16903-6-hch@lst.de> <20200923142549.GK3421308@ZenIV.linux.org.uk> <20200923143251.GA14062@lst.de> <20200923145901.GN3421308@ZenIV.linux.org.uk> <20200923163831.GO3421308@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 08:45:51PM +0200, Arnd Bergmann wrote: > On Wed, Sep 23, 2020 at 6:38 PM Al Viro wrote: > > > > I wonder if we should do something like > > > > SYSCALL_DECLARE3(readv, unsigned long, fd, const struct iovec __user *, vec, > > unsigned long, vlen); > > in syscalls.h instead, and not under that ifdef. > > > > Let it expand to declaration of sys_...() in generic case and, on x86, into > > __do_sys_...() and __ia32_sys_...()/__x64_sys_...(), with types matching > > what SYSCALL_DEFINE ends up using. > > > > Similar macro would cover compat_sys_...() declarations. That would > > restore mismatch checking for x86 and friends. AFAICS, the cost wouldn't > > be terribly high - cpp would have more to chew through in syscalls.h, > > but it shouldn't be all that costly. Famous last words, of course... > > > > Does anybody see fundamental problems with that? > > I've had some ideas along those lines in the past and I think it should work. > > As a variation of this, the SYSCALL_DEFINEx() macros could go away > entirely, leaving only the macro instantiations from the header to > require that syntax. It would require first changing the remaining > architectures to build the syscall table from C code instead of > assembler though. > > Regardless of that, another advantage of having the SYSCALL_DECLAREx() > would be the ability to include that header file from elsewhere with a different > macro definition to create a machine-readable version of the interface when > combined with the syscall.tbl files. This could be used to create a user > space stub for calling into the low-level syscall regardless of the > libc interfaces, > or for synchronizing the interfaces with strace, qemu-user, or anything that > needs to deal with the low-level interface. FWIW, after playing with that for a while... Do we really want the compat_sys_...() declarations to live in linux/compat.h? Most of the users of that file don't want those; why not move them to linux/syscalls.h? Reason: there's a lot more users of linux/compat.h than those of linux/syscalls.h - it's pulled by everything in the networking stack, for starters...