qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* qemu-hppa-user: crashes immediately in hppa chroot
@ 2024-08-28 17:12 Helge Deller
  2024-08-29  2:38 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2024-08-28 17:12 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

Hi Richard,

I tested qemu-user from v9.1-rc4 for hppa and noticed that it crashes
immediately when starting a hppa chroot.

I was able to bisect the segfault back to
commit 081a0ed188d8d9d9038f00337d331d185a7ae331
Author: Richard Henderson <richard.henderson@linaro.org>
Date:   Wed Mar 27 13:04:00 2024 -1000
    target/hppa: Do not mask in copy_iaoq_entry

This commit does not apply to git head any longer, but when I instead
apply this (modified) patch the segfault vanishes:

--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -664,6 +664,11 @@ static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest,
                             const DisasIAQE *src)
 {
     tcg_gen_addi_i64(dest, src->base ? : cpu_iaoq_f, src->disp);
+
+#if CONFIG_USER_ONLY
+    uint64_t mask = gva_offset_mask(ctx->tb_flags);
+    tcg_gen_andi_i64(dest, dest, mask);
+#endif
 }
 
Any idea or suggestion to fix it?

Helge


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

* Re: qemu-hppa-user: crashes immediately in hppa chroot
  2024-08-28 17:12 qemu-hppa-user: crashes immediately in hppa chroot Helge Deller
@ 2024-08-29  2:38 ` Richard Henderson
  2024-08-29 14:08   ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2024-08-29  2:38 UTC (permalink / raw)
  To: Helge Deller, qemu-devel

On 8/29/24 03:12, Helge Deller wrote:
> Hi Richard,
> 
> I tested qemu-user from v9.1-rc4 for hppa and noticed that it crashes
> immediately when starting a hppa chroot.
> 
> I was able to bisect the segfault back to
> commit 081a0ed188d8d9d9038f00337d331d185a7ae331
> Author: Richard Henderson <richard.henderson@linaro.org>
> Date:   Wed Mar 27 13:04:00 2024 -1000
>      target/hppa: Do not mask in copy_iaoq_entry
> 
> This commit does not apply to git head any longer, but when I instead
> apply this (modified) patch the segfault vanishes:
> 
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -664,6 +664,11 @@ static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest,
>                               const DisasIAQE *src)
>   {
>       tcg_gen_addi_i64(dest, src->base ? : cpu_iaoq_f, src->disp);
> +
> +#if CONFIG_USER_ONLY
> +    uint64_t mask = gva_offset_mask(ctx->tb_flags);
> +    tcg_gen_andi_i64(dest, dest, mask);
> +#endif
>   }
>   
> Any idea or suggestion to fix it?

More specifics are required.

root@stoup:/opt/chroot/hppa/sid# ./qemu-hppa -L . ./bin/echo foo
foo


r~


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

* Re: qemu-hppa-user: crashes immediately in hppa chroot
  2024-08-29  2:38 ` Richard Henderson
@ 2024-08-29 14:08   ` Helge Deller
  0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2024-08-29 14:08 UTC (permalink / raw)
  To: Richard Henderson, Helge Deller, qemu-devel

On 8/29/24 04:38, Richard Henderson wrote:
> On 8/29/24 03:12, Helge Deller wrote:
>> Hi Richard,
>>
>> I tested qemu-user from v9.1-rc4 for hppa and noticed that it crashes
>> immediately when starting a hppa chroot.
>>
>> I was able to bisect the segfault back to
>> commit 081a0ed188d8d9d9038f00337d331d185a7ae331
>> Author: Richard Henderson <richard.henderson@linaro.org>
>> Date:   Wed Mar 27 13:04:00 2024 -1000
>>      target/hppa: Do not mask in copy_iaoq_entry
>>
>> This commit does not apply to git head any longer, but when I instead
>> apply this (modified) patch the segfault vanishes:
>>
>> --- a/target/hppa/translate.c
>> +++ b/target/hppa/translate.c
>> @@ -664,6 +664,11 @@ static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest,
>>                               const DisasIAQE *src)
>>   {
>>       tcg_gen_addi_i64(dest, src->base ? : cpu_iaoq_f, src->disp);
>> +
>> +#if CONFIG_USER_ONLY
>> +    uint64_t mask = gva_offset_mask(ctx->tb_flags);
>> +    tcg_gen_andi_i64(dest, dest, mask);
>> +#endif
>>   }
>> Any idea or suggestion to fix it?
>
> More specifics are required.
>
> root@stoup:/opt/chroot/hppa/sid# ./qemu-hppa -L . ./bin/echo foo
> foo

You need to build a static binary of qemu-hppa and register it with binfmt.

On x86 debian machine I do (as root user):

modprobe binfmt_misc
echo -1 > /proc/sys/fs/binfmt_misc/qemu-hppa  # temporarily unregister hppa binfmt
mv -f /usr/bin/qemu-hppa-static /usr/bin/qemu-hppa-static.old # save away old to be able to copy new
cp build/qemu-hppa     /usr/bin/qemu-hppa-static  # COPY NEW STATIC BINARY IN PLACE (you need to copy yours!)
# register at binfmt:
echo ':qemu-hppa:M::'\
'\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f:'\
'\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:'\
'/usr/bin/qemu-hppa-static:POCF' > /proc/sys/fs/binfmt_misc/register


Then you should be able to chroot into your sid chroot and you should get a shell prompt:
chroot /opt/chroot/hppa/sid

With git head this segfaults for me.

Helge


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

end of thread, other threads:[~2024-08-29 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 17:12 qemu-hppa-user: crashes immediately in hppa chroot Helge Deller
2024-08-29  2:38 ` Richard Henderson
2024-08-29 14:08   ` Helge Deller

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