* [Qemu-devel] [PATCH] linux-user: add getrandom() syscall
@ 2016-02-05 20:00 Laurent Vivier
2016-02-15 13:16 ` Riku Voipio
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2016-02-05 20:00 UTC (permalink / raw)
To: Riku Voipio; +Cc: qemu-devel, Laurent Vivier
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 <laurent@vivier.eu>
---
linux-user/syscall.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index dac5518..6801fa2 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
+#ifdef TARGET_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
+#ifdef TARGET_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.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: add getrandom() syscall
2016-02-05 20:00 [Qemu-devel] [PATCH] linux-user: add getrandom() syscall Laurent Vivier
@ 2016-02-15 13:16 ` Riku Voipio
0 siblings, 0 replies; 2+ messages in thread
From: Riku Voipio @ 2016-02-15 13:16 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel
On perjantaina 5. helmikuuta 2016 22.00.53 EET, Laurent Vivier wrote:
> getrandom() has been introduced in kernel 3.17 and is now used during
> the boot sequence of Debian unstable (stretch/sid).
Applied, thanks
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> linux-user/syscall.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index dac5518..6801fa2 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
> +#ifdef TARGET_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
> +#ifdef TARGET_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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-15 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05 20:00 [Qemu-devel] [PATCH] linux-user: add getrandom() syscall Laurent Vivier
2016-02-15 13:16 ` Riku Voipio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).