[PATCH 1/2] target/s390x/arch_dump: use correct byte order for pid

Omar Sandoval posted 2 patches 5 months, 1 week ago
Maintainers: Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>
[PATCH 1/2] target/s390x/arch_dump: use correct byte order for pid
Posted by Omar Sandoval 5 months, 1 week ago
The pid field of prstatus needs to be big endian like all of the other
fields.

Fixes: f738f296eaae ("s390x/arch_dump: pass cpuid into notes sections")
Signed-off-by: Omar Sandoval <osandov@osandov.com>
---
 target/s390x/arch_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c
index 7e8a1b4fc0..029d91d93a 100644
--- a/target/s390x/arch_dump.c
+++ b/target/s390x/arch_dump.c
@@ -102,7 +102,7 @@ static void s390x_write_elf64_prstatus(Note *note, S390CPU *cpu, int id)
         regs->acrs[i] = cpu_to_be32(cpu->env.aregs[i]);
         regs->gprs[i] = cpu_to_be64(cpu->env.regs[i]);
     }
-    note->contents.prstatus.pid = id;
+    note->contents.prstatus.pid = cpu_to_be32(id);
 }
 
 static void s390x_write_elf64_fpregset(Note *note, S390CPU *cpu, int id)
-- 
2.45.2
Re: [PATCH 1/2] target/s390x/arch_dump: use correct byte order for pid
Posted by Thomas Huth 5 months, 1 week ago
On 19/06/2024 07.00, Omar Sandoval wrote:
> The pid field of prstatus needs to be big endian like all of the other
> fields.
> 
> Fixes: f738f296eaae ("s390x/arch_dump: pass cpuid into notes sections")
> Signed-off-by: Omar Sandoval <osandov@osandov.com>
> ---
>   target/s390x/arch_dump.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c
> index 7e8a1b4fc0..029d91d93a 100644
> --- a/target/s390x/arch_dump.c
> +++ b/target/s390x/arch_dump.c
> @@ -102,7 +102,7 @@ static void s390x_write_elf64_prstatus(Note *note, S390CPU *cpu, int id)
>           regs->acrs[i] = cpu_to_be32(cpu->env.aregs[i]);
>           regs->gprs[i] = cpu_to_be64(cpu->env.regs[i]);
>       }
> -    note->contents.prstatus.pid = id;
> +    note->contents.prstatus.pid = cpu_to_be32(id);
>   }
>   
>   static void s390x_write_elf64_fpregset(Note *note, S390CPU *cpu, int id)

Reviewed-by: Thomas Huth <thuth@redhat.com>