qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [Qemu-devel] [PATCH 09/12] linux-user: Minimum Sig Handle


From: Peter Maydell
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH 09/12] linux-user: Minimum Sig Handler Stack Size for PPC64 ELF V2
Date: Mon, 4 Aug 2014 18:39:41 +0100

On 4 August 2014 17:45, Tom Musta <address@hidden> wrote:
> The ELF V2 ABI for PPC64 defines MINSIGSTKSZ as 4096 bytes whereas it was
> 2048 previously.

Alpha and SPARC also have a 4096 byte MINSIGSTKSZ...

> Signed-off-by: Tom Musta <address@hidden>
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index cdfcc52..b2a6e53 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -617,6 +617,15 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong 
> uoss_addr, abi_ulong sp)
>      {
>          struct target_sigaltstack *uss;
>          struct target_sigaltstack ss;
> +        size_t minstacksize = MINSIGSTKSZ;
> +
> +#if defined(TARGET_PPC64)
> +        /* ELF V2 for PPC64 has a 4K minimum stack size for signal handlers 
> */
> +        struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
> +        if (get_ppc64_abi(image) > 1) {
> +            minstacksize = 4096;
> +        }
> +#endif

Shouldn't we just define and use a TARGET_MINSIGSTKSZ ?
Checking against the host's MINSIGSTKSZ is wrong, I think.

Again, define the TARGET_MINSIGSTKSZ in a file in
linux-user/$ARCH/, for all targets:
 alpha, sparc, ppc64: 4096
 everything else: 2048
(itanium is weird here but we don't support that for linux-user guests)

>         ret = -TARGET_EFAULT;
>          if (!lock_user_struct(VERIFY_READ, uss, uss_addr, 1)) {
> @@ -642,8 +651,9 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong 
> uoss_addr, abi_ulong sp)
>              ss.ss_sp = 0;
>         } else {
>              ret = -TARGET_ENOMEM;
> -            if (ss.ss_size < MINSIGSTKSZ)
> +            if (ss.ss_size < minstacksize) {
>                  goto out;
> +            }
>         }
>
>          target_sigaltstack_used.ss_sp = ss.ss_sp;
> --
> 1.7.1

thanks
-- PMM



reply via email to

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