public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
@ 2023-03-02  2:33 caiyinyu
  2023-03-02  4:22 ` H.J. Lu
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-02  2:33 UTC (permalink / raw)
  To: libc-alpha; +Cc: goldstein.w.n, caiyinyu

Recorded in [BZ #30183]:

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
...

The function, TUNABLE_CALLBACK (set_hwcaps)
(tunable_val_t *valp), checks far more than it should and it
should stop at end of "-AVX512".
---
 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] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-02  2:33 [PATCH] x86: Fix bug about glibc.cpu.hwcaps caiyinyu
@ 2023-03-02  4:22 ` H.J. Lu
  2023-03-07 12:45   ` caiyinyu
  0 siblings, 1 reply; 16+ messages in thread
From: H.J. Lu @ 2023-03-02  4:22 UTC (permalink / raw)
  To: caiyinyu; +Cc: libc-alpha, goldstein.w.n

On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn> wrote:
>
> Recorded in [BZ #30183]:
>
> 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
> ...
>
> The function, TUNABLE_CALLBACK (set_hwcaps)
> (tunable_val_t *valp), checks far more than it should and it
> should stop at end of "-AVX512".
> ---
>  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
>

OK.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-02  4:22 ` H.J. Lu
@ 2023-03-07 12:45   ` caiyinyu
  2023-03-07 13:02     ` Xi Ruoyao
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-07 12:45 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha, goldstein.w.n


在 2023/3/2 下午12:22, H.J. Lu 写道:
> On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn> wrote:
>> Recorded in [BZ #30183]:
>>
>> 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
>> ...
>>
>> The function, TUNABLE_CALLBACK (set_hwcaps)
>> (tunable_val_t *valp), checks far more than it should and it
>> should stop at end of "-AVX512".
>> ---
>>   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
>>
> OK.
>
> Thanks.

Could you help to push this patch?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-07 12:45   ` caiyinyu
@ 2023-03-07 13:02     ` Xi Ruoyao
  2023-03-07 13:18       ` caiyinyu
  0 siblings, 1 reply; 16+ messages in thread
From: Xi Ruoyao @ 2023-03-07 13:02 UTC (permalink / raw)
  To: caiyinyu, H.J. Lu; +Cc: libc-alpha, goldstein.w.n

On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
> 
> 在 2023/3/2 下午12:22, H.J. Lu 写道:
> > On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
> > wrote:
> > > Recorded in [BZ #30183]:
> > > 
> > > 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
> > > ...
> > > 
> > > The function, TUNABLE_CALLBACK (set_hwcaps)
> > > (tunable_val_t *valp), checks far more than it should and it
> > > should stop at end of "-AVX512".
> > > ---
> > >   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
> > > 
> > OK.
> > 
> > Thanks.
> 
> Could you help to push this patch?

I guess you can push it yourself.  A port maintainer has write access to
the entire Git repository, just use it carefully (i. e. always get a
permission before changing other subsystems).

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-07 13:02     ` Xi Ruoyao
@ 2023-03-07 13:18       ` caiyinyu
  2023-03-07 17:23         ` Noah Goldstein
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-07 13:18 UTC (permalink / raw)
  To: Xi Ruoyao, H.J. Lu; +Cc: libc-alpha, goldstein.w.n


在 2023/3/7 下午9:02, Xi Ruoyao 写道:
> On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
>> 在 2023/3/2 下午12:22, H.J. Lu 写道:
>>> On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
>>> wrote:
>>>> Recorded in [BZ #30183]:
>>>>
>>>> 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
>>>> ...
>>>>
>>>> The function, TUNABLE_CALLBACK (set_hwcaps)
>>>> (tunable_val_t *valp), checks far more than it should and it
>>>> should stop at end of "-AVX512".
>>>> ---
>>>>    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
>>>>
>>> OK.
>>>
>>> Thanks.
>> Could you help to push this patch?
> I guess you can push it yourself.  A port maintainer has write access to
> the entire Git repository, just use it carefully (i. e. always get a
> permission before changing other subsystems).
>
OK, thanks.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-07 13:18       ` caiyinyu
@ 2023-03-07 17:23         ` Noah Goldstein
  2023-03-08  7:16           ` caiyinyu
  0 siblings, 1 reply; 16+ messages in thread
From: Noah Goldstein @ 2023-03-07 17:23 UTC (permalink / raw)
  To: caiyinyu; +Cc: Xi Ruoyao, H.J. Lu, libc-alpha

On Tue, Mar 7, 2023 at 7:18 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>
>
> 在 2023/3/7 下午9:02, Xi Ruoyao 写道:
> > On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
> >> 在 2023/3/2 下午12:22, H.J. Lu 写道:
> >>> On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
> >>> wrote:
> >>>> Recorded in [BZ #30183]:
> >>>>
> >>>> 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
> >>>> ...
> >>>>
> >>>> The function, TUNABLE_CALLBACK (set_hwcaps)
> >>>> (tunable_val_t *valp), checks far more than it should and it
> >>>> should stop at end of "-AVX512".
> >>>> ---
> >>>>    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
> >>>>
> >>> OK.
> >>>
> >>> Thanks.
> >> Could you help to push this patch?
> > I guess you can push it yourself.  A port maintainer has write access to
> > the entire Git repository, just use it carefully (i. e. always get a
> > permission before changing other subsystems).
> >
> OK, thanks.

did you add the tests HJ asked for?
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-07 17:23         ` Noah Goldstein
@ 2023-03-08  7:16           ` caiyinyu
  2023-03-08 16:56             ` Noah Goldstein
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-08  7:16 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: Xi Ruoyao, H.J. Lu, libc-alpha


在 2023/3/8 上午1:23, Noah Goldstein 写道:
> On Tue, Mar 7, 2023 at 7:18 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>>
>> 在 2023/3/7 下午9:02, Xi Ruoyao 写道:
>>> On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
>>>> 在 2023/3/2 下午12:22, H.J. Lu 写道:
>>>>> On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
>>>>> wrote:
>>>>>> Recorded in [BZ #30183]:
>>>>>>
>>>>>> 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
>>>>>> ...
>>>>>>
>>>>>> The function, TUNABLE_CALLBACK (set_hwcaps)
>>>>>> (tunable_val_t *valp), checks far more than it should and it
>>>>>> should stop at end of "-AVX512".
>>>>>> ---
>>>>>>     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
>>>>>>
>>>>> OK.
>>>>>
>>>>> Thanks.
>>>> Could you help to push this patch?
>>> I guess you can push it yourself.  A port maintainer has write access to
>>> the entire Git repository, just use it carefully (i. e. always get a
>>> permission before changing other subsystems).
>>>
>> OK, thanks.
> did you add the tests HJ asked for?

Not yet.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-08  7:16           ` caiyinyu
@ 2023-03-08 16:56             ` Noah Goldstein
  2023-03-09  1:26               ` caiyinyu
  0 siblings, 1 reply; 16+ messages in thread
From: Noah Goldstein @ 2023-03-08 16:56 UTC (permalink / raw)
  To: caiyinyu; +Cc: Xi Ruoyao, H.J. Lu, libc-alpha

On Wed, Mar 8, 2023 at 1:16 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>
>
> 在 2023/3/8 上午1:23, Noah Goldstein 写道:
> > On Tue, Mar 7, 2023 at 7:18 AM caiyinyu <caiyinyu@loongson.cn> wrote:
> >>
> >> 在 2023/3/7 下午9:02, Xi Ruoyao 写道:
> >>> On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
> >>>> 在 2023/3/2 下午12:22, H.J. Lu 写道:
> >>>>> On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
> >>>>> wrote:
> >>>>>> Recorded in [BZ #30183]:
> >>>>>>
> >>>>>> 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
> >>>>>> ...
> >>>>>>
> >>>>>> The function, TUNABLE_CALLBACK (set_hwcaps)
> >>>>>> (tunable_val_t *valp), checks far more than it should and it
> >>>>>> should stop at end of "-AVX512".
> >>>>>> ---
> >>>>>>     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
> >>>>>>
> >>>>> OK.
> >>>>>
> >>>>> Thanks.
> >>>> Could you help to push this patch?
> >>> I guess you can push it yourself.  A port maintainer has write access to
> >>> the entire Git repository, just use it carefully (i. e. always get a
> >>> permission before changing other subsystems).
> >>>
> >> OK, thanks.
> > did you add the tests HJ asked for?
>
> Not yet.
It also doesn't have the BZ number in the commit message. In the future please
wait for approval before pushing.

>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-08 16:56             ` Noah Goldstein
@ 2023-03-09  1:26               ` caiyinyu
  2023-03-09  3:25                 ` Xi Ruoyao
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-09  1:26 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: Xi Ruoyao, H.J. Lu, libc-alpha


在 2023/3/9 上午12:56, Noah Goldstein 写道:
> On Wed, Mar 8, 2023 at 1:16 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>>
>> 在 2023/3/8 上午1:23, Noah Goldstein 写道:
>>> On Tue, Mar 7, 2023 at 7:18 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>>>> 在 2023/3/7 下午9:02, Xi Ruoyao 写道:
>>>>> On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
>>>>>> 在 2023/3/2 下午12:22, H.J. Lu 写道:
>>>>>>> On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
>>>>>>> wrote:
>>>>>>>> Recorded in [BZ #30183]:
>>>>>>>>
>>>>>>>> 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
>>>>>>>> ...
>>>>>>>>
>>>>>>>> The function, TUNABLE_CALLBACK (set_hwcaps)
>>>>>>>> (tunable_val_t *valp), checks far more than it should and it
>>>>>>>> should stop at end of "-AVX512".
>>>>>>>> ---
>>>>>>>>      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
>>>>>>>>
>>>>>>> OK.
>>>>>>>
>>>>>>> Thanks.
>>>>>> Could you help to push this patch?
>>>>> I guess you can push it yourself.  A port maintainer has write access to
>>>>> the entire Git repository, just use it carefully (i. e. always get a
>>>>> permission before changing other subsystems).
>>>>>
>>>> OK, thanks.
>>> did you add the tests HJ asked for?
>> Not yet.
> It also doesn't have the BZ number in the commit message. In the future please
> wait for approval before pushing.
>
Ok. There are "Recorded in [BZ #30183]:" in the commit message and I 
will append it on

the first line next time.

I mistakenly thought HJ is ok with

>>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-09  1:26               ` caiyinyu
@ 2023-03-09  3:25                 ` Xi Ruoyao
  0 siblings, 0 replies; 16+ messages in thread
From: Xi Ruoyao @ 2023-03-09  3:25 UTC (permalink / raw)
  To: caiyinyu, Noah Goldstein; +Cc: H.J. Lu, libc-alpha

On Thu, 2023-03-09 at 09:26 +0800, caiyinyu wrote:
> > It also doesn't have the BZ number in the commit message. In the future please
> > wait for approval before pushing.

My bad.  I thought the "OK" from H. J. was a formal approval and gave
some wrong advice.

> > 
> Ok. There are "Recorded in [BZ #30183]:" in the commit message and I 
> will append it on
> 
> the first line next time.
> 
> I mistakenly thought HJ is ok with

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-01 16:42     ` Noah Goldstein
  2023-03-01 17:33       ` H.J. Lu
@ 2023-03-02  2:37       ` caiyinyu
  1 sibling, 0 replies; 16+ messages in thread
From: caiyinyu @ 2023-03-02  2:37 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: libc-alpha, adhemerval.zanella, hjl.tools, carlos


在 2023/3/2 上午12:42, Noah Goldstein 写道:
> On Wed, Mar 1, 2023 at 3:11 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>>
>> 在 2023/3/1 下午12:19, Noah Goldstein 写道:
>>> On Tue, Feb 28, 2023 at 9:22 PM caiyinyu <caiyinyu@loongson.cn> wrote:
>>>> 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
>>>> ...
>>>>
>>>> The function, TUNABLE_CALLBACK (set_hwcaps)
>>>> (tunable_val_t *valp), checks far more than it should and it
>>>> should stop at end of "-AVX512".
>>>> ---
>>>>    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
>>>>
>>> Can you make a bugzilla for this?
>> bugzilla:
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=30183
>>
>>
> Can you append '[BZ #30183]' to the commit message.
> Otherwise looks good.


OK.

https://sourceware.org/pipermail/libc-alpha/2023-March/145996.html


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-01 16:42     ` Noah Goldstein
@ 2023-03-01 17:33       ` H.J. Lu
  2023-03-02  2:37       ` caiyinyu
  1 sibling, 0 replies; 16+ messages in thread
From: H.J. Lu @ 2023-03-01 17:33 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: caiyinyu, libc-alpha, adhemerval.zanella, carlos

On Wed, Mar 1, 2023 at 8:43 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Wed, Mar 1, 2023 at 3:11 AM caiyinyu <caiyinyu@loongson.cn> wrote:
> >
> >
> > 在 2023/3/1 下午12:19, Noah Goldstein 写道:
> > > On Tue, Feb 28, 2023 at 9:22 PM caiyinyu <caiyinyu@loongson.cn> wrote:
> > >> 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
> > >> ...
> > >>
> > >> The function, TUNABLE_CALLBACK (set_hwcaps)
> > >> (tunable_val_t *valp), checks far more than it should and it
> > >> should stop at end of "-AVX512".
> > >> ---
> > >>   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
> > >>
> > > Can you make a bugzilla for this?
> > bugzilla:
> >
> > https://sourceware.org/bugzilla/show_bug.cgi?id=30183
> >
> >
> Can you append '[BZ #30183]' to the commit message.
> Otherwise looks good.

Is it possible to add a testcase?

-- 
H.J.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-01  9:10   ` caiyinyu
@ 2023-03-01 16:42     ` Noah Goldstein
  2023-03-01 17:33       ` H.J. Lu
  2023-03-02  2:37       ` caiyinyu
  0 siblings, 2 replies; 16+ messages in thread
From: Noah Goldstein @ 2023-03-01 16:42 UTC (permalink / raw)
  To: caiyinyu; +Cc: libc-alpha, adhemerval.zanella, hjl.tools, carlos

On Wed, Mar 1, 2023 at 3:11 AM caiyinyu <caiyinyu@loongson.cn> wrote:
>
>
> 在 2023/3/1 下午12:19, Noah Goldstein 写道:
> > On Tue, Feb 28, 2023 at 9:22 PM caiyinyu <caiyinyu@loongson.cn> wrote:
> >> 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
> >> ...
> >>
> >> The function, TUNABLE_CALLBACK (set_hwcaps)
> >> (tunable_val_t *valp), checks far more than it should and it
> >> should stop at end of "-AVX512".
> >> ---
> >>   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
> >>
> > Can you make a bugzilla for this?
> bugzilla:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=30183
>
>
Can you append '[BZ #30183]' to the commit message.
Otherwise looks good.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-01  4:19 ` Noah Goldstein
@ 2023-03-01  9:10   ` caiyinyu
  2023-03-01 16:42     ` Noah Goldstein
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-01  9:10 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: libc-alpha, adhemerval.zanella, hjl.tools, carlos


在 2023/3/1 下午12:19, Noah Goldstein 写道:
> On Tue, Feb 28, 2023 at 9:22 PM caiyinyu <caiyinyu@loongson.cn> wrote:
>> 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
>> ...
>>
>> The function, TUNABLE_CALLBACK (set_hwcaps)
>> (tunable_val_t *valp), checks far more than it should and it
>> should stop at end of "-AVX512".
>> ---
>>   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
>>
> Can you make a bugzilla for this?
bugzilla:

https://sourceware.org/bugzilla/show_bug.cgi?id=30183



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
  2023-03-01  3:22 caiyinyu
@ 2023-03-01  4:19 ` Noah Goldstein
  2023-03-01  9:10   ` caiyinyu
  0 siblings, 1 reply; 16+ messages in thread
From: Noah Goldstein @ 2023-03-01  4:19 UTC (permalink / raw)
  To: caiyinyu; +Cc: libc-alpha, adhemerval.zanella, hjl.tools, carlos

On Tue, Feb 28, 2023 at 9:22 PM caiyinyu <caiyinyu@loongson.cn> wrote:
>
> 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
> ...
>
> The function, TUNABLE_CALLBACK (set_hwcaps)
> (tunable_val_t *valp), checks far more than it should and it
> should stop at end of "-AVX512".
> ---
>  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
>

Can you make a bugzilla for this?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
@ 2023-03-01  3:22 caiyinyu
  2023-03-01  4:19 ` Noah Goldstein
  0 siblings, 1 reply; 16+ messages in thread
From: caiyinyu @ 2023-03-01  3:22 UTC (permalink / raw)
  To: libc-alpha; +Cc: adhemerval.zanella, hjl.tools, carlos, 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
...

The function, TUNABLE_CALLBACK (set_hwcaps)
(tunable_val_t *valp), checks far more than it should and it
should stop at end of "-AVX512".
---
 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] 16+ messages in thread

end of thread, other threads:[~2023-03-09  3:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02  2:33 [PATCH] x86: Fix bug about glibc.cpu.hwcaps caiyinyu
2023-03-02  4:22 ` H.J. Lu
2023-03-07 12:45   ` caiyinyu
2023-03-07 13:02     ` Xi Ruoyao
2023-03-07 13:18       ` caiyinyu
2023-03-07 17:23         ` Noah Goldstein
2023-03-08  7:16           ` caiyinyu
2023-03-08 16:56             ` Noah Goldstein
2023-03-09  1:26               ` caiyinyu
2023-03-09  3:25                 ` Xi Ruoyao
  -- strict thread matches above, loose matches on Subject: below --
2023-03-01  3:22 caiyinyu
2023-03-01  4:19 ` Noah Goldstein
2023-03-01  9:10   ` caiyinyu
2023-03-01 16:42     ` Noah Goldstein
2023-03-01 17:33       ` H.J. Lu
2023-03-02  2:37       ` 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).