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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, 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 906A6C43140 for ; Sat, 7 Sep 2019 17:42:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A284218AE for ; Sat, 7 Sep 2019 17:42:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=amacapital-net.20150623.gappssmtp.com header.i=@amacapital-net.20150623.gappssmtp.com header.b="Ahrc72PG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390821AbfIGRm2 (ORCPT ); Sat, 7 Sep 2019 13:42:28 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35784 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391932AbfIGRm1 (ORCPT ); Sat, 7 Sep 2019 13:42:27 -0400 Received: by mail-pl1-f194.google.com with SMTP id gn20so4665552plb.2 for ; Sat, 07 Sep 2019 10:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zOxFxXxkeAXBLA4hmpQx5p2K1SwU8yRrMWsF/vzne4c=; b=Ahrc72PGzKNYWoLbwpqpkb4sblxxhLeem6jebRPHiC48yikyu8YdaM5Oje1cRKpGrE B1aFxjVmVluxNvScD9M4WSgd+3044EW5n5U/PFuuVmQG4Hbymvgt22zE94vbhcs9R725 YmVhBFQvI6AY2jzBjl65iE1N91bXW5n21nVFyaplmtDp+2SiGPjY7BdJbCgTW6FOdyps WzpWqeuBT7oibyk4x8aGykU8dzYGBQ3SiApw6VGFkEO8SPi7/aZ892rQXq+Pb+3b5ZeC PbzZzd392k2TpO4uq92p9v5vThdZeJX5HF5wKk1rRbCSaXdBoZUNJaEVn/U3I0P9Ilwr 6irw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zOxFxXxkeAXBLA4hmpQx5p2K1SwU8yRrMWsF/vzne4c=; b=haA/cR7kyRVVi9rc4kBHyr+aIY/Fe2Zur5Ku8FJmVSPKjTJF63LFI/ba7UEnCW1JA6 TXWoTKBdn63aDVS4036osGiPS5fb/faFNvCZMkgyoM2lmUX+mC1nx+V+5hDsu+D5Wkzq 7ml7bY1kWC5TfTAMlGWboHpySStfRk6AKSxTiCX0aFEDxqPaYg+AtH2yESr/9gSH6Pbz rAJwnk+fEuE8lmIxpUTl0ULachtg7PkVEPXR4WPZUNRjoJcrljlASxEIK7/sno9zGa5s UkkW6XUzN/RYQy9AlizKdhGsZRXizxaNnPBMxFn5tbZGK0oWMCHs9enDTcYK9kBRYo5S BbLQ== X-Gm-Message-State: APjAAAUPNrBjkZbtMsz+9FlEofDuJWEygdhRJrT61NyDV56TV49qU15R MntQhXuGro3oBo0Yxf1Pti9UgA== X-Google-Smtp-Source: APXvYqy9Whfn7uTg3BOXXtKo+Xb13mslF8Px0gcix7JC2yC4OfYP4K4dJzWw76A+9fC6aflAwbUnzg== X-Received: by 2002:a17:902:421:: with SMTP id 30mr16087280ple.105.1567878146356; Sat, 07 Sep 2019 10:42:26 -0700 (PDT) Received: from ?IPv6:2600:100f:b121:da37:bc66:d4de:83c7:e0cd? ([2600:100f:b121:da37:bc66:d4de:83c7:e0cd]) by smtp.gmail.com with ESMTPSA id h11sm8785567pgv.5.2019.09.07.10.42.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Sep 2019 10:42:25 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v12 11/12] open: openat2(2) syscall From: Andy Lutomirski X-Mailer: iPhone Mail (16G102) In-Reply-To: Date: Sat, 7 Sep 2019 10:42:23 -0700 Cc: Jeff Layton , Aleksa Sarai , Al Viro , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Christian Brauner , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Rasmus Villemoes , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Aleksa Sarai , Linux Containers , alpha , Linux API , linux-arch , Linux ARM , linux-fsdevel , linux-ia64@vger.kernel.org, Linux List Kernel Mailing , "open list:KERNEL SELFTEST FRAMEWORK" , linux-m68k , linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390 , Linux-sh list , linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-12-cyphar@cyphar.com> <7236f382d72130f2afbbe8940e72cc67e5c6dce0.camel@kernel.org> To: Linus Torvalds Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org > On Sep 7, 2019, at 9:58 AM, Linus Torvalds = wrote: >=20 >> On Sat, Sep 7, 2019 at 5:40 AM Jeff Layton wrote: >>=20 >> After thinking about this a bit, I wonder if we might be better served >> with a new set of OA2_* flags instead of repurposing the O_* flags? >=20 > I'd hate to have yet _another_ set of translation functions, and > another chance of people just getting it wrong either in user space or > the kernel. >=20 > So no. Let's not make another set of flags that has no sane way to > have type-safety to avoid more confusion. >=20 > The new flags that _only_ work with openat2() might be named with a > prefix/suffix to mark that, but I'm not sure it's a huge deal. >=20 > =20 I agree with the philosophy, but I think it doesn=E2=80=99t apply in this ca= se. Here are the flags: O_RDONLY, O_WRONLY, O_RDWR: not even a proper bitmask. The kernel already ha= s the FMODE_ bits to make this make sense. How about we make the openat2 per= mission bits consistent with the internal representation and let the O_ perm= ission bits remain as an awful translation. The kernel already translates l= ike this, and it already sucks. O_CREAT, O_TMPFILE, O_NOCTTY, O_TRUNC: not modes on the fd at all. These af= fect the meaning of open(). Heck, for openat2, NOCTTY should be this defaul= t. O_EXCL: hopelessly overloaded. O_APPEND, O_DIRECT, O_SYNC, O_DSYNC, O_LARGEFILE, O_NOATIME, O_PATH, O_NONBL= OCK: genuine mode bits O_CLOEXEC: special because it affects the fd, not the struct file. Linus, you rejected resolveat() because you wanted a *nice* API that people w= ould use and that might even be adopted by other OSes. Let=E2=80=99s please n= ot make openat2() be a giant pile of crap in the name of consistency with op= en(). open(), frankly, is horrible.