qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] linux-user: Protect more syscalls


From: Laurent Vivier
Subject: Re: [PATCH v2 1/2] linux-user: Protect more syscalls
Date: Tue, 25 Feb 2020 12:59:57 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Le 25/02/2020 à 00:21, Alistair Francis a écrit :
> New y2038 safe 32-bit architectures (like RISC-V) don't support old
> syscalls with a 32-bit time_t. The kernel defines new *_time64 versions
> of these syscalls. Add some more #ifdefs to syscall.c in linux-user to
> allow us to compile without these old syscalls.
> 
> Signed-off-by: Alistair Francis <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  linux-user/strace.c  |  2 ++
>  linux-user/syscall.c | 20 ++++++++++++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index 4f7130b2ff..6420ccd97b 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -775,6 +775,7 @@ print_syscall_ret_newselect(const struct syscallname 
> *name, abi_long ret)
>  #define TARGET_TIME_OOP      3   /* leap second in progress */
>  #define TARGET_TIME_WAIT     4   /* leap second has occurred */
>  #define TARGET_TIME_ERROR    5   /* clock not synchronized */
> +#ifdef TARGET_NR_adjtimex
>  static void
>  print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)
>  {
> @@ -813,6 +814,7 @@ print_syscall_ret_adjtimex(const struct syscallname 
> *name, abi_long ret)
>  
>      qemu_log("\n");
>  }
> +#endif
>  
>  UNUSED static struct flags access_flags[] = {
>      FLAG_GENERIC(F_OK),
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 8d27d10807..5a2156f95a 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -742,8 +742,10 @@ safe_syscall3(ssize_t, read, int, fd, void *, buff, 
> size_t, count)
>  safe_syscall3(ssize_t, write, int, fd, const void *, buff, size_t, count)
>  safe_syscall4(int, openat, int, dirfd, const char *, pathname, \
>                int, flags, mode_t, mode)
> +#if defined(TARGET_NR_wait4)
>  safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \
>                struct rusage *, rusage)

safe_wait4 is also used in TARGET_NR_waitpid

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]