powerpc: Protect dl_powerpc_cpu_features on INIT_ARCH()

Message ID 20200914145924.11389-1-rzinsly@linux.ibm.com
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers
Series powerpc: Protect dl_powerpc_cpu_features on INIT_ARCH() |

Commit Message

Raphael M Zinsly Sept. 14, 2020, 2:59 p.m. UTC
  dl_powerpc_cpu_features also needs to be protected by __GLRO to check
for the _rtld_global_ro realocation before accessing it.
---
 sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tulio Magno Quites Machado Filho Sept. 22, 2020, 8:48 p.m. UTC | #1
Raphael Moreira Zinsly <rzinsly@linux.ibm.com> writes:

> diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
> index 17ddfcf528..c8fa07fadc 100644
> --- a/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
> +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
> @@ -38,7 +38,7 @@
>    unsigned long int hwcap = __GLRO(dl_hwcap); 			\
>    unsigned long int __attribute__((unused)) hwcap2 = __GLRO(dl_hwcap2); \
>    bool __attribute__((unused)) use_cached_memopt =		\
> -    GLRO(dl_powerpc_cpu_features).use_cached_memopt;		\
> +    __GLRO(dl_powerpc_cpu_features.use_cached_memopt);		\

Agreed.  LGTM.

This is fixing BZ #26615, which was created after you submitted this patch.
I added this information to the patch and pushed as 3322ecbfe2.

Thanks!
  

Patch

diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
index 17ddfcf528..c8fa07fadc 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
@@ -38,7 +38,7 @@ 
   unsigned long int hwcap = __GLRO(dl_hwcap); 			\
   unsigned long int __attribute__((unused)) hwcap2 = __GLRO(dl_hwcap2); \
   bool __attribute__((unused)) use_cached_memopt =		\
-    GLRO(dl_powerpc_cpu_features).use_cached_memopt;		\
+    __GLRO(dl_powerpc_cpu_features.use_cached_memopt);		\
   if (hwcap & PPC_FEATURE_ARCH_2_06)				\
     hwcap |= PPC_FEATURE_ARCH_2_05 |				\
 	     PPC_FEATURE_POWER5_PLUS |				\