qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Tom Musta <tommusta@gmail.com>
Cc: riku.voipio@deploy.org, agraf@suse.de, qemu-ppc@nongnu.org,
	qemu-devel@nongnu.org, peter.maydell@deploy.org
Subject: Re: [Qemu-devel] [V2 PATCH 09/12] linux-user: Minimum Sig Handler Stack Size for PPC64 ELF V2
Date: Wed, 13 Aug 2014 15:31:00 +0300	[thread overview]
Message-ID: <20140813123100.GA15797@afflict.kos.to> (raw)
In-Reply-To: <1407869623-11185-10-git-send-email-tommusta@gmail.com>

On Tue, Aug 12, 2014 at 01:53:40PM -0500, Tom Musta wrote:
> The ELF V2 ABI for PPC64 defines MINSIGSTKSZ as 4096 bytes whereas it was
> 2048 previously.

fails to build - need to make get_ppc64_abi a properly exported function.
 
> Signed-off-by: Tom Musta <tommusta@gmail.com>
> ---
> V2: Define and use TARGET_MINSIGSTKSZ constants from the various
> linux-user/$ARCH/syscall.h files (per Peter Maydell's review).
> 
> There is still a runtime check for PPC64 since the stack size changes
> in ELF V2.
> 
>  linux-user/aarch64/syscall.h    |    1 +
>  linux-user/alpha/syscall.h      |    1 +
>  linux-user/arm/syscall.h        |    2 ++
>  linux-user/cris/syscall.h       |    1 +
>  linux-user/i386/syscall.h       |    1 +
>  linux-user/m68k/syscall.h       |    2 ++
>  linux-user/microblaze/syscall.h |    1 +
>  linux-user/mips/syscall.h       |    1 +
>  linux-user/mips64/syscall.h     |    1 +
>  linux-user/openrisc/syscall.h   |    2 ++
>  linux-user/ppc/syscall.h        |    2 ++
>  linux-user/s390x/syscall.h      |    1 +
>  linux-user/sh4/syscall.h        |    2 ++
>  linux-user/signal.c             |   12 +++++++++++-
>  linux-user/sparc/syscall.h      |    1 +
>  linux-user/sparc64/syscall.h    |    1 +
>  linux-user/unicore32/syscall.h  |    2 ++
>  linux-user/x86_64/syscall.h     |    1 +
>  18 files changed, 34 insertions(+), 1 deletions(-)
> 
> diff --git a/linux-user/aarch64/syscall.h b/linux-user/aarch64/syscall.h
> index 18f44a8..d1f4823 100644
> --- a/linux-user/aarch64/syscall.h
> +++ b/linux-user/aarch64/syscall.h
> @@ -8,3 +8,4 @@ struct target_pt_regs {
>  #define UNAME_MACHINE "aarch64"
>  #define UNAME_MINIMUM_RELEASE "3.8.0"
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ       2048
> diff --git a/linux-user/alpha/syscall.h b/linux-user/alpha/syscall.h
> index ed13d9a..3adedeb 100644
> --- a/linux-user/alpha/syscall.h
> +++ b/linux-user/alpha/syscall.h
> @@ -252,3 +252,4 @@ struct target_pt_regs {
>  #define TARGET_UAC_NOPRINT		1
>  #define TARGET_UAC_NOFIX		2
>  #define TARGET_UAC_SIGBUS		4
> +#define TARGET_MINSIGSTKSZ              4096
> diff --git a/linux-user/arm/syscall.h b/linux-user/arm/syscall.h
> index e0d2cc3..cdadb0c 100644
> --- a/linux-user/arm/syscall.h
> +++ b/linux-user/arm/syscall.h
> @@ -44,3 +44,5 @@ struct target_pt_regs {
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
>  #define TARGET_CLONE_BACKWARDS
> +
> +#define TARGET_MINSIGSTKSZ 2048
> diff --git a/linux-user/cris/syscall.h b/linux-user/cris/syscall.h
> index f5783c0..a75bcc4 100644
> --- a/linux-user/cris/syscall.h
> +++ b/linux-user/cris/syscall.h
> @@ -39,5 +39,6 @@ struct target_pt_regs {
>  };
>  
>  #define TARGET_CLONE_BACKWARDS2
> +#define TARGET_MINSIGSTKSZ 2048
>  
>  #endif
> diff --git a/linux-user/i386/syscall.h b/linux-user/i386/syscall.h
> index 9bfc1ad..acf6856 100644
> --- a/linux-user/i386/syscall.h
> +++ b/linux-user/i386/syscall.h
> @@ -147,3 +147,4 @@ struct target_vm86plus_struct {
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ 2048
> diff --git a/linux-user/m68k/syscall.h b/linux-user/m68k/syscall.h
> index 889eaf7..f8553f8 100644
> --- a/linux-user/m68k/syscall.h
> +++ b/linux-user/m68k/syscall.h
> @@ -18,4 +18,6 @@ struct target_pt_regs {
>  #define UNAME_MACHINE "m68k"
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
> +#define TARGET_MINSIGSTKSZ 2048
> +
>  void do_m68k_simcall(CPUM68KState *, int);
> diff --git a/linux-user/microblaze/syscall.h b/linux-user/microblaze/syscall.h
> index 5b5f6b4..2a5e160 100644
> --- a/linux-user/microblaze/syscall.h
> +++ b/linux-user/microblaze/syscall.h
> @@ -49,5 +49,6 @@ struct target_pt_regs {
>  };
>  
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ      2048
>  
>  #endif
> diff --git a/linux-user/mips/syscall.h b/linux-user/mips/syscall.h
> index 5bc5696..0b4662c 100644
> --- a/linux-user/mips/syscall.h
> +++ b/linux-user/mips/syscall.h
> @@ -228,3 +228,4 @@ struct target_pt_regs {
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ 2048
> diff --git a/linux-user/mips64/syscall.h b/linux-user/mips64/syscall.h
> index a7f5a58..39b8bed 100644
> --- a/linux-user/mips64/syscall.h
> +++ b/linux-user/mips64/syscall.h
> @@ -225,3 +225,4 @@ struct target_pt_regs {
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ      2048
> diff --git a/linux-user/openrisc/syscall.h b/linux-user/openrisc/syscall.h
> index c3b36da..e5e6180 100644
> --- a/linux-user/openrisc/syscall.h
> +++ b/linux-user/openrisc/syscall.h
> @@ -23,3 +23,5 @@ struct target_pt_regs {
>  
>  #define UNAME_MACHINE "openrisc"
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
> +
> +#define TARGET_MINSIGSTKSZ 2048
> diff --git a/linux-user/ppc/syscall.h b/linux-user/ppc/syscall.h
> index db92bbe..5311cc6 100644
> --- a/linux-user/ppc/syscall.h
> +++ b/linux-user/ppc/syscall.h
> @@ -69,3 +69,5 @@ struct target_revectored_struct {
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
>  #define TARGET_CLONE_BACKWARDS
> +
> +#define TARGET_MINSIGSTKSZ 2048
> diff --git a/linux-user/s390x/syscall.h b/linux-user/s390x/syscall.h
> index aaad512..b11a3b2 100644
> --- a/linux-user/s390x/syscall.h
> +++ b/linux-user/s390x/syscall.h
> @@ -24,3 +24,4 @@ struct target_pt_regs {
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
>  #define TARGET_CLONE_BACKWARDS2
> +#define TARGET_MINSIGSTKSZ        2048
> diff --git a/linux-user/sh4/syscall.h b/linux-user/sh4/syscall.h
> index ccd2216..285ecf3 100644
> --- a/linux-user/sh4/syscall.h
> +++ b/linux-user/sh4/syscall.h
> @@ -11,3 +11,5 @@ struct target_pt_regs {
>  
>  #define UNAME_MACHINE "sh4"
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
> +
> +#define TARGET_MINSIGSTKSZ 2048
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index cdfcc52..174c286 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 = TARGET_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

fails to build:

  CC    ppc64-linux-user/linux-user/signal.o
/home/voipio/deploy/qemu/linux-user/signal.c: In function ‘do_sigaltstack’:
/home/voipio/deploy/qemu/linux-user/signal.c:625:9: error: implicit declaration of function ‘get_ppc64_abi’ [-Werror=implicit-function-declaration]
         if (get_ppc64_abi(image) > 1) {
         ^
/home/voipio/deploy/qemu/linux-user/signal.c:625:9: error: nested extern declaration of ‘get_ppc64_abi’ [-Werror=nested-externs]
cc1: all warnings being treated as errors


>  	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;
> diff --git a/linux-user/sparc/syscall.h b/linux-user/sparc/syscall.h
> index 9549ea0..ae40744 100644
> --- a/linux-user/sparc/syscall.h
> +++ b/linux-user/sparc/syscall.h
> @@ -15,3 +15,4 @@ struct target_pt_regs {
>   * and copy_thread().
>   */
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ      4096
> diff --git a/linux-user/sparc64/syscall.h b/linux-user/sparc64/syscall.h
> index 82b1680..816a00f 100644
> --- a/linux-user/sparc64/syscall.h
> +++ b/linux-user/sparc64/syscall.h
> @@ -16,3 +16,4 @@ struct target_pt_regs {
>   * and copy_thread().
>   */
>  #define TARGET_CLONE_BACKWARDS
> +#define TARGET_MINSIGSTKSZ      4096
> diff --git a/linux-user/unicore32/syscall.h b/linux-user/unicore32/syscall.h
> index f7e5525..3ed6237 100644
> --- a/linux-user/unicore32/syscall.h
> +++ b/linux-user/unicore32/syscall.h
> @@ -53,4 +53,6 @@ struct target_pt_regs {
>  #define UNAME_MACHINE "UniCore-II"
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
>  
> +#define TARGET_MINSIGSTKSZ 2048
> +
>  #endif /* __UC32_SYSCALL_H__ */
> diff --git a/linux-user/x86_64/syscall.h b/linux-user/x86_64/syscall.h
> index e03b5a0..5828b91 100644
> --- a/linux-user/x86_64/syscall.h
> +++ b/linux-user/x86_64/syscall.h
> @@ -97,3 +97,4 @@ struct target_msqid64_ds {
>  #define TARGET_ARCH_SET_FS 0x1002
>  #define TARGET_ARCH_GET_FS 0x1003
>  #define TARGET_ARCH_GET_GS 0x1004
> +#define TARGET_MINSIGSTKSZ 2048
> -- 
> 1.7.1
> 

  reply	other threads:[~2014-08-13 12:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 18:53 [Qemu-devel] [V2 PATCH 00/12] target-ppc: Linux-User Mode Bug Fixes for Power Tom Musta
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 01/12] linux-user: PPC64 semid_ds Doesnt Include _unused1 and _unused2 Tom Musta
2014-08-26  0:20   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 02/12] linux-user: Dereference Pointer Argument to ipc/semctl Sys Call Tom Musta
2014-08-26  0:32   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 03/12] linux-user: Properly Handle semun Structure In Cross-Endian Situations Tom Musta
2014-08-26  0:36   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 04/12] linux-user: Make ipc syscall's third argument an abi_long Tom Musta
2014-08-26  0:39   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 05/12] linux-user: Conditionally Pass Attribute Pointer to mq_open() Tom Musta
2014-08-26  0:41   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 06/12] linux-user: Detect Negative Message Sizes in msgsnd System Call Tom Musta
2014-08-26  0:42   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 07/12] linux-user: Handle NULL sched_param argument to sched_* Tom Musta
2014-08-26  0:43   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 08/12] linux-user: Detect fault in sched_rr_get_interval Tom Musta
2014-08-26  0:44   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 09/12] linux-user: Minimum Sig Handler Stack Size for PPC64 ELF V2 Tom Musta
2014-08-13 12:31   ` Riku Voipio [this message]
2014-08-13 13:55     ` Tom Musta
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 10/12] linux-user: clock_nanosleep errno Handling on PPC Tom Musta
2014-08-26  0:48   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 11/12] linux-user: Support target-to-host translation of mlockall argument Tom Musta
2014-08-26  0:49   ` David Gibson
2014-08-12 18:53 ` [Qemu-devel] [V2 PATCH 12/12] linux-user: writev Partial Writes Tom Musta
2014-08-26  0:51   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140813123100.GA15797@afflict.kos.to \
    --to=riku.voipio@iki.fi \
    --cc=agraf@suse.de \
    --cc=peter.maydell@deploy.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=riku.voipio@deploy.org \
    --cc=tommusta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).