Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3720848ybe; Sun, 8 Sep 2019 20:35:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw3i3a1qp6VfvoIWbKHB1pCP1aL7nZDygyhOZuTN/wEly8mUukrNJT9F66deVJcz+/U8lv X-Received: by 2002:a17:906:1d45:: with SMTP id o5mr17977434ejh.251.1568000159535; Sun, 08 Sep 2019 20:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568000159; cv=none; d=google.com; s=arc-20160816; b=pYinwidhwmfjX33nfe/H5Jmq7t2Oe22S5JXyN+lsyP4GmWoPp+TvC0A4fi3PRXO8FD ZhN+ysHHRYFrJ/8cAJtC70jjH/DZrGr7mEmiD2uoMvkchnwKnB33y5jBEjedBeleEjPc QhkikvByo4z711hLLxUqIqoUIu69SAyDbRbV1Tz1p5xkjw52whc5wu833iDsUmmeSOC7 +bdzRfAhcfL/x0ll9gYnMeafHq3JviA0Y8/NSWIrVYnaqd3e5zepgFDYoBxzf5i8sDhS 2iQ9rENQj8bt3n/7wfNzZIWwP70bWidL87KTzCJ2hXwEfPCBQimus97XP0bJMAQUavnO o0pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=zOxFxXxkeAXBLA4hmpQx5p2K1SwU8yRrMWsF/vzne4c=; b=OUnVHkWRIbhj4mH9PunLlXI/AawSV9CQcbv0bIBjvC11M7AQPJ2Rt9giCLYwDg8b+9 nVM2geTxfbMhDZLdYu72ZJova74/pPhpd+72iMX2sM0EY5LziCkdbxXzwm3dTtYD+o1U wWkmZ9JwyvDqVMOwTpC/sFlPg6fIssTjjrzk0h7Qryrs6uQsLbczLtABj8o+75m1H8g1 LI55j1oo7psKeFiR2cQNstK8PA/5vD+7PUY8O4CNOvNOLyPIN+qB0KwUJxZX4C0AXisv ZRVjVgYptA73GNdA2ixfAKnN282VpWn9BoehAKKEqzisHVFoEwRLZDJNFrsGGFrTmZfR HpvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Ahrc72PG; 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 i56si7534022eda.19.2019.09.08.20.35.30; Sun, 08 Sep 2019 20:35:59 -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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Ahrc72PG; 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 S2406228AbfIGRm2 (ORCPT + 99 others); Sat, 7 Sep 2019 13:42:28 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39152 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393312AbfIGRm1 (ORCPT ); Sat, 7 Sep 2019 13:42:27 -0400 Received: by mail-pl1-f193.google.com with SMTP id bd8so4658586plb.6 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=IBbJuBFjH6ZY1yIXZQTVRvvetwfV+3vS7g9f8OVORpHPTx/wfq0LH4d+f+3aEQrgBW 5vy5UijFQpio46rnVDFVhFGB5dhGwdHcwF77OrBJnGGcFxSkWNbQUtYu4Ta0Gz+MeMzP 76MdcbkwzN7LOsxIvLNmb20Stb9xxarHIL7eMbOUG0UeHmZX+PEiTvmATAahtV662f8Q 5vIwXlY+rFO7JfrVjXAQtF9ZQ3RR5A0Wt23dccxwvsIXqQezTZjFjgPSz2xGriEs9Plx mU7oLMXXcPKusZunvC+UFQbYNeX2OBFhvHWuZn283oIet2t8Gp+0f9R15KZMgqQ3J86e TvOw== X-Gm-Message-State: APjAAAUrGgUDlmP3hjfjqOy83zv3gS7B4QqWKugnjPiLnC5OX1YbB6d0 hPbMbeHD6MtJtJf5xMITkDwh4Q== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.