Bug 26203 - GLRO(dl_x86_cpu_features) may not be intialized
Summary: GLRO(dl_x86_cpu_features) may not be intialized
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.33
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-04 12:32 UTC by H.J. Lu
Modified: 2020-10-16 23:54 UTC (History)
1 user (show)

See Also:
Host:
Target: i386, x86-64
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2020-07-04 12:32:50 UTC
This patch:

diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index 311502dee3..3ddc7104f4 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -769,6 +769,8 @@ init_cacheinfo (void)
   unsigned int threads = 0;
   const struct cpu_features *cpu_features = __get_cpu_features ();
 
+  assert (cpu_features->basic.kind != arch_kind_unknown);
+
   if (cpu_features->basic.kind == arch_kind_intel)
     {
       data = handle_intel (_SC_LEVEL1_DCACHE_SIZE, cpu_features);

caused:

FAIL: elf/tst-libc_dlvsym-static

GLRO(dl_x86_cpu_features) in ld.so is initialized by init_cpu_features, which
is invoked by DL_PLATFORM_INIT from _dl_sysdep_start.  But ld.so loaded by
static executable never calls _dl_sysdep_start.
Comment 1 H.J. Lu 2020-07-04 15:23:35 UTC
A patch:

https://sourceware.org/pipermail/libc-alpha/2020-July/115788.html

is posted to initialize CPU info as the part of relocation.
Comment 2 H.J. Lu 2020-10-16 23:54:37 UTC
Fixed in 2.33 by

commit 0f09154c64005e78b61484ae87b5ea2028051ea0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Jul 4 06:35:49 2020 -0700

    x86: Initialize CPU info via IFUNC relocation [BZ 26203]