This is a small server and client application for prototyping the new memfd_create(2) Linux system call.
Memfd is a simple memory sharing mechanism, added by the systemd/kdbus developers, to share pages between processes in an anonymous, no global registry needed, no mount-point required, relatively secure, manner. Check the references at the bottom of this page for primary documentation.
Server creates a classic Unix domain socket, and waits for clients to connect.
Upon a client connection, server creates a memfd region and fill it with a unique message. The file descriptor for this memory region is then sealed and passed to the client using Unix domain sockets file-descriptor passing mechanisms.
On the client side, upon connecting with the server, it recreives the
passed memfd file descriptor. Afterwards, the client tries to
SEAL memfd seals added by the server.
If everything goes as planned, the client can go and read the server-sent
mmap()-ing the passed file descriptor. This form of
communication is both zero-copy, and hopefully secure-enough, for zero-trust
- Linux Kernel 3.17 or higher
- Header files for such a kernel
sudo apt-get install linux-headers-$(uname -r)
sudo yum -y kernel-headers-$(uname -r)
- Arch Linux:
sudo pacman -S linux-headers