Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp792241ybg; Fri, 12 Jun 2020 15:03:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXCk31gCVf9dgX9m8KK1cu9jwc2s8ZityTQW3R3bSlQLjxs3iOCQGbyQkxKveWzjihlsmd X-Received: by 2002:aa7:d613:: with SMTP id c19mr13538591edr.321.1591999422047; Fri, 12 Jun 2020 15:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591999422; cv=none; d=google.com; s=arc-20160816; b=p6EZlK+5IU+WUzhM5TSkeAbUr6RkDoGV1JtAlavv1PWShn9jMfxVKzqxE2wScgoFcL EuqdSKX8BJx9aES7fCcWYddLo2ewOvEAkVDCrMlbO3Rf2USGBJJDM4mRh90r7BU6fzvp 9LQ10cbxbIiymLGv0YWk44400t/sDeHYSZO5j3Qc8ILGW2GL2iw4mG0bQC4mzOFAu5Iw f9y3LS7wY/L1re5KSt6AWNlhGz/z90zd6iwkr1Y+FrAHO7SPXOad55Tfy8jfcLbjPXBC SjMT3wS4nsOrgYZxMO7WG7YNVtFZs9ud1K3/l0vYlXd9FWojJZDzWHrLCSFSvJRaeCbl oH6w== 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=JWYJp5nNaxwsgKcZ1Z6bBPv+CeaisGshv5pM/NlGa8g=; b=WzfenYqyUjDm4AOiAp7TFBBIbH+U5OYwQXQ9b4E+o7jJspjsjTxGSo3im4NY1zV4gX /+mB+3ZUAjL62QdQBWmiF47CWmCEQuMm3Xut8bKa+i3exjRWBFRI6hJ+ARsXJbWSUtf7 shRq8VXjr97+Vx66r2CNYHEM8ukYjbCSuclwHVL32h+yqf61QPFKwKsi2mLf+aJKjLpG 6TxkYANNF3ZVQACW9qrHi7Pntx+iASGTx9gwYRX66urdmPvv/9kfaMhS679VYrDXN3pp w7xhzqGLSJ8PalOliUfrBrFbZoK3lVrGKfKR/prTEvtVqbUI8RT2It3qLzMcMdxkU7oT CF8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=iGB7pNOJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h19si4823584ejd.365.2020.06.12.15.03.20; Fri, 12 Jun 2020 15:03:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=iGB7pNOJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726304AbgFLWBj (ORCPT + 99 others); Fri, 12 Jun 2020 18:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgFLWBc (ORCPT ); Fri, 12 Jun 2020 18:01:32 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659FCC03E96F for ; Fri, 12 Jun 2020 15:01:32 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id c21so6303168lfb.3 for ; Fri, 12 Jun 2020 15:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JWYJp5nNaxwsgKcZ1Z6bBPv+CeaisGshv5pM/NlGa8g=; b=iGB7pNOJkr6LRcHMfXc8Hc5bgDWNnC9dhToyz0MVwqn+5ZDrq4FXB5hkdU+1LIx/wY 29BCG06xc7ngZQKzimY3IdOfI1AOPkYaI0qAzWHwrDzGuh5uZPT59r9N9W8aG0jjBok4 wPUVKZCV++VNxKinJaOsg6Y3DzKn42vwmy34o= 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=JWYJp5nNaxwsgKcZ1Z6bBPv+CeaisGshv5pM/NlGa8g=; b=f4sLikjiGgDNlyhTFoHo/CSfIN7QnGybJZxuo1Vs4IJNh56cenqTxW92czvLBjUVwf mne4+k8whep9cZnvMoIyEdEryhCmPFyt1lVQhJDGZFzPYlheWn5hINjDG1iLFc1ii0Op //AeE4fNu34TpiEYNervuVm3kydvcCZwnObrog3n9RCDPZ3SlbHGL6GAfK7llIOKZbM7 ONLyeaoKRjkcOM6mLhumPCqQ8Rc9SslSYNFRnxj4wk9RGmCtj4K2IUvqTLIG4DmUJDe6 TQkXQ1DknsjC/31dJuDBWGS7RGlAYbHmVg8uYO4d2rQa1+MSB+nYREjpu4SAI+AM3mde Me3w== X-Gm-Message-State: AOAM533V5Q0zwEJle07gfdls6/A9XFE+wIPDwiwFuxEP4XAzeNscoTwx LPP9omSnz3zOzWL8wPKEHmyWHRDP9E8= X-Received: by 2002:a05:6512:3190:: with SMTP id i16mr7831110lfe.158.1591999289612; Fri, 12 Jun 2020 15:01:29 -0700 (PDT) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id u6sm2039195ljk.109.2020.06.12.15.01.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jun 2020 15:01:27 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id d27so1716580lfq.5 for ; Fri, 12 Jun 2020 15:01:27 -0700 (PDT) X-Received: by 2002:a19:6a0e:: with SMTP id u14mr7689820lfu.192.1591999286926; Fri, 12 Jun 2020 15:01:26 -0700 (PDT) MIME-Version: 1.0 References: <1503686.1591113304@warthog.procyon.org.uk> <20200610111256.s47agmgy5gvj3zwz@ws.net.home> In-Reply-To: <20200610111256.s47agmgy5gvj3zwz@ws.net.home> From: Linus Torvalds Date: Fri, 12 Jun 2020 15:01:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] General notification queue and key notifications To: Karel Zak Cc: David Howells , Al Viro , dray@redhat.com, Miklos Szeredi , Steven Whitehouse , Jeff Layton , Ian Kent , andres@anarazel.de, Christian Brauner , Jarkko Sakkinen , keyrings@vger.kernel.org, linux-fsdevel , Linux Kernel Mailing List 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 [ Actually going through the code now ] On Wed, Jun 10, 2020 at 4:13 AM Karel Zak wrote: > > All the next operations are done with "fd". It's nowhere used as a > pipe, and nothing uses pipefd[1]. As an aside, that isn't necessarily true. In some of the examples, pipefd[1] is used for configuration (sizing and adding filters), although I think right now that's not really enforced, and other examples seem to have pipefd[0] do that too. DavidH: should that perhaps be a hard rule, so that you can pass a pipefd[0] to readers, while knowing that they can't then change the kinds of notifications they see. In the "pipe: Add general notification queue support" commit message, the code example uses pipefd[0] for IOC_WATCH_QUEUE_SET_SIZE, but then in the commit message for "watch_queue: Add a key/keyring notification facility" it uses pipefd[1]. And that latter example does make sense: using the write-side pipefd[1] for configuration, while the read-side pipefd[0] is the side that sees the results. That is also how it would work if you have a user-mode pipe with the notification source controlling the writing side - the reading side can obviously not add filters or change the semantics of the watches. So that allows a trusted side to add and create filters, while some untrusted entity can then see the results. This isn't going to hold up me merging the code, but it would be good to clarify and make that something that gets enforced if we decide it's worth it. It does seem conceptually like a good idea, and potentially actually useful to clearly separate the domain of "you can add watches and filters" from "you can see the notifications". Linus