Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memfd: export memfd_{add,get}_seals()

Patch series "mm: memfd_luo: preserve file seals", v2.

This series adds support for preserving file seals when preserving a memfd
using LUO. Patch 1 exports some memfd seal manipulation functions and
patch 2 adds support for preserving them. Since it makes changes to the
serialized data structure for memfd, it also bumps the version number.


This patch (of 2):

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.

Link: https://lkml.kernel.org/r/20260216185946.1215770-1-pratyush@kernel.org
Link: https://lkml.kernel.org/r/20260216185946.1215770-2-pratyush@kernel.org
Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Tested-by: Samiullah Khawaja <skhawaja@google.com>
Cc: Alexander Graf <graf@amazon.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Pratyush Yadav (Google) and committed by
Andrew Morton
1beb9b72 1df1a1b9

+14 -2
+12
include/linux/memfd.h
··· 18 18 */ 19 19 int memfd_check_seals_mmap(struct file *file, vm_flags_t *vm_flags_ptr); 20 20 struct file *memfd_alloc_file(const char *name, unsigned int flags); 21 + int memfd_get_seals(struct file *file); 22 + int memfd_add_seals(struct file *file, unsigned int seals); 21 23 #else 22 24 static inline long memfd_fcntl(struct file *f, unsigned int c, unsigned int a) 23 25 { ··· 38 36 static inline struct file *memfd_alloc_file(const char *name, unsigned int flags) 39 37 { 40 38 return ERR_PTR(-EINVAL); 39 + } 40 + 41 + static inline int memfd_get_seals(struct file *file) 42 + { 43 + return -EINVAL; 44 + } 45 + 46 + static inline int memfd_add_seals(struct file *file, unsigned int seals) 47 + { 48 + return -EINVAL; 41 49 } 42 50 #endif 43 51
+2 -2
mm/memfd.c
··· 227 227 F_SEAL_WRITE | \ 228 228 F_SEAL_FUTURE_WRITE) 229 229 230 - static int memfd_add_seals(struct file *file, unsigned int seals) 230 + int memfd_add_seals(struct file *file, unsigned int seals) 231 231 { 232 232 struct inode *inode = file_inode(file); 233 233 unsigned int *file_seals; ··· 309 309 return error; 310 310 } 311 311 312 - static int memfd_get_seals(struct file *file) 312 + int memfd_get_seals(struct file *file) 313 313 { 314 314 unsigned int *seals = memfd_file_seals_ptr(file); 315 315