From nobody Thu Mar 5 08:11:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E51B2E9749 for ; Mon, 16 Feb 2026 19:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771268401; cv=none; b=MuhdN3RUbPDq6J+zOAboS8brBhRxyWPzbt8OCK3QFoNwGh3eCSS9BikdlunXHNu+iG1gLFNkPy6F+5q8lyYvz2o6gSxKsQ1iMSEPso9nrH6LYsXx55naOsMbbM5GY4WQfTw4L1/UQEi/Hk+Jtv3qVXFoktlqQOXQ4l1OasdDp/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771268401; c=relaxed/simple; bh=6Hh3KYw2Jyb1btkJg7DMiLM+J1fGkbsEdPXZYlYEctY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G9xjnmhJweQtbEx0vc85dhigfExYkRUeMNLBvgVTFQhopWLHeJlRUMNZPJAE3g76n6kLCsTLvdWxQX1nmiOsKKEfCFtF2L2/Pmf0bawrMRNfGK91nlPZ/5UtVhaDy+zkVVPvhfRjMzOfnun/Zfig+6UT3phszg985CgDyftQV5c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OhrvYoaV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OhrvYoaV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44499C19422; Mon, 16 Feb 2026 18:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771268401; bh=6Hh3KYw2Jyb1btkJg7DMiLM+J1fGkbsEdPXZYlYEctY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhrvYoaV8utxpqTBno7SbwJVX0AU+R7vbcXf+xXIJS/M7LfbjsrGjyg7hefx912jU h7aAkI7h2dJTIHUkFGciVaMnHvtGJnHwex2MjrPSU0A8PLd+lFsmTPGBVh5aoKsZUH g17wZ0SmTm+fvGPCvJ6XZlkUx4KTWjNK/ktTwNTvRRtGxbf4e4cOrFaxWT92RWogmt CXyjVnEnhA4+I4jMzg6zzL1snyXnjK9e8V3QWjI1JGPZIKaPNvK3/RDDRgoCHgHmPj ZzJxAo0ixeA0nQFity8fNEte4xt0YGsiS9B0R/ZJ3mwnclbsdMGvOXlnalX4FdMYmD +35c/JPjEJUxA== From: Pratyush Yadav To: Alexander Graf , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , Hugh Dickins , Baolin Wang , Andrew Morton Cc: Jason Gunthorpe , Samiullah Khawaja , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] memfd: export memfd_{add,get}_seals() Date: Mon, 16 Feb 2026 19:59:32 +0100 Message-ID: <20260216185946.1215770-2-pratyush@kernel.org> X-Mailer: git-send-email 2.53.0.335.g19a08e0c02-goog In-Reply-To: <20260216185946.1215770-1-pratyush@kernel.org> References: <20260216185946.1215770-1-pratyush@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Pratyush Yadav (Google)" Support for preserving file seals will be added to memfd preservation using the Live Update Orchestrator (LUO). Export memfd_{add,get}_seals)() so memfd_luo can use them to manipulate the seals. Signed-off-by: Pratyush Yadav (Google) Acked-by: Mike Rapoport (Microsoft) --- include/linux/memfd.h | 12 ++++++++++++ mm/memfd.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/linux/memfd.h b/include/linux/memfd.h index c328a7b356d0..b4fda09dab9f 100644 --- a/include/linux/memfd.h +++ b/include/linux/memfd.h @@ -18,6 +18,8 @@ struct folio *memfd_alloc_folio(struct file *memfd, pgoff= _t idx); */ int memfd_check_seals_mmap(struct file *file, vm_flags_t *vm_flags_ptr); struct file *memfd_alloc_file(const char *name, unsigned int flags); +int memfd_get_seals(struct file *file); +int memfd_add_seals(struct file *file, unsigned int seals); #else static inline long memfd_fcntl(struct file *f, unsigned int c, unsigned in= t a) { @@ -37,6 +39,16 @@ static inline struct file *memfd_alloc_file(const char *= name, unsigned int flags { return ERR_PTR(-EINVAL); } + +static inline int memfd_get_seals(struct file *file) +{ + return -EINVAL; +} + +static inline int memfd_add_seals(struct file *file, unsigned int seals) +{ + return -EINVAL; +} #endif =20 #endif /* __LINUX_MEMFD_H */ diff --git a/mm/memfd.c b/mm/memfd.c index f032c6052926..46c5508beea4 100644 --- a/mm/memfd.c +++ b/mm/memfd.c @@ -228,7 +228,7 @@ static unsigned int *memfd_file_seals_ptr(struct file *= file) F_SEAL_WRITE | \ F_SEAL_FUTURE_WRITE) =20 -static int memfd_add_seals(struct file *file, unsigned int seals) +int memfd_add_seals(struct file *file, unsigned int seals) { struct inode *inode =3D file_inode(file); unsigned int *file_seals; @@ -310,7 +310,7 @@ static int memfd_add_seals(struct file *file, unsigned = int seals) return error; } =20 -static int memfd_get_seals(struct file *file) +int memfd_get_seals(struct file *file) { unsigned int *seals =3D memfd_file_seals_ptr(file); =20 --=20 2.53.0.335.g19a08e0c02-goog