[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 8/8] linux-user: add getrandom() syscall
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL v2 8/8] linux-user: add getrandom() syscall |
Date: |
Thu, 25 Feb 2016 13:01:13 +0200 |
From: Laurent Vivier <address@hidden>
getrandom() has been introduced in kernel 3.17 and is now used during
the boot sequence of Debian unstable (stretch/sid).
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 539183a..9517531 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -249,6 +249,9 @@ _syscall2(int, ioprio_get, int, which, int, who)
#if defined(TARGET_NR_ioprio_set) && defined(__NR_ioprio_set)
_syscall3(int, ioprio_set, int, which, int, who, int, ioprio)
#endif
+#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom)
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif
static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -7541,6 +7544,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
ret = get_errno(shutdown(arg1, arg2));
break;
#endif
+#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom)
+ case TARGET_NR_getrandom:
+ p = lock_user(VERIFY_WRITE, arg1, arg2, 0);
+ if (!p) {
+ goto efault;
+ }
+ ret = get_errno(getrandom(p, arg2, arg3));
+ unlock_user(p, arg1, ret);
+ break;
+#endif
#ifdef TARGET_NR_socket
case TARGET_NR_socket:
ret = do_socket(arg1, arg2, arg3);
--
2.1.4
- [Qemu-devel] [PULL v2 0/8] linux-user updates and fixes, riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 1/8] linux-user: fix realloc size of target_fd_trans., riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 3/8] linux-user: set ppc64/ppc64le default CPU to POWER8, riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 6/8] linux-user: remove unavailable syscalls from aarch64, riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 5/8] linux-user: sync syscall numbers with kernel, riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 4/8] linux-user: Don't assert if guest tries shmdt(0), riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 2/8] build: [linux-user] Rename "syscall.h" to "target_syscall.h" in target directories, riku . voipio, 2016/02/25
- [Qemu-devel] [PULL v2 8/8] linux-user: add getrandom() syscall,
riku . voipio <=
- [Qemu-devel] [PULL v2 7/8] linux-user: correct timerfd_create syscall numbers, riku . voipio, 2016/02/25
- Re: [Qemu-devel] [PULL v2 0/8] linux-user updates and fixes, Peter Maydell, 2016/02/25