[Qemu-devel] [PATCH for 4.1] linux-user: Fix structure target_ucontext for MIPS

Aleksandar Markovic posted 1 patch 4 years, 10 months ago
Test s390x failed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test asan passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1562251966-19318-1-git-send-email-aleksandar.markovic@rt-rk.com
Maintainers: Laurent Vivier <laurent@vivier.eu>, Riku Voipio <riku.voipio@iki.fi>
There is a newer version of this series
linux-user/mips/signal.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[Qemu-devel] [PATCH for 4.1] linux-user: Fix structure target_ucontext for MIPS
Posted by Aleksandar Markovic 4 years, 10 months ago
From: Aleksandar Markovic <amarkovic@wavecomp.com>

Structure ucontext for MIPS is defined in the following way in
Linux kernel:

(arch/mips/include/uapi/asm/ucontext.h, lines 54-64)

struct ucontext {
    /* Historic fields matching asm-generic */
    unsigned long       uc_flags;
    struct ucontext     *uc_link;
    stack_t             uc_stack;
    struct sigcontext   uc_mcontext;
    sigset_t            uc_sigmask;

    /* Extended context structures may follow ucontext */
    unsigned long long	uc_extcontext[0];
};

Fix the structure target_sigset_t for MIPS to reflect the definition
above, except the correction for field uc_extcontext, which will
follow at some later time.

Fixes: 94c5495d

Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/mips/signal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c
index 6aa303e..455a8a2 100644
--- a/linux-user/mips/signal.c
+++ b/linux-user/mips/signal.c
@@ -71,10 +71,9 @@ struct sigframe {
 };
 
 struct target_ucontext {
-    target_ulong tuc_flags;
-    target_ulong tuc_link;
+    abi_ulong tuc_flags;
+    abi_ulong tuc_link;
     target_stack_t tuc_stack;
-    target_ulong pad0;
     struct target_sigcontext tuc_mcontext;
     target_sigset_t tuc_sigmask;
 };
-- 
2.7.4


Re: [Qemu-devel] [PATCH for 4.1] linux-user: Fix structure target_ucontext for MIPS
Posted by Laurent Vivier 4 years, 10 months ago
Le 04/07/2019 à 16:52, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Structure ucontext for MIPS is defined in the following way in
> Linux kernel:
> 
> (arch/mips/include/uapi/asm/ucontext.h, lines 54-64)
> 
> struct ucontext {
>     /* Historic fields matching asm-generic */
>     unsigned long       uc_flags;
>     struct ucontext     *uc_link;
>     stack_t             uc_stack;
>     struct sigcontext   uc_mcontext;
>     sigset_t            uc_sigmask;
> 
>     /* Extended context structures may follow ucontext */
>     unsigned long long	uc_extcontext[0];
> };
> 
> Fix the structure target_sigset_t for MIPS to reflect the definition
> above, except the correction for field uc_extcontext, which will
> follow at some later time.
> 
> Fixes: 94c5495d
> 
> Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/mips/signal.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c
> index 6aa303e..455a8a2 100644
> --- a/linux-user/mips/signal.c
> +++ b/linux-user/mips/signal.c
> @@ -71,10 +71,9 @@ struct sigframe {
>  };
>  
>  struct target_ucontext {
> -    target_ulong tuc_flags;
> -    target_ulong tuc_link;
> +    abi_ulong tuc_flags;
> +    abi_ulong tuc_link;
>      target_stack_t tuc_stack;
> -    target_ulong pad0;
>      struct target_sigcontext tuc_mcontext;
>      target_sigset_t tuc_sigmask;
>  };
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

I think the padding is not needed anymore because the ABI types are now
aligned using the target ABI rules.

Thanks,
Laurent