From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 653E2385842A for ; Wed, 1 Mar 2023 09:12:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 653E2385842A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.20.4.187]) by gateway (Coremail) with SMTP id _____8AxIMy+Fv9jKcQGAA--.7201S3; Wed, 01 Mar 2023 17:11:26 +0800 (CST) Received: from [10.20.4.187] (unknown [10.20.4.187]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxIL+DFv9jYU1DAA--.18555S3; Wed, 01 Mar 2023 17:10:27 +0800 (CST) Subject: Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps. To: Noah Goldstein Cc: libc-alpha@sourceware.org, adhemerval.zanella@linaro.org, hjl.tools@gmail.com, carlos@redhat.com References: <20230301032238.566874-1-caiyinyu@loongson.cn> From: caiyinyu Message-ID: Date: Wed, 1 Mar 2023 17:10:27 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8AxIL+DFv9jYU1DAA--.18555S3 X-CM-SenderInfo: 5fdl5xhq1xqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7KryDWrW8ury7ZryfGw4fAFb_yoW8WF4rpr yxAa1jkrs0yrW5C3ZFga13K3WrZrWFkF1rArn8C3WDArnFqrZ3Ka1SvF4rua13Ar1fXr1I yF4SgFya9F4UZrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bxAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS 0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1l Ox8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xFo4CEbIxvr21l42 xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWU GwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI4 8JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4U MIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I 8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07jUsqXUUUUU= X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 在 2023/3/1 下午12:19, Noah Goldstein 写道: > On Tue, Feb 28, 2023 at 9:22 PM caiyinyu 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