Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] target/hppa: Fix random 32-bit linux-user crashes
@ 2024-09-03 16:41 Helge Deller
  2024-09-03 20:05 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Helge Deller @ 2024-09-03 16:41 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel, Philippe Mathieu-Daudé; +Cc: linux-parisc

The linux-user hppa target crashes randomly for me since commit
081a0ed188d8 ("target/hppa: Do not mask in copy_iaoq_entry").

That commit dropped the masking of the IAOQ addresses while copying them
from other registers and instead keeps them with all 64 bits up until
the full gva is formed with the help of hppa_form_gva_psw().

So, when running in linux-user mode on an emulated 64-bit CPU, we need
to mask to a 32-bit address space at the very end in hppa_form_gva_psw()
if the PSW-W flag isn't set (which is the case for linux-user on hppa).

Fixes: 081a0ed188d8 ("target/hppa: Do not mask in copy_iaoq_entry")
Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 2bcb3b602b..56d9568d6c 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -319,7 +319,7 @@ static inline target_ulong hppa_form_gva_psw(target_ulong psw, uint64_t spc,
                                              target_ulong off)
 {
 #ifdef CONFIG_USER_ONLY
-    return off;
+    return off & gva_offset_mask(psw);
 #else
     return spc | (off & gva_offset_mask(psw));
 #endif

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

* Re: [PATCH] target/hppa: Fix random 32-bit linux-user crashes
  2024-09-03 16:41 [PATCH] target/hppa: Fix random 32-bit linux-user crashes Helge Deller
@ 2024-09-03 20:05 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2024-09-03 20:05 UTC (permalink / raw)
  To: Helge Deller, qemu-devel, Philippe Mathieu-Daudé; +Cc: linux-parisc

On 9/3/24 09:41, Helge Deller wrote:
> The linux-user hppa target crashes randomly for me since commit
> 081a0ed188d8 ("target/hppa: Do not mask in copy_iaoq_entry").
> 
> That commit dropped the masking of the IAOQ addresses while copying them
> from other registers and instead keeps them with all 64 bits up until
> the full gva is formed with the help of hppa_form_gva_psw().
> 
> So, when running in linux-user mode on an emulated 64-bit CPU, we need
> to mask to a 32-bit address space at the very end in hppa_form_gva_psw()
> if the PSW-W flag isn't set (which is the case for linux-user on hppa).
> 
> Fixes: 081a0ed188d8 ("target/hppa: Do not mask in copy_iaoq_entry")
> Signed-off-by: Helge Deller <deller@gmx.de>
> 
> diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
> index 2bcb3b602b..56d9568d6c 100644
> --- a/target/hppa/cpu.h
> +++ b/target/hppa/cpu.h
> @@ -319,7 +319,7 @@ static inline target_ulong hppa_form_gva_psw(target_ulong psw, uint64_t spc,
>                                                target_ulong off)
>   {
>   #ifdef CONFIG_USER_ONLY
> -    return off;
> +    return off & gva_offset_mask(psw);
>   #else
>       return spc | (off & gva_offset_mask(psw));
>   #endif

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


r~

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

end of thread, other threads:[~2024-09-03 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 16:41 [PATCH] target/hppa: Fix random 32-bit linux-user crashes Helge Deller
2024-09-03 20:05 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox