Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2424609ybi; Thu, 18 Jul 2019 08:11:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhASpGAq9JQ81Y/O002p8UJoF/1Qq4RaCWLi3UU/klKPVqLNbJXFapJg0dCSjOIAnt4HQ5 X-Received: by 2002:a65:6682:: with SMTP id b2mr39921099pgw.214.1563462677493; Thu, 18 Jul 2019 08:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563462677; cv=none; d=google.com; s=arc-20160816; b=BeR8iiAUSFkQzeSJ8k5DP3xuP3eG4MuzBuUlOcasTloBlWF+OVYie8a6lrHXjJV9As UwGKZX1PFjUOZpkQsCRcgK5onV8PB9ksfMdPUosVKbohQKfRY4ibIisiyE21R0IERTmH kFY95QDJdgOnmkqKa5HdJaN4c4m2hmxh16qdAh3eKFApPuPzrndBOTEqo5rq8XMne3qM cyo7FPaogmamf3V4aZGvezhzmvtAo6f0y/mmi16nr9SDH0PrNSZCitVdeQQqDbbIq5zD QQxkRMfoKL5I5sncUBUtXvylIMY0XeQPbR3eHIxGfdxGhjKf7dcaI36ge9w+M4HuErCe lNDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=1XVWuLALNboPCBpMHvtA7g3CoUrKrF0vBnrtFanWPT4=; b=mEEhzYNMfXkTAqB+2W25f6VRuY8Gz2D0ejr15/ecSufSPf+nTBPmkifigepmwl+UxF MZpsSK1p1KX51RHP61C4gj8lN4avlwWU5KuN9W0QzZB3oIA0laRD8Oqffubtvj28U1c+ WxUcplSvdJYpUhbl78wv5XvyY+LYjt2BNvSSqxuuWCHkrzCHT58eSIAupCeywl04rDeD Xu8fnDQ/Auv7W1jzrNEZUDlspxC8vzQcI6hPHz0xMzZzxNu0tlyizhiyHYMs61oFMFnt bIJr+mnDEi7aLhdzRhGUz1njo8F1KYN+5cFEJ2O2Epp34gn+7fvYBo19yEqTIOLeSeCV Hrxg== 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 v13si205296pgr.282.2019.07.18.08.11.01; Thu, 18 Jul 2019 08:11:17 -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 S2403801AbfGRPKl (ORCPT + 99 others); Thu, 18 Jul 2019 11:10:41 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:40739 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727623AbfGRPKk (ORCPT ); Thu, 18 Jul 2019 11:10:40 -0400 Received: by mail-qk1-f195.google.com with SMTP id s145so20722123qke.7; Thu, 18 Jul 2019 08:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1XVWuLALNboPCBpMHvtA7g3CoUrKrF0vBnrtFanWPT4=; b=uNMGyKFpiV5/NdDwnLap3nQ/K1Tm9DD+6GyGcMY2Qe78+LIG0HJg8gvmpe7KNtScX+ ocmxdsLFnmQHavB02uUnWdITNtvdgZUVV6gjGYtzUgUyL101bx2COA+P5GJEB8nUL/si xX9VNpjurF/YIH8K4pRbOmNUfp2t9ascXvvzAmN8JqbF3LGUnbcVvWG+r/eY7BW6dDbE knTCE31c6j90B4zJPTKfVo0AfaPijfILaJmhBbuGf3nOxfSRW+FIerwKGcN9G9c7h1J9 QljEyAaRfwsTvFKIQO0h8Zsw7fzxHGQhpcH2zj+Ff7MPOAMzDxkNBXC9D6swUqj3HG9E SpRA== X-Gm-Message-State: APjAAAV7gMkfUYn5o8N51yJkmd6XGejNnOOrLcYFBcHIhSrSlqqUt1Gw lGoO9EV8UtrmkKPQlogNaMSLihSIjegnFCVtbl4= X-Received: by 2002:a37:ad12:: with SMTP id f18mr30435448qkm.3.1563462638194; Thu, 18 Jul 2019 08:10:38 -0700 (PDT) MIME-Version: 1.0 References: <20190706145737.5299-1-cyphar@cyphar.com> <20190706145737.5299-9-cyphar@cyphar.com> In-Reply-To: <20190706145737.5299-9-cyphar@cyphar.com> From: Arnd Bergmann Date: Thu, 18 Jul 2019 17:10:21 +0200 Message-ID: Subject: Re: [PATCH v9 08/10] open: openat2(2) syscall To: Aleksa Sarai Cc: Al Viro , Jeff Layton , "J. Bruce Fields" , David Howells , Shuah Khan , Shuah Khan , Christian Brauner , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Aleksa Sarai , Linus Torvalds , containers@lists.linux-foundation.org, alpha , Linux API , linux-arch , Linux ARM , Linux FS-devel Mailing List , linux-ia64@vger.kernel.org, Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , linux-m68k , linux-mips@vger.kernel.org, Parisc List , linuxppc-dev , linux-s390 , Linux-sh list , linux-xtensa@linux-xtensa.org, sparclinux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 6, 2019 at 5:00 PM Aleksa Sarai wrote: > diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl > index 9e7704e44f6d..1703d048c141 100644 > --- a/arch/alpha/kernel/syscalls/syscall.tbl > +++ b/arch/alpha/kernel/syscalls/syscall.tbl > @@ -461,6 +461,7 @@ > 530 common getegid sys_getegid > 531 common geteuid sys_geteuid > 532 common getppid sys_getppid > +533 common openat2 sys_openat2 > # all other architectures have common numbers for new syscall, alpha > # is the exception. > 534 common pidfd_send_signal sys_pidfd_send_signal My plan here was to add new syscalls in the same order as everwhere else, just with the number 110 higher. In the long run, I hope we can automate this. > diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl > index aaf479a9e92d..4ad262698396 100644 > --- a/arch/arm/tools/syscall.tbl > +++ b/arch/arm/tools/syscall.tbl > @@ -447,3 +447,4 @@ > 431 common fsconfig sys_fsconfig > 432 common fsmount sys_fsmount > 433 common fspick sys_fspick > +434 common openat2 sys_openat2 434 is already used in linux-next, I suggest you use 437 (Palmer just submitted fchmodat4, which could become 436). > +/** > + * Arguments for how openat2(2) should open the target path. If @extra is zero, > + * then openat2(2) is identical to openat(2). > + * > + * @flags: O_* flags (unknown flags ignored). > + * @mode: O_CREAT file mode (ignored otherwise). > + * @upgrade_mask: restrict how the O_PATH may be re-opened (ignored otherwise). > + * @resolve: RESOLVE_* flags (-EINVAL on unknown flags). > + * @reserved: reserved for future extensions, must be zeroed. > + */ > +struct open_how { > + __u32 flags; > + union { > + __u16 mode; > + __u16 upgrade_mask; > + }; > + __u16 resolve; > + __u64 reserved[7]; /* must be zeroed */ > +}; We can have system calls with up to six arguments on all architectures, so this could still be done more conventionally without the indirection: like long openat2(int dfd, const char __user * filename, int flags, mode_t mode_mask, __u16 resolve); In fact, that seems similar enough to the existing openat() that I think you could also just add the fifth argument to the existing call when a newly defined flag is set, similarly to how we only use the 'mode' argument when O_CREAT or O_TMPFILE are set. > --- a/include/linux/syscalls.h > +++ b/include/linux/syscalls.h This file seems to lack a declaration for the system call, which means it will cause a build failure on some architectures, e.g. arch/arc/kernel/sys.c: #define __SYSCALL(nr, call) [nr] = (call), void *sys_call_table[NR_syscalls] = { [0 ... NR_syscalls-1] = sys_ni_syscall, #include }; Arnd