[PATCH 19/23] linux: Add memfd_secret

Florian Weimer fweimer@redhat.com
Tue Nov 3 16:06:37 GMT 2026


* Adhemerval Zanella:

> The memfd_secret system call (commit
> 1507f51255c9ff07d75909a84e7c0d7f3c4b2f49, Linux 5.14) creates a memory
> file descriptor whose memory is only accessible to the processes which
> map it (with MAP_SHARED).  It is enabled by default since Linux 6.5.
>
>   int memfd_secret (unsigned int flags);
>
> The only accepted flag is O_CLOEXEC.
>
> The system call is only wired up for the architectures which support
> removing pages from the direct map (currently aarch64, i386, loongarch,
> riscv, s390, and x86_64).  The wrapper is a C function which fails with
> ENOSYS on the other architectures, instead of a stub with a link-time
> warning, since it can also fail with ENOSYS on the supported ones (if
> secret memory is disabled at boot time).
>
> There is no widespread C user yet, it is currently called through
> syscall by the kernel selftests, and Go provides a raw system call
> binding in golang.org/x/sys/unix (MemfdSecret).
>
> Checked on x86_64-linux-gnu.

I believe this should update manual/llio.texi, next to the existing
entry for mmfd_create.

Thanks,
Florian



More information about the Libc-alpha mailing list