[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/8] linux-user: Disallow setting newsp for f
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/8] linux-user: Disallow setting newsp for fork |
Date: |
Tue, 14 May 2019 17:31:05 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 5/9/19 8:27 PM, Richard Henderson wrote:
> Or really, just clone devolving into fork. This should not ever happen
> in practice. We do want to reserve calling cpu_clone_regs for the case
> in which we are actually performing a clone.
>
> Reviewed-by: Alex Bennée <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> linux-user/syscall.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 96cd4bf86d..f7d0754c8d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -5553,10 +5553,14 @@ static int do_fork(CPUArchState *env, unsigned int
> flags, abi_ulong newsp,
> pthread_mutex_destroy(&info.mutex);
> pthread_mutex_unlock(&clone_lock);
> } else {
> - /* if no CLONE_VM, we consider it is a fork */
> + /* If no CLONE_VM, we consider it is a fork. */
> if (flags & CLONE_INVALID_FORK_FLAGS) {
> return -TARGET_EINVAL;
> }
> + /* As a fork, setting a new sp does not make sense. */
> + if (newsp) {
> + return -TARGET_EINVAL;
> + }
This causes failures for aarch64 and riscv.
We have to allow no-op setting of sp as well.
Other targets set newsp to 0 for in vfork.S in glibc.
r~
- [Qemu-devel] [PATCH v2 0/8] linux-user sparc fixes, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 1/8] linux-user: Disallow setting newsp for fork, Richard Henderson, 2019/05/09
- Re: [Qemu-devel] [PATCH v2 1/8] linux-user: Disallow setting newsp for fork,
Richard Henderson <=
- [Qemu-devel] [PATCH v2 2/8] linux-user: Pass the parent env to cpu_clone_regs, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 4/8] linux-user/sparc: Use WREG constants in sparc/target_cpu.h, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 3/8] target/sparc: Define an enumeration for accessing env->regwptr, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 6/8] linux-user/sparc: Fix cpu_clone_regs, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 5/8] linux-user/sparc: Use WREG constants in sparc/signal.c, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 8/8] scripts/qemu-binfmt-conf: Update for sparc64, Richard Henderson, 2019/05/09
- [Qemu-devel] [PATCH v2 7/8] linux-user/sparc: Flush register windows before clone, Richard Henderson, 2019/05/09