mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-05-09 21:42:09 +02:00
1beb9b7223
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>
55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LINUX_MEMFD_H
|
|
#define __LINUX_MEMFD_H
|
|
|
|
#include <linux/file.h>
|
|
|
|
#define MEMFD_ANON_NAME "[memfd]"
|
|
|
|
#ifdef CONFIG_MEMFD_CREATE
|
|
extern long memfd_fcntl(struct file *file, unsigned int cmd, unsigned int arg);
|
|
struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx);
|
|
/*
|
|
* Check for any existing seals on mmap, return an error if access is denied due
|
|
* to sealing, or 0 otherwise.
|
|
*
|
|
* We also update VMA flags if appropriate by manipulating the VMA flags pointed
|
|
* to by vm_flags_ptr.
|
|
*/
|
|
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 int a)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
static inline struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx)
|
|
{
|
|
return ERR_PTR(-EINVAL);
|
|
}
|
|
static inline int memfd_check_seals_mmap(struct file *file,
|
|
vm_flags_t *vm_flags_ptr)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
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
|
|
|
|
#endif /* __LINUX_MEMFD_H */
|