Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx> writes:
From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Introduce 'memfd_restricted' system call with the ability to create
memory areas that are restricted from userspace access through ordinary
MMU operations (e.g. read/write/mmap). The memory content is expected to
be used through the new in-kernel interface by a third kernel module.
...
diff --git a/mm/restrictedmem.c b/mm/restrictedmem.c
new file mode 100644
index 000000000000..56953c204e5c
--- /dev/null
+++ b/mm/restrictedmem.c
@@ -0,0 +1,318 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "linux/sbitmap.h"
+#include <linux/pagemap.h>
+#include <linux/pseudo_fs.h>
+#include <linux/shmem_fs.h>
+#include <linux/syscalls.h>
+#include <uapi/linux/falloc.h>
+#include <uapi/linux/magic.h>
+#include <linux/restrictedmem.h>
+
+struct restrictedmem_data {
+ struct mutex lock;
+ struct file *memfd;
Can this be renamed to file, or lower_file (as in stacking filesystems)?
It's a little confusing because this pointer doesn't actually refer to
an fd.
'memfd' is already used by udmabuf to refer to an actual fd [1], which
makes this a little misleading.
[1]
https://elixir.bootlin.com/linux/v6.2.10/source/tools/testing/selftests/drivers/dma-buf/udmabuf.c#L63
+ struct list_head notifiers;
+};
+
...