From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CAADC021B2 for ; Tue, 25 Feb 2025 08:11:15 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Z29KY6jSCz30RN; Tue, 25 Feb 2025 19:11:13 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=202.12.124.141 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1740471073; cv=none; b=irhlxOxE1j/McqiW8uvMUUopOnI0AIRwygC7YhxJ0vCCt27hatD9q8oYs2CDg0XkU9uvW2OnuKZUI6gKOo95kC1nFd9Lp6OOvluCz6RBImL0OrSyDJ0RYHiIOjheJi8DUjvbhUgJvPxZBWXG/7eXR0RhFDrdnTxxV5i/4ndEnKeZBpuZL54k9QXYM8aZjbnf5XxBPyBCo4wqOwZVDQ5bHxqlO1vh9UHqQoYU8GQe1DASt5fhbuDt3KEX9rL3pRtS6gUdeDTTYwLrarrZF05DxH7CEt07INsYZcKcjNSMNvHxpmD5II16aIRuKQY7R5iuidy6gsKUIL2WeDsA299UmQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1740471073; c=relaxed/relaxed; bh=QLBFywS7XyTxwPOejQif6z/28yCPC+NOlxqp7jJivgU=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=GvBRsEZwuO6QvY5w/7UPjhcUnSrR4E17nvtXRK3enK53cmUuqV26Zd6fXUb4W3UGlmLRrAPDiMbco5NL62tw1k+Lgk4krTCTX1OKQcQDRanL6BzB4TJL4KzAxEEp9ZA7AF0SPnVlUdq/nOk6yx3QYlZ29nqEhbpmhbq6Ku/plzTOUDDLF/8ZjLhCGPSyMPlo+kNBPZZCe/V6hyDYh8dkpaAPqzdxjY2lQYWUbdCiIyNXGebYY7MV42G1ZzKkfsKIqJbFWje8J7pbkqqH+WWnO+U8YuNf1JESugE1mVUur/BSqV75ShJJRKMdCkHE8oH9e/3TR7zUwMDBCF5lpc28NQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=arndb.de; dkim=pass (2048-bit key; unprotected) header.d=arndb.de header.i=@arndb.de header.a=rsa-sha256 header.s=fm3 header.b=nuB/bCA9; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=YPoIMkvS; dkim-atps=neutral; spf=pass (client-ip=202.12.124.141; helo=flow-b6-smtp.messagingengine.com; envelope-from=arnd@arndb.de; receiver=lists.ozlabs.org) smtp.mailfrom=arndb.de Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=arndb.de header.i=@arndb.de header.a=rsa-sha256 header.s=fm3 header.b=nuB/bCA9; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=YPoIMkvS; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arndb.de (client-ip=202.12.124.141; helo=flow-b6-smtp.messagingengine.com; envelope-from=arnd@arndb.de; receiver=lists.ozlabs.org) X-Greylist: delayed 517 seconds by postgrey-1.37 at boromir; Tue, 25 Feb 2025 19:11:10 AEDT Received: from flow-b6-smtp.messagingengine.com (flow-b6-smtp.messagingengine.com [202.12.124.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Z29KV6Z6Qz30PF for ; Tue, 25 Feb 2025 19:11:10 +1100 (AEDT) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailflow.stl.internal (Postfix) with ESMTP id BC32C1D40DC7; Tue, 25 Feb 2025 03:02:28 -0500 (EST) Received: from phl-imap-11 ([10.202.2.101]) by phl-compute-11.internal (MEProxy); Tue, 25 Feb 2025 03:02:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; 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:subject:subject:to:to; s=fm3; t=1740470548; x=1740477748; bh=QLBFywS7XyTxwPOejQif6z/28yCPC+NOlxqp7jJivgU=; b= nuB/bCA9S1ItHoQccv5Gpf2mwvDce7RRcNcpwlxjDxO1holF+tGByrAapeP7OrFr HAk3aSlywo6BQ3aIq3YD97bpYimQZCmCJzQVQ4J7/FjQNoffpOdztKN3jNMkLAsm 9VGEaeHYbe7aA1pwEwTc5Ly3uUaA5trnjhjeblm3R3qCmYh5gobnjqpCGnSMaJxH Q4rT9xQzPWGhTDWs9MOLPKEFr4nLKLYdEEplecb0+f886EV6VW5atz2MXrJXfgSa 8nO2s+I0QTs8G0bnVObE2Z5vC+C/ADHfqNq9PLbtRtoWaqB9bL1p64n0kbx/qUFh GI6t/ArRTPIDtTrox5TXCQ== 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:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1740470548; x= 1740477748; bh=QLBFywS7XyTxwPOejQif6z/28yCPC+NOlxqp7jJivgU=; b=Y PoIMkvS6Pmv9DRNik2ZIAlOAGJxA128xi+2AFbN1p4mZSMpWJvjWRKHZs4PLFfc6 1+aHv049YnYKEfVZEN+sir1Y3b3y0M5hJe6zr9DGoS6Mofb56X+snvlPvlUK0F+4 mXCUv/SVSH9ziGwDTAMYmz7Q5CpBKdy6teD7hFBcWYrwRSOU7VayJcaFf2MNpoPY RwMyBak80wphhNQM/ZbdE2tRPYWKp2xSTpvayyVo+xrq2jkqVAoOaz4M/GmpQhDQ GoohNCukP3A1YcdSedH7Ka31l79hVrCqcvm9Qig3waOu8sHkFMFBcxErO5OHkgJx 1CybiPzK73IGpPLVmfvxA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekuddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvvefkjghfufgtgfesthhqredtredt jeenucfhrhhomhepfdetrhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusg druggvqeenucggtffrrghtthgvrhhnpedvhfdvkeeuudevfffftefgvdevfedvleehvddv geejvdefhedtgeegveehfeeljeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggvpdhnsggprhgtphhtthhopeeh tddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghpsegrlhhivghnkedruggvpd hrtghpthhtohepthhssghoghgvnhgusegrlhhphhgrrdhfrhgrnhhkvghnrdguvgdprhgt phhtthhopegtrghtrghlihhnrdhmrghrihhnrghssegrrhhmrdgtohhmpdhrtghpthhtoh eplhhinhhugiesrghrmhhlihhnuhigrdhorhhgrdhukhdprhgtphhtthhopegthhhrihhs thhophhhvgdrlhgvrhhohiestghsghhrohhuphdrvghupdhrtghpthhtohepuggrvhgvmh esuggrvhgvmhhlohhfthdrnhgvthdprhgtphhtthhopehmihgtseguihhgihhkohgurdhn vghtpdhrtghpthhtohepmhhpvgesvghllhgvrhhmrghnrdhiugdrrghupdhrtghpthhtoh eprghnughrvggrshesghgrihhslhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A3F4B2220072; Tue, 25 Feb 2025 03:02:24 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 25 Feb 2025 09:02:04 +0100 From: "Arnd Bergmann" To: "Christian Brauner" Cc: "Amir Goldstein" , "Andrey Albershteyn" , "Darrick J. Wong" , "Richard Henderson" , "Matt Turner" , "Russell King" , "Catalin Marinas" , "Will Deacon" , "Geert Uytterhoeven" , "Michal Simek" , "Thomas Bogendoerfer" , "James E . J . Bottomley" , "Helge Deller" , "Madhavan Srinivasan" , "Michael Ellerman" , "Nicholas Piggin" , "Christophe Leroy" , "Naveen N Rao" , "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" , "Sven Schnelle" , "Yoshinori Sato" , "Rich Felker" , "John Paul Adrian Glaubitz" , "David S . Miller" , "Andreas Larsson" , "Andy Lutomirski" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "H. Peter Anvin" , "Chris Zankel" , "Max Filippov" , "Alexander Viro" , "Jan Kara" , =?UTF-8?Q?Micka=C3=ABl_Sala=C3=BCn?= , =?UTF-8?Q?G=C3=BCnther_Noack?= , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, Linux-Arch , linux-xfs@vger.kernel.org, =?UTF-8?Q?Pali_Roh=C3=A1r?= , "Theodore Ts'o" Message-Id: <6b51ffa2-9d67-4466-865e-e703c1243352@app.fastmail.com> In-Reply-To: <20250224-klinke-hochdekoriert-3f6be89005a8@brauner> References: <20250211-xattrat-syscall-v3-1-a07d15f898b2@kernel.org> <20250221181135.GW21808@frogsfrogsfrogs> <20250224-klinke-hochdekoriert-3f6be89005a8@brauner> Subject: Re: [PATCH v3] fs: introduce getfsxattrat and setfsxattrat syscalls Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Feb 24, 2025, at 12:32, Christian Brauner wrote: > On Fri, Feb 21, 2025 at 08:15:24PM +0100, Amir Goldstein wrote: >> On Fri, Feb 21, 2025 at 7:13=E2=80=AFPM Darrick J. Wong wrote: >> > > @@ -23,6 +23,9 @@ >> > > #include >> > > #include >> > > #include >> > > +#include >> > > +#include >> > > +#include >> > > #include >> > > #define CREATE_TRACE_POINTS >> > > #include >> > > @@ -2953,3 +2956,75 @@ umode_t mode_strip_sgid(struct mnt_idmap *= idmap, >> > > return mode & ~S_ISGID; >> > > } >> > > EXPORT_SYMBOL(mode_strip_sgid); >> > > + >> > > +SYSCALL_DEFINE4(getfsxattrat, int, dfd, const char __user *, fil= ename, >> > > + struct fsxattr __user *, fsx, unsigned int, at_flag= s) >> > >> > Should the kernel require userspace to pass the size of the fsx buf= fer? >> > That way we avoid needing to rev the interface when we decide to gr= ow >> > the structure. > > Please version the struct by size as we do for clone3(), > mount_setattr(), listmount()'s struct mnt_id_req, sched_setattr(), all > the new xattrat*() system calls and a host of others. So laying out the > struct 64bit and passing a size alongside it. > > This is all handled by copy_struct_from_user() and copy_struct_to_user= () > so nothing to reinvent. And it's easy to copy from existing system > calls. I don't think that works in this case, because 'struct fsxattr' is an existing structure that is defined with a fixed size of 28 bytes. If we ever need more than 8 extra bytes, then the existing ioctl commands are also broken. Replacing fsxattr with an extensible structure of the same contents would work, but I feel that just adds more complication for little gain. On the other hand, there is an open question about how unknown flags and fields in this structure. FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR treats them as optional and just ignores anything it doesn't understand, while copy_struct_from_user() would treat any unknown but set bytes as -E2BIG. The ioctl interface relies on the existing behavior, see 0a6eab8bd4e0 ("vfs: support FS_XFLAG_COWEXTSIZE and get/set of CoW extent size hint") for how it was previously extended with an optional flag/word. I think that is fine for the syscall as well, but should be properly documented since it is different from how most syscalls work. Arnd