* [PATCH] x86: Fix bug in glibc.cpu.hwcaps.
@ 2023-02-28 10:31 caiyinyu
0 siblings, 0 replies; only message in thread
From: caiyinyu @ 2023-02-28 10:31 UTC (permalink / raw)
To: libc-alpha; +Cc: adhemerval.zanella, xry111, caiyinyu
1. export GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512
2. Add _dl_printf("p -- %s\n", p); just before switch(nl) in
sysdeps/x86/cpu-tunables.c
3. compiled and run ./testrun.sh /usr/bin/ls
you will get:
p -- -AVX512
p -- LC_ADDRESS=en_US.UTF-8
p -- LC_NUMERIC=C
...
Obviously wrong. It's far beyond the search range.
---
sysdeps/x86/cpu-tunables.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
index d3e1367bda..772fb0c4c2 100644
--- a/sysdeps/x86/cpu-tunables.c
+++ b/sysdeps/x86/cpu-tunables.c
@@ -107,13 +107,13 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
NOTE: the IFUNC selection may change over time. Please check all
multiarch implementations when experimenting. */
- const char *p = valp->strval;
+ const char *p = valp->strval, *c;
struct cpu_features *cpu_features = &GLRO(dl_x86_cpu_features);
size_t len;
do
{
- const char *c, *n;
+ const char *n;
bool disable;
size_t nl;
@@ -283,7 +283,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
}
p += len + 1;
}
- while (*p != '\0');
+ while (*c != '\0');
}
# if CET_ENABLED
--
2.31.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-28 10:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 10:31 [PATCH] x86: Fix bug in glibc.cpu.hwcaps caiyinyu
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 read-only IMAP folder(s) and NNTP newsgroup(s).