Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp119258rdb; Thu, 5 Oct 2023 19:56:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKgsG8zwTvZjJlERXlqxWKsDayEG1eVIjsjoOtMDjbnSFo8f9kSpcvIHMQKWeEJs2TaUVP X-Received: by 2002:a05:6a00:985:b0:68a:2272:23e9 with SMTP id u5-20020a056a00098500b0068a227223e9mr8148271pfg.17.1696560996462; Thu, 05 Oct 2023 19:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696560996; cv=none; d=google.com; s=arc-20160816; b=P8W3uOdMWVIbt8p4bwR9elIFJoP1oFmMtTA4023SRKpfYrEsor9gAO5uH2c8DfQThg qB3Hyrg8hrMVv2s9zYPHJyMgeQCbbyhx9YZ3Jbn6ejAXIr4eBMJJwuG8ZkHzZZ0EHOuT 28jn90T0PN4sxmhRDmppmuh34EfJIw/xer3eSXOGkAW0Y1TkCgYdG3/i7bmsVaShlrjk HQxV7YXYw8VlpRBIln6N7fPjcbSPqwctKXo/8OzRyxDJye0Dqk/lWwVhIABOf7BaxWyA JMoRZQGlCj8NPNf5x10JXvOQE04WL2i+gEV7/C2ns3FE0760WWQmk0TH39kKj5xLIQx3 Qx9Q== 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=PHArqxu2qvv+0QWfp9YXmo0v1ys/eNAvTHWEBAqut18=; fh=Xi9w8l90YS/w4QGgBHyaF5kgDGcS5gqBT/p/If4oXB8=; b=pGbqToTVJ3rnjFX9c28VUC0uo0if6KVwlKIZdAcrW2LL0PJxTNNqAJX48TB0TFvK+F p3/0BPXs3eHtqjkya3qVaUGXTi2/ZewnHEsasES0qE7XHsuMp6o6pmEmgqpEZDFlrm/C EOMicZexJlL1Gy3nmKU86DxhuaG3XoUPkMywptnGQRWiowXvyi/oO+njLC9Ak1cImNbx KiGuLIXo1SebCPHJS9OS9V+oNrF2bHsZ/gOtkq2mrF2yWxU/0c5QYOdQM2+53YLF8MdU LeXGlQkb22/PrkUJHzHJo+HjnUdPeRJmHErFHSTQhpy0u0DnqtImyJpzujzrV6MN/O/X Bc1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=ajSKYXOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m16-20020a63fd50000000b00565eedb1cf8si2749745pgj.825.2023.10.05.19.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 19:56:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=ajSKYXOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5663483726AF; Thu, 5 Oct 2023 19:56:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbjJFC4Y (ORCPT + 99 others); Thu, 5 Oct 2023 22:56:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbjJFC4W (ORCPT ); Thu, 5 Oct 2023 22:56:22 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338A8E8 for ; Thu, 5 Oct 2023 19:56:20 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-d8198ca891fso1876549276.1 for ; Thu, 05 Oct 2023 19:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1696560979; x=1697165779; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PHArqxu2qvv+0QWfp9YXmo0v1ys/eNAvTHWEBAqut18=; b=ajSKYXOro6poGXXUa2xNDgWiay9AME4I17RTXh6yZTxpQS+CWtFw35WTy01NS+Nc4s 7qn9Lq87Eyx6Sh7QUByM2XZag6WbGko6TTgAgYv3dfV1SnO9UxA0yp5sBeI7lFfI8fr6 xZolX9+dexXjLMRrihXCsHUuqb3Nfcw8KxAy2tAEOYYkEunCkd/4jbttmLjJRHF4o6yZ a62vh4n/+NtmixCzs8k4yFjDztO7FCI1zqNBK2lMso+Ztg2TawGLsQQUEC48n1Qg17vH ceMB7Uc/ruF+vTS4S/AbfojCHeFMnKZ/khLOdQ+2x9hoBt7rcXotjk79ikqVAe1+Cjt5 D7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696560979; x=1697165779; 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=PHArqxu2qvv+0QWfp9YXmo0v1ys/eNAvTHWEBAqut18=; b=N7e4Y/yTdz/l0JZq+n2qslL1ivUDPN0L0ikrBMQVUiBez4GJ1FbbHii5ZmlZRE6gLX m7fAqKXkFqL1qwqEXX9okuvWZ0vJxEVxgU2Vo/fR7cK1lKJU/HjwbbabhVUxPZM7BY1d uXOfgG4MsNbbCapLGAaGZWNaYYlF2Wp31R62IoYPY7HtQPXWB1gWj03DHyzMGTihFfZx qdJvSdsK88fGlfrqmLCPvuWNgi7v/C0HfIDODZqPc8QbwwUL54cUB6YEsbDOROJxYzKw 5ba1BzlAk+oTgKwION/PSBat3AWeofDwDRvaLucVMU3hgHIGbwYaFzHX7H89xnNgXz/8 ZPLQ== X-Gm-Message-State: AOJu0YydQ8RPzOWkgP1pOJBHBBXlhvgg3IIxV9wabVJ6cl106wSdpsvE hPPIGfVH1OCGZ+neTpCYI0UC6FzFbphXudzFjypd X-Received: by 2002:a25:556:0:b0:d0f:6f1d:89ec with SMTP id 83-20020a250556000000b00d0f6f1d89ecmr6477803ybf.35.1696560979263; Thu, 05 Oct 2023 19:56:19 -0700 (PDT) MIME-Version: 1.0 References: <20230928130147.564503-1-mszeredi@redhat.com> <20230928130147.564503-5-mszeredi@redhat.com> In-Reply-To: From: Paul Moore Date: Thu, 5 Oct 2023 22:56:08 -0400 Message-ID: Subject: Re: [PATCH v3 4/4] add listmount(2) syscall To: Miklos Szeredi Cc: Ian Kent , Miklos Szeredi , 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 , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , Matthew House , Florian Weimer , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 19:56:35 -0700 (PDT) On Thu, Oct 5, 2023 at 11:47=E2=80=AFAM Miklos Szeredi = wrote: > On Thu, 5 Oct 2023 at 06:23, Ian Kent wrote: > > The proc interfaces essentially use ->list to provide > > > > the mounts that can be seen so it's filtered by mount namespace of the > > > > task that's doing the open(). > > > > > > See fs/namespace.c:mnt_list_next() and just below the m_start(), m_next= (), > > /proc/$PID/mountinfo will list the mount namespace of $PID. Whether > current task has permission to do so is decided at open time. > > listmount() will list the children of the given mount ID. The mount > ID is looked up in the task's mount namespace, so this cannot be used > to list mounts of other namespaces. It's a more limited interface. > > I sort of understand the reasoning behind calling into a security hook > on entry to statmount() and listmount(). And BTW I also think that if > statmount() and listmount() is limited in this way, then the same > limitation should be applied to the proc interfaces. But that needs > to be done real carefully because it might cause regressions. OTOH if > it's only done on the new interfaces, then what is the point, since > the old interfaces will be available indefinitely? LSMs that are designed to enforce access controls on procfs interfaces typically leverage the fact that the procfs interfaces are file based and the normal file I/O access controls can be used. In some cases, e.g. /proc/self/attr, there may also be additional access controls implemented via a dedicated set of LSM hooks. > Also I cannot see the point in hiding some mount ID's from the list. > It seems to me that the list is just an array of numbers that in > itself doesn't carry any information. I think it really comes down to the significance of the mount ID, and I can't say I know enough of the details here to be entirely comfortable taking a hard stance on this. Can you help me understand the mount ID concept a bit better? While I'm reasonably confident that we want a security_sb_statfs() control point in statmount(), it may turn out that we don't want/need a call in the listmount() case. Perhaps your original patch was correct in the sense that we only want a single security_sb_statfs() call for the root (implying that the child mount IDs are attributes of the root/parent mount)? Maybe it's something else entirely? --=20 paul-moore.com