Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp847560rdb; Wed, 1 Nov 2023 04:53:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKesUIkRbfYHRBiRfpU3Wor2Nmvw1VDssFAiaulbG/N7TazjwvY0pr4IRvlslECfPHXwpY X-Received: by 2002:a05:6870:8292:b0:1ef:c082:ec98 with SMTP id q18-20020a056870829200b001efc082ec98mr12143890oae.59.1698839617379; Wed, 01 Nov 2023 04:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698839617; cv=none; d=google.com; s=arc-20160816; b=XIpMySLjOEmyLbOfmtbvJFTE2pWvNKiP1YSaGOA8ANKYufPbJLLpsC1yz0r0vigBct ZM4q2W+T2DLRrbWyNUsLjpFiASptoa+rEZVHlFd7DPsynzpGJwLeizqonXGMxUJIPPLy N2mkp+T1KGf809syF5S0XcYdVPPgmdSbWSYofvq4IekJ/HLS+tiaGfwhnwEgIbKjytu1 oM/xyQjEw45dJI7wkGJJNzFJkmu/YyP/KPNEXQZfxm9fUBc2eRPDHznn9gvZgFNw8cd2 19lEof+4UHoxF1Xlg5iz0XWqzV+Zk0ZDO83j4IMg4aIN+X+qiJa+v3zT0RuJEWyZaSB7 OS1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=UUCVuGrNRCpcYFlCbcFf5lEpE2lBBdg3YBmyL9tLv7w=; fh=fKFrN5YXetw6+234+/PzTm0sLhL0LPCKe6Q2oMSk+Yc=; b=N8JVLKtFR5fX+cED48O3AnL0NDyjO4C+9hwndorYjDfQuL4fDehDsbc7HppvnCYz7v KFgQbaQ7mZEu6d1eeaQdCMHvCDxKjKxjHpp0AXOPfABXiknB4R1bAsX9mHycGvPjzVSX GtFlXz7VINypPSbFo+3ljI4nG8mLuAMoLhVUQNC4RtkCHqT1BtzRKgdUeHkKQ4BTS4k2 erPL4dVroCZ/A3A+B6UuQVWI5me8bsaDg0NbMXbml8Y55E4UefZ/y8g5bB4AAdfoWhYP lJO3iajz/lYopcyPDB10xk3pgkp44jB4n+i4oP0+ZVaGTI8A4JPVmWGoJ9YN0pORcXLa saYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm2 header.b=Pnw3+9M2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=j3DY1HJp; 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 Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id r20-20020a6560d4000000b005b9022ddea9si2784019pgv.197.2023.11.01.04.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 04:53:37 -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=@themaw.net header.s=fm2 header.b=Pnw3+9M2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=j3DY1HJp; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 06314804C531; Wed, 1 Nov 2023 04:53:34 -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 S235501AbjKALxK (ORCPT + 99 others); Wed, 1 Nov 2023 07:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235477AbjKALxJ (ORCPT ); Wed, 1 Nov 2023 07:53:09 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4AEFD; Wed, 1 Nov 2023 04:52:59 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C93063200922; Wed, 1 Nov 2023 07:52:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 01 Nov 2023 07:52:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1698839577; x=1698925977; bh=UUCVuGrNRCpcYFlCbcFf5lEpE2lBBdg3YBm yL9tLv7w=; b=Pnw3+9M2zJBysq/HCrWzx++7ioXU9uVt9gLf1TTb65umX/Z6dOV SG17X48MblnRmVI41ZNT/JpWQAS0FKfHWv7Ewfq69XeVHp1o+20611cF9pTq+okA 7TzsfvQrVFFnDos8SOAbchT6lomSWwCqAK+1kGYJMy9q09pv7pANZsMOlrJYK8LC 8jQ5sG3489NO3cDvYOiA0Fy4g3b882mo2ByojssF5Wi5dyphDuf3v0YCDG/w3byo UBEs7pLgUky5Ax2brNploXC3yf9o5OiQYC2BwVLeqkTrzSljeafU4Row5iQ1RzoV LEo0PdpTLCYPfvr8mIVAhvoRiCaG2cd3X3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1698839577; x=1698925977; bh=UUCVuGrNRCpcYFlCbcFf5lEpE2lBBdg3YBm yL9tLv7w=; b=j3DY1HJpugv1lnyf3YyQZd9LwANx1zrD0s9o9OWQwCl4UWNUJj1 +Z/N7cmBYHwaHWi9qx5KaVq7j+Ob8BIssvpyvEO/IOykqgZxJq2EaWQZZD6Xa0jX vqFAX3a4Towiyd93qBkd8z0IlIrdjy/dguh1UFTKq0hJAGH+VWSGVMoYh2mvc+C0 y53v+2VNjdz5zgYkM0yDMyJSEoRGGDC1T1+rzCxQo/I2WfCuHuJLg0p3UGCOvWlx HMUmHueKPRHL+/F1FMOV9l6ygDPirpokP6Wcz6y+wNNbh5oc2L+Gw+PrBMK8je8B hM/qslLy94j3DYrgyJ2UCEwi10ORO2EZb7g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddtgedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefkrghn ucfmvghnthcuoehrrghvvghnsehthhgvmhgrfidrnhgvtheqnecuggftrfgrthhtvghrnh epueegveehueejjedvgeeiheekueduhffgueejgfevgedujeeiieegteehkeehvdeknecu ffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnsehthhgvmhgrfidrnhgvth X-ME-Proxy: Feedback-ID: i31e841b0:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Nov 2023 07:52:49 -0400 (EDT) Message-ID: <374433e3-ab72-64a3-0fa0-ab455268e5e0@themaw.net> Date: Wed, 1 Nov 2023 19:52:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v4 0/6] querying mount attributes To: Miklos Szeredi , linux-fsdevel@vger.kernel.org Cc: 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 References: <20231025140205.3586473-1-mszeredi@redhat.com> Content-Language: en-US From: Ian Kent In-Reply-To: <20231025140205.3586473-1-mszeredi@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 04:53:34 -0700 (PDT) On 25/10/23 22:01, Miklos Szeredi wrote: > Implement mount querying syscalls agreed on at LSF/MM 2023. > > Features: > > - statx-like want/got mask > - allows returning ascii strings (fs type, root, mount point) > - returned buffer is relocatable (no pointers) > > Still missing: > - man pages > - kselftest > > Please find the test utility at the end of this mail. > > Usage: statmnt [-l|-r] [-u] (mnt_id|path) > > Git tree: > > git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git#statmount-v4 > > > Changes v3..v4: > > - incorporate patch moving list of mounts to an rbtree > - wire up syscalls for all archs > - add LISTMOUNT_RECURSIVE (depth first iteration of mount tree) > - add LSMT_ROOT (list root instead of a specific mount ID) > - list_for_each_entry_del() moved to a separate patchset > > Changes v1..v3: > > - rename statmnt(2) -> statmount(2) > - rename listmnt(2) -> listmount(2) > - make ABI 32bit compatible by passing 64bit args in a struct (tested on > i386 and x32) > - only accept new 64bit mount IDs > - fix compile on !CONFIG_PROC_FS > - call security_sb_statfs() in both syscalls > - make lookup_mnt_in_ns() static > - add LISTMOUNT_UNREACHABLE flag to listmnt() to explicitly ask for > listing unreachable mounts > - remove .sb_opts > - remove subtype from .fs_type > - return the number of bytes used (including strings) in .size > - rename .mountpoint -> .mnt_point > - point strings by an offset against char[] VLA at the end of the struct. > E.g. printf("fs_type: %s\n", st->str + st->fs_type); > - don't save string lengths > - extend spare space in struct statmnt (complete size is now 512 bytes) > > > Miklos Szeredi (6): > add unique mount ID > mounts: keep list of mounts in an rbtree > namespace: extract show_path() helper > add statmount(2) syscall > add listmount(2) syscall > wire up syscalls for statmount/listmount > > arch/alpha/kernel/syscalls/syscall.tbl | 3 + > arch/arm/tools/syscall.tbl | 3 + > arch/arm64/include/asm/unistd32.h | 4 + > arch/ia64/kernel/syscalls/syscall.tbl | 3 + > arch/m68k/kernel/syscalls/syscall.tbl | 3 + > arch/microblaze/kernel/syscalls/syscall.tbl | 3 + > arch/mips/kernel/syscalls/syscall_n32.tbl | 3 + > arch/mips/kernel/syscalls/syscall_n64.tbl | 3 + > arch/mips/kernel/syscalls/syscall_o32.tbl | 3 + > arch/parisc/kernel/syscalls/syscall.tbl | 3 + > arch/powerpc/kernel/syscalls/syscall.tbl | 3 + > arch/s390/kernel/syscalls/syscall.tbl | 3 + > arch/sh/kernel/syscalls/syscall.tbl | 3 + > arch/sparc/kernel/syscalls/syscall.tbl | 3 + > arch/x86/entry/syscalls/syscall_32.tbl | 3 + > arch/x86/entry/syscalls/syscall_64.tbl | 2 + > arch/xtensa/kernel/syscalls/syscall.tbl | 3 + > fs/internal.h | 2 + > fs/mount.h | 27 +- > fs/namespace.c | 573 ++++++++++++++++---- > fs/pnode.c | 2 +- > fs/proc_namespace.c | 13 +- > fs/stat.c | 9 +- > include/linux/mount.h | 5 +- > include/linux/syscalls.h | 8 + > include/uapi/asm-generic/unistd.h | 8 +- > include/uapi/linux/mount.h | 65 +++ > include/uapi/linux/stat.h | 1 + > 28 files changed, 635 insertions(+), 129 deletions(-) Looks ok to me,covers the primary cases I needed when I worked on using fsinfo() in systemd. Karel, is there anything missing you would need for adding libmount support? Reviewed-by: Ian Kent >