Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5812509rdb; Sun, 17 Sep 2023 13:39:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFC6BthsYUKVlVn69buL1gut0pGPMX6IB1rEM86dgYSFBmH8YWoNxKk/iQ0kRx6xcZsv6jl X-Received: by 2002:a05:6a00:15d0:b0:68f:cf6f:e223 with SMTP id o16-20020a056a0015d000b0068fcf6fe223mr6838163pfu.11.1694983194938; Sun, 17 Sep 2023 13:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694983194; cv=none; d=google.com; s=arc-20160816; b=GafmYmhmSA9FUy8rmRdKzLiAlQMKJM3lDZzoRhPmBm//dJSDKjyQ+Pp1TKaqIQipxm B+EAK+AXC/yBtBZQMExPzmaq3OnIEKC8Zvw7whMXOU4858r1OG2GuhoRsBEmYXamhSIL VGkjauwp8HWoFXWBoPFXEmo3XpEIHTLi8CH8PuxO4FkQLhe4ubzj0uwY07x1tP+ron+r SjTuYYM/SZTTT5pWyQMCaAGLEj+kjOaaK8ZPNNxJhYxhGCj8QSO0V8PASE6Ifkn3EbPM NT0Fx65YxoqXx7KcIdGe34ZCW1broZLoT/ajfxkaHT9QmK1ygD2MQ+XfEDyRkZn4DnON oS3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=fd2SQIw5RGzEP/oFXtTGteoLvZh3GLziCsZTny7nBwk=; fh=g/LBNXnUWPfV1tdknmDkchNKgbU68Hwwy9hMnL3fcKA=; b=N4IHuvM6SSuGwMpXeO6AZIUBC8yH4RZekeoD4cSouPF+aEksLxqMvie4mOeuxvtrkS Gns4u7flMVUDlSAUyws+Mh4HkaxWppgyPWHqjxtuLFZ1mzXb1Sx4xxN8Mql77RPTAgZ7 JNjp21F7e1o/H8S1I88PiCujJby6Ys6vrqxIyo0gVG4Pe77YhXSYJNh/q+BWtNzgQXv3 bDNryH6NweqpI4vzBADQ+RFJGhjnfGAGEu6WjLjEIOhkOHkVMvI27E4xRmDdTRoET3/G 5OZXUVRQ2Cw5PVBFEWlyUG05qX5qqtlBuY5CZizfe/0s+tWySlgB+pKIjywyhAnX3V5h v9WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UL9zv3gp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id ds4-20020a056a004ac400b006901387b0b3si6841447pfb.9.2023.09.17.13.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 13:39:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UL9zv3gp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0B71380330DD; Sun, 17 Sep 2023 07:40:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232094AbjIQOdX (ORCPT + 99 others); Sun, 17 Sep 2023 10:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235480AbjIQOdK (ORCPT ); Sun, 17 Sep 2023 10:33:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A3A12D for ; Sun, 17 Sep 2023 07:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694961138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fd2SQIw5RGzEP/oFXtTGteoLvZh3GLziCsZTny7nBwk=; b=UL9zv3gpy+BlX2HyDYUL9wuRXaprzZbeQ1zJortdHLEixXHFvp1kqBN4Z3r8s9mrQ0Ifv6 yZGb725k32cg6+JMu9XUTYzqOM+xM5jx2qka7q0x2ZbpTwW7msboV5Ujfe+oJmHcOZ8uIn gr7kXKaiN/JVn10+NiFndalrV8h27GI= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-82-mg_NxEXZM96OyBTRh7DMiA-1; Sun, 17 Sep 2023 10:32:16 -0400 X-MC-Unique: mg_NxEXZM96OyBTRh7DMiA-1 Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-27489394741so2075263a91.1 for ; Sun, 17 Sep 2023 07:32:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694961135; x=1695565935; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fd2SQIw5RGzEP/oFXtTGteoLvZh3GLziCsZTny7nBwk=; b=XuzXKOwaZXFjSutV0JFi9uzGyp0qOP7dhnchEqI2JGANQJlZf8UgHdNeHdxvigCVhj CeHvT4/LFc/XG7VgFKXyt8MpY1BN0S3YG80saM07V5VDMCy13OhqBgkUmbb/xgbt1syJ caxykeLpfaHM2430GxCOUmEUnj3Q1/tAJybK83eAgbqWGTWgzrE2kLdf82hGUsUg4irQ zlPupGhvtORw0yhj2t08JONQ+28K9RSyE1s+Nr7A8NhrYguTN1/kk9sm6I4CjHN8dNVP +S0q2sjj5pmNiDSP/cqCFnKjfRpHRxTEEWCJEr0ioe2h0/xtx1WkoqAQBjaJ5R09FczZ j0Dg== X-Gm-Message-State: AOJu0YyYKUI2ZWnuyQvUp8v2w06KYTOGded/vXVvZ7VLYwO7hfbht+uN fLGrSz25R/noVO4J5OrTiwe6lUeAMZhu2JYX7pQSZ10wntsuLbSCmr7+OCw8oeVvZxFncyW5frp dPSvgctUMlu6CIqXuT771Xh7pF11ljB+hFRw1aYdI X-Received: by 2002:a17:90a:31c9:b0:25e:d727:6fb4 with SMTP id j9-20020a17090a31c900b0025ed7276fb4mr4479052pjf.2.1694961135575; Sun, 17 Sep 2023 07:32:15 -0700 (PDT) X-Received: by 2002:a17:90a:31c9:b0:25e:d727:6fb4 with SMTP id j9-20020a17090a31c900b0025ed7276fb4mr4479048pjf.2.1694961135300; Sun, 17 Sep 2023 07:32:15 -0700 (PDT) MIME-Version: 1.0 References: <20230913152238.905247-1-mszeredi@redhat.com> <20230913152238.905247-4-mszeredi@redhat.com> <20230917005419.397938-1-mattlloydhouse@gmail.com> In-Reply-To: <20230917005419.397938-1-mattlloydhouse@gmail.com> From: Miklos Szeredi Date: Sun, 17 Sep 2023 16:32:04 +0200 Message-ID: Subject: Re: [RFC PATCH 3/3] add listmnt(2) syscall To: Matthew House Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 17 Sep 2023 07:40:59 -0700 (PDT) On Sun, Sep 17, 2023 at 2:54=E2=80=AFAM Matthew House wrote: > > + list_for_each_entry(r, &m->mnt_mounts, mnt_child) { > > + if (!capable(CAP_SYS_ADMIN) && > > + !is_path_reachable(r, r->mnt.mnt_root, root)) > > + continue; > > I'm not an expert on the kernel API, but to my eyes, it looks a bit weird > to silently include or exclude unreachable mounts from the list based on > the result of a capability check. I'd normally expect a more explicit > design, where (e.g.) the caller would set a flag to request unreachable > mounts, then get an -EPERM back if it didn't have the capability, as > opposed to this design, where the meaning of the output ("all mounts" vs. > "all reachable mounts") changes implicitly depending on the caller. Is > there any precedent for a design like this, where inaccessible results > are silently omitted from a returned list? Good point. That issue was nagging at the back of my mind. Having an explicit flag nicely solves the issue. Thanks, Miklos