qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext
@ 2023-08-08  9:34 LIU Zhiwei
  2023-08-08 11:29 ` Daniel Henrique Barboza
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: LIU Zhiwei @ 2023-08-08  9:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alistair.Francis, palmer, bin.meng, liweiwei, dbarboza,
	qemu-riscv, LIU Zhiwei

We should not use types dependend on host arch for target_ucontext.
This bug is found when run rv32 applications.

Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
index eaa168199a..ff8634a272 100644
--- a/linux-user/riscv/signal.c
+++ b/linux-user/riscv/signal.c
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ulong uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext
  2023-08-08  9:34 [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext LIU Zhiwei
@ 2023-08-08 11:29 ` Daniel Henrique Barboza
  2023-08-08 14:28 ` Richard Henderson
  2023-08-10 10:48 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Henrique Barboza @ 2023-08-08 11:29 UTC (permalink / raw)
  To: LIU Zhiwei, qemu-devel
  Cc: Alistair.Francis, palmer, bin.meng, liweiwei, qemu-riscv



On 8/8/23 06:34, LIU Zhiwei wrote:
> We should not use types dependend on host arch for target_ucontext.
> This bug is found when run rv32 applications.
> 
> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>


>   linux-user/riscv/signal.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
> index eaa168199a..ff8634a272 100644
> --- a/linux-user/riscv/signal.c
> +++ b/linux-user/riscv/signal.c
> @@ -38,8 +38,8 @@ struct target_sigcontext {
>   }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
>   
>   struct target_ucontext {
> -    unsigned long uc_flags;
> -    struct target_ucontext *uc_link;
> +    abi_ulong uc_flags;
> +    abi_ulong uc_link;
>       target_stack_t uc_stack;
>       target_sigset_t uc_sigmask;
>       uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext
  2023-08-08  9:34 [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext LIU Zhiwei
  2023-08-08 11:29 ` Daniel Henrique Barboza
@ 2023-08-08 14:28 ` Richard Henderson
  2023-08-10 10:48 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2023-08-08 14:28 UTC (permalink / raw)
  To: LIU Zhiwei, qemu-devel
  Cc: Alistair.Francis, palmer, bin.meng, liweiwei, dbarboza,
	qemu-riscv

On 8/8/23 02:34, LIU Zhiwei wrote:
> We should not use types dependend on host arch for target_ucontext.
> This bug is found when run rv32 applications.
> 
> Signed-off-by: LIU Zhiwei<zhiwei_liu@linux.alibaba.com>
> ---
>   linux-user/riscv/signal.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext
  2023-08-08  9:34 [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext LIU Zhiwei
  2023-08-08 11:29 ` Daniel Henrique Barboza
  2023-08-08 14:28 ` Richard Henderson
@ 2023-08-10 10:48 ` Philippe Mathieu-Daudé
  2023-08-11  3:17   ` LIU Zhiwei
  2 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-10 10:48 UTC (permalink / raw)
  To: LIU Zhiwei, qemu-devel, Richard Henderson
  Cc: Alistair.Francis, palmer, bin.meng, liweiwei, dbarboza,
	qemu-riscv

On 8/8/23 11:34, LIU Zhiwei wrote:
> We should not use types dependend on host arch for target_ucontext.
> This bug is found when run rv32 applications.
> 
> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
> ---
>   linux-user/riscv/signal.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
> index eaa168199a..ff8634a272 100644
> --- a/linux-user/riscv/signal.c
> +++ b/linux-user/riscv/signal.c
> @@ -38,8 +38,8 @@ struct target_sigcontext {
>   }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
>   
>   struct target_ucontext {
> -    unsigned long uc_flags;
> -    struct target_ucontext *uc_link;
> +    abi_ulong uc_flags;

Correct.

> +    abi_ulong uc_link;

Isn't it 'abi_ptr uc_link' instead?

>       target_stack_t uc_stack;
>       target_sigset_t uc_sigmask;
>       uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext
  2023-08-10 10:48 ` Philippe Mathieu-Daudé
@ 2023-08-11  3:17   ` LIU Zhiwei
  0 siblings, 0 replies; 5+ messages in thread
From: LIU Zhiwei @ 2023-08-11  3:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, LIU Zhiwei, qemu-devel,
	Richard Henderson
  Cc: Alistair.Francis, palmer, bin.meng, liweiwei, dbarboza,
	qemu-riscv


On 2023/8/10 18:48, Philippe Mathieu-Daudé wrote:
> On 8/8/23 11:34, LIU Zhiwei wrote:
>> We should not use types dependend on host arch for target_ucontext.
>> This bug is found when run rv32 applications.
>>
>> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
>> ---
>>   linux-user/riscv/signal.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
>> index eaa168199a..ff8634a272 100644
>> --- a/linux-user/riscv/signal.c
>> +++ b/linux-user/riscv/signal.c
>> @@ -38,8 +38,8 @@ struct target_sigcontext {
>>   }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
>>     struct target_ucontext {
>> -    unsigned long uc_flags;
>> -    struct target_ucontext *uc_link;
>> +    abi_ulong uc_flags;
>
> Correct.
>
>> +    abi_ulong uc_link;
>
> Isn't it 'abi_ptr uc_link' instead?

Thanks, I think abi_ptr is better. As RISC-V doesn't has similar ABI as 
sparc32plus(64bit long but 32bit space address). It is also right here. 
And many arches  use the abi_ulong for uc_link, such as ARM.

I will send a v2 patch.

Zhiwei

>
>>       target_stack_t uc_stack;
>>       target_sigset_t uc_sigmask;
>>       uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-11  3:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08  9:34 [PATCH] linux-user/riscv: Use abi_ulong for target_ucontext LIU Zhiwei
2023-08-08 11:29 ` Daniel Henrique Barboza
2023-08-08 14:28 ` Richard Henderson
2023-08-10 10:48 ` Philippe Mathieu-Daudé
2023-08-11  3:17   ` LIU Zhiwei

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).