Skip to contentSkip to conversation

linux-user/elfload.c: use get_elf_hwcap2 to fix regression

PATCH In review [email protected] 3 participants 3 messages Feb 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/elfload.c: use get_elf_hwcap2 to fix regression

From: Chen Qi <[email protected]>

In commit fcac98d0b (linux-user: Remove ELF_HWCAP2), the following macro is removed:

However, in place of the original ELF_HWCAP2, get_elf_hwcap instead of the original get_elf_hwcap2 was used.

This caused serious regression for at least ppc64 user mode. The error message is like below:

Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)

This patch restores to use get_elf_hwcap2.

---
 linux-user/elfload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +1 -1
index 0002d5be2f..35471c0c9a 100644
@@ -708,7 +708,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     NEW_AUX_ENT(AT_EXECFN, info->file_string);
 
     if (HAVE_ELF_HWCAP2) {
-        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap(thread_cpu));
+        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap2(thread_cpu));
     }
     if (u_base_platform) {
         NEW_AUX_ENT(AT_BASE_PLATFORM, u_base_platform);
Signature · 1 line
2.34.1
#1 lore raw

Hi,

Quoted 25 lines · On 2/2/26 06:45, [email protected] wrote:

From: Chen Qi <[email protected]>

In commit fcac98d0b (linux-user: Remove ELF_HWCAP2), the following macro is removed:

However, in place of the original ELF_HWCAP2, get_elf_hwcap instead of the original get_elf_hwcap2 was used.

This caused serious regression for at least ppc64 user mode. The error message is like below:

Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)

This patch restores to use get_elf_hwcap2.

---
  linux-user/elfload.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +0 -0
index 0002d5be2f..35471c0c9a 100644

linux-user/elfload.c static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, · line 712

Quoted 6 lines
linux-user/elfload.c +1 -1
@@ -708,7 +708,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
      NEW_AUX_ENT(AT_EXECFN, info->file_string);
 
      if (HAVE_ELF_HWCAP2) {
-        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap(thread_cpu));
+        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap2(thread_cpu));
      }

This is the correct fix. It was committed recently:
https://gitlab.com/qemu-project/qemu/-/commit/c333f9c4ee212297f3b9a8a6ef62396a63c48e61

We forgot to Cc qemu-stable. Michael, could you include this commit for v10.2.x stable series?

Thanks,

Phil.

#2 lore raw
Quoted 38 lines · Philippe Mathieu-Daudé

Hi,

Quoted 25 lines · On 2/2/26 06:45, [email protected] wrote:

From: Chen Qi <[email protected]>

In commit fcac98d0b (linux-user: Remove ELF_HWCAP2), the following macro is removed:

However, in place of the original ELF_HWCAP2, get_elf_hwcap instead of the original get_elf_hwcap2 was used.

This caused serious regression for at least ppc64 user mode. The error message is like below:

   Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)

This patch restores to use get_elf_hwcap2.

---
  linux-user/elfload.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +0 -0
index 0002d5be2f..35471c0c9a 100644

linux-user/elfload.c static abi_ulong create_elf_tables(abi_ulong p, · line 712

Quoted 6 lines
linux-user/elfload.c +1 -1
@@ -708,7 +708,7 @@ static abi_ulong create_elf_tables(abi_ulong p, 
 int argc, int envc,
       NEW_AUX_ENT(AT_EXECFN, info->file_string);
       if (HAVE_ELF_HWCAP2) {
-        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap(thread_cpu));
+        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap2(thread_cpu));
       }

This is the correct fix. It was committed recently:
https://gitlab.com/qemu-project/qemu/-/commit/ c333f9c4ee212297f3b9a8a6ef62396a63c48e61

Quoted 2 lines

We forgot to Cc qemu-stable. Michael, could you include this commit for v10.2.x stable series?

Yeah, it's been applied to 10.2.x for quite some time, - I picked it up on Jan-13.

Now I wonder - why did I pick it up? :)

But it's there, at least.

Thanks,

/mjt