qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v5 1/3] linux-user: Protect more syscalls


From: Laurent Vivier
Subject: Re: [PATCH v5 1/3] linux-user: Protect more syscalls
Date: Thu, 5 Mar 2020 21:52:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Le 05/03/2020 à 20:48, 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.

You should split this patch it two parts:
- one to add the needed "#ifdef"
- one to manage the futex_time64 case

For the futex_time64 you need the same work as in PATCH 2: use
target_to_host_timespec64() with TARGET_NR_futex_time64.

It's a little bit hacky to alias __NR_sys_futex to __NR_futex_time64,
and works only if timespec defined on the system is the 64bit version.

A better way to do that would be to define both, __NR_sys_futex and
__NR_sys_futex_time64 (according to the availability of their defines),
and then to call safe_futex_time64() and if it fails because of -ENOSYS
to try safe_futex() (we need to use __kernel_timespec and
__kernel_old_timespec accordingly).

Thanks,
Laurent



reply via email to

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