Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp129804rdb; Mon, 18 Sep 2023 10:03:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEE/5aZzXbiOmSdhLAu3f3i8hZzNcDc7hxWmuooa5hQMdmuQxRK/tpIDKhk9kpiwlovfUO X-Received: by 2002:a17:90a:f196:b0:262:ded7:63d with SMTP id bv22-20020a17090af19600b00262ded7063dmr7624702pjb.17.1695056600749; Mon, 18 Sep 2023 10:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695056600; cv=none; d=google.com; s=arc-20160816; b=bRm8pK03CFb8SmxhqN2JKgNe6a/VTUnPJejrJPEEFqRZ+HFR/gLtLLLoSlN9JQSE99 6kB50phpwiYKKOWgppNGQr0WhSFVx6sUqmFxPpZ7VuiHqnQOwtjoovdgp0WHpn3SxRFZ qZ1u4biQB7xJ2XiNw8f+d8anEUgAZjOicWcZFUW030oBDiNt5dzO1Tzs4qOxIEmNAEYp aAq1X0qjuAz7Kn5EdKN/ZOa0NMqBMYOku3dsTPG4OQ3O+DNeTOVLFRLNolGupZ757CLE Aqzy2CLSEQ4cl5k1rYv7Cz10PtTqP+fIpo3lv9ItrOn7XGCnBKMxuk3QFlvIw5cE4Mu9 QLSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MZaI2Hur4DzFNCFdxyfc2GUqiNTjUEOq477IHUXSuRk=; fh=mQVref8ralIBAza8nx1qaPThLw4UuT8yyv2ThSfUWN0=; b=0hsy3bbsZWimksp8HAZjHL1WQC60UYM3pFnjdM1hZO/EX8YNs4Lrf9494yi5O10Zo1 NDyhGgu6LWzZU0AzNvQYddRO7X7ir0sZPIRyO4sRIsDOFmjhVzwg0UeMMjAbmI4FxbPB J3yT1Uh0QnULojHxDosi16cJDXS4zPbrGSpXNMT/t/tQuBXcqRA7gOdyDUS9yahwoUiv P/g4sficz8dmzfiesXUH6wXVXkc/fUMQ9GyyMv3kFFKbP+bFLRyx0zWmbLdraW8dTs9K Rw+SF3iRzzhHseAWCTVGpZV30eLIb1sU21F6ONzgEbcgV04E5lNCAAFCzzugx+78/hQG TR0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b1RHVr7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id pf2-20020a17090b1d8200b00274ac850fbbsi5576082pjb.132.2023.09.18.10.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b1RHVr7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9F1858436B4A; Mon, 18 Sep 2023 09:48:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230505AbjIRQse (ORCPT + 99 others); Mon, 18 Sep 2023 12:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbjIRQsV (ORCPT ); Mon, 18 Sep 2023 12:48:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ACAC1728; Mon, 18 Sep 2023 09:47:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A389CC433C7; Mon, 18 Sep 2023 13:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695042351; bh=HYgvqysiYXEBze4xu0V7hvbNlfumeLQhBcoLM4ehRSM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b1RHVr7VnZBKe35gk2YjibsLWGUFzDa6Rs5pzFVjT3+aDGTpZh34yeHyFrXrynL2K KqjZOVvPMxxpba5mXuTr+rNifmaKdTuBJuThpw3mmOpXucP7FoM/T58YcsXVi2ZjX9 s6rZikmVXh85yURmqt1dPNeOfA8Eo9m5VW/ZNnDtU6rn7/KPyyZqSeXk17FbB2klQ4 KgpaR9KKO4x3mG3x6rPOhzPwULyda9Gqt/uPciIbk1huxNbbpuVBvY9pFglPRCV0bl wpTGdRsSI2tIKAu8fxG6rG4rjjrdoJijWw14OEaRpYE84ISzldJIP8Z1St5PBmrS7t I5bRR5ywRd8zg== Date: Mon, 18 Sep 2023 15:05:46 +0200 From: Christian Brauner To: Ian Kent Cc: Sargun Dhillon , 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 Subject: Re: [RFC PATCH 2/3] add statmnt(2) syscall Message-ID: <20230918-bruchfest-erliegen-2bff785bf978@brauner> References: <20230913152238.905247-1-mszeredi@redhat.com> <20230913152238.905247-3-mszeredi@redhat.com> <39dc7081-fef3-007b-eee3-273bff549ecf@themaw.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <39dc7081-fef3-007b-eee3-273bff549ecf@themaw.net> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 09:48:42 -0700 (PDT) On Mon, Sep 18, 2023 at 07:36:39AM +0800, Ian Kent wrote: > > On 18/9/23 02:18, Sargun Dhillon wrote: > > On Wed, Sep 13, 2023 at 9:25 AM Miklos Szeredi wrote: > > > Add a way to query attributes of a single mount instead of having to parse > > > the complete /proc/$PID/mountinfo, which might be huge. > > > > > > Lookup the mount by the old (32bit) or new (64bit) mount ID. If a mount > > > needs to be queried based on path, then statx(2) can be used to first query > > > the mount ID belonging to the path. > > > > > > Design is based on a suggestion by Linus: > > > > > > "So I'd suggest something that is very much like "statfsat()", which gets > > > a buffer and a length, and returns an extended "struct statfs" *AND* > > > just a string description at the end." > > > > > > The interface closely mimics that of statx. > > > > > > Handle ASCII attributes by appending after the end of the structure (as per > > > above suggestion). Allow querying multiple string attributes with > > > individual offset/length for each. String are nul terminated (termination > > > isn't counted in length). > > > > > > Mount options are also delimited with nul characters. Unlike proc, special > > > characters are not quoted. > > > > > Thank you for writing this patch. I wish that this had existed the many times > > I've written parsers for mounts files in my life. > > > > What do you think about exposing the locked flags, a la what happens > > on propagation of mount across user namespaces? > > Which flags do you mean? When you propagate mounts across mount+user namespaces a subset of (security sensitive) mount attributes become locked. This information is currently only available via internal flags but not in any way explicitly exposed to userspace. There's a proposal to extend mount_setattr(2) to explicitly allow locking flags but that would mean a new set of mount attr flags. So until the format of that is determined and settled this should be kept out of statmount().