From 9bdfa4d23f4395dab89a60eb6b05a0308792bd66 Mon Sep 17 00:00:00 2001 From: Shu-Chun Weng Date: Mon, 19 Aug 2019 11:09:47 -0700 Subject: linux-user: add memfd_create Add support for the memfd_create syscall. If the host does not have the libc wrapper, translate to a direct syscall with NC-macro. Buglink: https://bugs.launchpad.net/qemu/+bug/1734792 Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier Message-Id: <20190819180947.180725-1-scw@google.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'linux-user') diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b42f59a..6928f65 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" #include "qemu/path.h" +#include "qemu/memfd.h" #include "qemu/queue.h" #include #include @@ -11938,6 +11939,17 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, /* PowerPC specific. */ return do_swapcontext(cpu_env, arg1, arg2, arg3); #endif +#ifdef TARGET_NR_memfd_create + case TARGET_NR_memfd_create: + p = lock_user_string(arg1); + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(memfd_create(p, arg2)); + fd_trans_unregister(ret); + unlock_user(p, arg1, 0); + return ret; +#endif default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); -- cgit v1.1