From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 919BCC2D0A8 for ; Wed, 23 Sep 2020 19:48:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE85020888 for ; Wed, 23 Sep 2020 19:48:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE85020888 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CB44C6B0003; Wed, 23 Sep 2020 15:48:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C48D76B005A; Wed, 23 Sep 2020 15:48:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2C1A6B0003; Wed, 23 Sep 2020 15:48:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id 8EAC26B0037 for ; Wed, 23 Sep 2020 15:48:09 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4DFF51F10 for ; Wed, 23 Sep 2020 19:48:09 +0000 (UTC) X-FDA: 77295362298.30.tub18_5d0625827159 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 38238180B3C83; Wed, 23 Sep 2020 19:48:09 +0000 (UTC) X-HE-Tag: tub18_5d0625827159 X-Filterd-Recvd-Size: 4307 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [195.92.253.2]) by imf20.hostedemail.com (Postfix) with ESMTP; Wed, 23 Sep 2020 19:48:08 +0000 (UTC) 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: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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...