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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B7437C10DCE for ; Thu, 12 Mar 2020 19:26:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 987E8206EB for ; Thu, 12 Mar 2020 19:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726803AbgCLT0g (ORCPT ); Thu, 12 Mar 2020 15:26:36 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:56540 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbgCLT0f (ORCPT ); Thu, 12 Mar 2020 15:26:35 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCTSq-00AIsn-AL; Thu, 12 Mar 2020 19:25:52 +0000 Date: Thu, 12 Mar 2020 19:25:52 +0000 From: Al Viro To: Linus Torvalds Cc: Stefan Metzmacher , David Howells , Aleksa Sarai , Ian Kent , Miklos Szeredi , Christian Brauner , Jann Horn , "Darrick J. Wong" , Karel Zak , jlayton@redhat.com, Linux API , linux-fsdevel , LSM List , Linux Kernel Mailing List Subject: Re: [PATCH 01/14] VFS: Add additional RESOLVE_* flags [ver #18] Message-ID: <20200312192552.GK23230@ZenIV.linux.org.uk> References: <158376244589.344135.12925590041630631412.stgit@warthog.procyon.org.uk> <158376245699.344135.7522994074747336376.stgit@warthog.procyon.org.uk> <20200310005549.adrn3yf4mbljc5f6@yavin> <580352.1583825105@warthog.procyon.org.uk> <3d209e29-e73d-23a6-5c6f-0267b1e669b6@samba.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: On Thu, Mar 12, 2020 at 09:24:49AM -0700, Linus Torvalds wrote: > Would that be basically just an AT_EMPTY_PATH kind of thing? IOW, > you'd be able to remove a file by doing > > fd = open(path.., O_PATH); > unlinkat(fd, "", AT_EMPTY_PATH); > > Hmm. We have _not_ allowed filesystem changes without that last > component lookup. Of course, with our dentry model, we *can* do it, > but this smells fairly fundamental to me. That's a bloody bad idea. It breeds fuckloads of corner cases, it does not match the locking model at all and I don't want to even think of e.g. the interplay with open-by-fhandle ("Parent? What parent?"), etc. Fundamentally, there are operations on objects and there are operations on links to objects. Mixing those is the recipe for massive headache. > It might avoid some of the extra system calls (ie you could use > openat2() to do the path walking part, and then > unlinkat(AT_EMPTY_PATH) to remove it, and have a "fstat()" etc in > between the verify that it's the right type of file or whatever - and > you'd not need an unlinkat2() with resolve flags). > > I think Al needs to ok this kind of change. Maybe you've already > discussed it with him and I just missed it. They have not. And IME samba folks tend to present the set of primitives they want without bothering to explain what do they want to factorize that way, let alone why it should be factorized that way...