Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1896036ybm; Thu, 23 May 2019 08:17:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+7eldv/xPgBO682Myjztd0U3nt31ggTfiFOVj2hAbzxqltfxrxKxnCZTylGvXbkh+lux0 X-Received: by 2002:a17:90a:32ca:: with SMTP id l68mr1898544pjb.11.1558624653638; Thu, 23 May 2019 08:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558624653; cv=none; d=google.com; s=arc-20160816; b=EgT6UVThV5Z0bQFtJmlS1LQ8v4PBcmeqhd6aCGvCwbD2mVw+Y15OiKGd7CeFs1czjm qWIjBXwNXBdjkBMPxS59qYJYJvKqSqqp9IICtVytVO/gDrWqdobHsyG6ZcumY5ZOIUf0 EvFR/uKlNQNslfGTjeQ4CzK2ExXQBGxC9O2+V4otqQJVZl/cLqDAVung7JwjShCvKuBr tIPvh8ijXnT/oN51drMCNI/BJCIlZkEhP8EhaUY6yj2kzzL3CZxXuWZUKMVrvDzwGx2j IgWREwq6ciKxOXYlhRJ6zSGd9xfO+38GYS/V5Nt64xk/G3O3zcFR8+nLpBn/YVqbt9pB 9M2Q== 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:dkim-signature; bh=7C1w/R/OVTf4arN5cUtfYsrYHtgapRpkZjh95wSXEAk=; b=bLwC05Ye/Jt6gnUd3idIdjPh0DNsi2WHWEJ+WYdHnJCeW8cHV9kmUugwvyydGlr3Jb AlQTxgyRgbgriy3u8PibSTL6iR5xFVXP6b99jX8Nrs8PNpfcNhuqR4wqAKFPjbTvBGfp YVcllMN0PRZFJvXlsV8U9iE3F5cMLYPW1Y84WWX90yoNlCJLl6+yaqLXEoH8Gc5/JTCT cHE7zlYkCYs2SGjafuItoaZ1Snl59YJx0g8x4jHS4fafwsGHrQqlngO0YnMvZnl502Og ikzzEdaPvqBVSTA4rKc4mfeKGMd6oO7+3FJ1eCbAwbzMgZBemn27cz9MZFkJPgYYIYYh 7AyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tcOc5YsX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d186si28860244pga.484.2019.05.23.08.17.15; Thu, 23 May 2019 08:17:33 -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=@gmail.com header.s=20161025 header.b=tcOc5YsX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730934AbfEWPPw (ORCPT + 99 others); Thu, 23 May 2019 11:15:52 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:40673 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730709AbfEWPPw (ORCPT ); Thu, 23 May 2019 11:15:52 -0400 Received: by mail-yb1-f193.google.com with SMTP id g62so2399700ybg.7; Thu, 23 May 2019 08:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7C1w/R/OVTf4arN5cUtfYsrYHtgapRpkZjh95wSXEAk=; b=tcOc5YsXCSi1Yb1sUWJZtzMcDdpA71BN7GYZHf4blrMX615X5vBq+DE1b4F0SoDzJx tuUas/HuW1yWtemL5riFUXptbnfm2rD/o2hdhPUyz3YVRdkEZKbSP7ayL2tFE6AaiJJi 8jfe4FKX7Q3K6XOI2RyLL0S/pM2XeRfgu4JHyf5O2+VRKWAISL8w8ASHOrNM9g9f0TCE yXAnzU6rQOTiXtnjtOLUYvgtQCm6lYlx9plQ55yr1gLJ9ls8mRGIU3EFqa3HepqRQvbM f03ni8BWmldzeuB8i+7T25VldToaMWLarkS99f/2t/kBJCf0ThLb3PHZExDGGXybNxd2 UtqQ== 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=7C1w/R/OVTf4arN5cUtfYsrYHtgapRpkZjh95wSXEAk=; b=Sy12gfgWVqzkPranXQlSYWC3NwJoasi8PviT4et88+JDv+Lk5SbSXRRHYmtSOWL259 AwSCTTNY2Auv8BzFiOR1IzIvmqX/9DRZyT6co+4zjmSXkcJk4T6BWFGoobJxh/OSB89I NkkP+1lnEy6Lve6hxTGlFjiGNzM/rGHSvXkYsWUN3j7s5BbY0WYZAvqouksxxnpgukP8 ruBD4gaBuLcw4bWyc9eBCwJoxxPmOEoFQA2wEA2JaAdNE0ciX4vVa1CLmTdF7UDmKvZI X253+o8bJgzxLEPEUBXr9+KaV849a8HMsKPX9pcCjJ35C4OKQ7xXXaYKlB7e4gu6MBHb iysQ== X-Gm-Message-State: APjAAAVQdeo0me8fwZHYflcnehrwBHJu1hgBXRMrk/h/DMBEf/QPmjYo yidvdb4yEDiYCnZRwnGAXAsE/7vBLHcvt/V7v30= X-Received: by 2002:a25:cb0c:: with SMTP id b12mr21649228ybg.144.1558624551110; Thu, 23 May 2019 08:15:51 -0700 (PDT) MIME-Version: 1.0 References: <20190523095506.nyei5nogvv63lm4a@brauner.io> <20190523104239.u63u2uth4yyuuufs@brauner.io> <20190523115845.w7neydaka5xivwyi@brauner.io> <20190523133516.6734wclswqr6vpeg@brauner.io> <20190523144050.GE2949@quack2.suse.cz> In-Reply-To: <20190523144050.GE2949@quack2.suse.cz> From: Amir Goldstein Date: Thu, 23 May 2019 18:15:39 +0300 Message-ID: Subject: Re: [PATCH] fanotify: remove redundant capable(CAP_SYS_ADMIN)s To: Jan Kara Cc: Christian Brauner , linux-fsdevel , linux-kernel , Matthew Bobrowski 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 Thu, May 23, 2019 at 5:40 PM Jan Kara wrote: > > On Thu 23-05-19 15:35:18, Christian Brauner wrote: > > So let's say the user tells me: > > - When the "/A/B/C/target" file appears on the host filesystem, > > please give me access to "target" in the container at a path I tell > > you. > > What I do right now is listen for the creation of the "target" file. > > But at the time the user gives me instructions to listen for > > "/A/B/C/target" only /A might exist and so I currently add a watch on A/ > > and then wait for the creation of B/, then wait for the creation of C/ > > and finally for the creation of "target" (Of course, I also need to > > handle B/ and C/ being removed again an recreated and so on.). It would > > be helpful, if I could specify, give me notifications, recursively for > > e.g. A/ without me having to place extra watches on B/ and C/ when they > > appear. Maybe that's out of scope... > > I see. But this is going to be painful whatever you do. Consider for > example situation like: > > mkdir -p BAR/B/C/ > touch BAR/B/C/target > mv BAR A > > Or even situation where several renames race so that the end result creates > the name (or does not create it depending on how renames race). And by the > time you decide A/B/C/target exists, it doesn't need to exist anymore. > Honestly I don't see how you want to implement *any* solution in a sane > way. About the most reliable+simple would seem to be stat "A/B/C/target" > once per second as dumb as it is. > Just wanted to point out that while looking at possible solutions for "path based rules" for fanotify (i.e. subtree filter) I realized that the audit subsystem already has a quite sophisticated mechanism to maintain and enforce path based filesystem rules. I do not love that code at all, I can hardly follow it, but if someone would have wanted a way to be notified when an object of a given path name appears or disappears from the namespace, it seems like something in the kernel is already going to a great deal of effort to do that already. Or maybe I am misunderstanding what this code does. Thanks, Amir.