Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2550985rwb; Fri, 16 Dec 2022 03:44:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4MjInXO+fx+5XLcq+neQF9Dk9W8k49i16YK9r3KHb4IDK8N0nPx/QWWADx9vBG+UJwYzHj X-Received: by 2002:a17:906:37ce:b0:7c1:41bb:70ac with SMTP id o14-20020a17090637ce00b007c141bb70acmr21644966ejc.64.1671191054155; Fri, 16 Dec 2022 03:44:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671191054; cv=none; d=google.com; s=arc-20160816; b=N1rBe/waEdNX10J2GZ8UszCGt6IjekkIBsvKP+ebaW/5+VhzZyt/p0p1CbsX1L7Svk U/BMp0k6PyRsmucQK30eaKICWl66Mc15F5sZYqSYxMsNrFT7Vg3ep9x60Lii5NqZHV27 hCmWNUtsm9N7IkHGwLfaVPYbpQAZBoy5oGUnwxNhZFGFO3dgx388v99wSgHTeXAGJ+/B 94Bb/F/GtXdzHgZPJYMad1De/aIlMX2eaDwN7AR/YpihABlOZflFnqWUEHrWBhSPM0yX Eugr7KH59X1Dv0VuqH3/RYt7RYcLHFSA6TirPC9makT0Oa3Q58WBxiFUfogFQWfa8mFk p50w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=TzrUH7iwuUSX6PwM6HU3Wedvc2zhG9CBP5wecSYIZ70=; b=PklW/fzTwOdCiaS3izlE/+0DXEacpRdrW8sunZpnZicHkGV9dYBnRgk3Awwr7wOl04 6RlCmaZprWDRIOUqk5zsTR/Ck1cRNLLt3KYnn0bv68x9/TywbCaNAUZ7SaN9v4NQe490 3D9GwQYrHQS05TlMBrd+p0BEBObLYKpST+jCOIGlMUBVXQ6STDd6cvRA/72dyK2tfXeK jGH3MzKQFEIjzZIlh0nH2UjMXwrfWXixQA+Uzn1K7IxVlMFH/F/lqE1VOoPgW3dR7Rwe KEUuzQQffquduc10fOfIkuBrvH6JYyxBJuLH5zutQUUcrld0g04wjVz+KaCi9cvYjxaa w5qQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020a1709065fc800b007c0870b3739si1701583ejv.938.2022.12.16.03.43.57; Fri, 16 Dec 2022 03:44:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbiLPLlF (ORCPT + 68 others); Fri, 16 Dec 2022 06:41:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbiLPLlA (ORCPT ); Fri, 16 Dec 2022 06:41:00 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 951A41658C; Fri, 16 Dec 2022 03:40:57 -0800 (PST) Received: from dggpemm500006.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NYRwT59tyzmWjQ; Fri, 16 Dec 2022 19:39:53 +0800 (CST) Received: from [10.174.178.55] (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 16 Dec 2022 19:40:54 +0800 Subject: Re: [PATCH v9] kallsyms: Add self-test facility To: David Laight , 'Geert Uytterhoeven' CC: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , "live-patching@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , Luis Chamberlain , "linux-modules@vger.kernel.org" , Steven Rostedt , Ingo Molnar , linux-m68k , "Jason A. Donenfeld" References: <20221115083349.1662-1-thunder.leizhen@huawei.com> From: "Leizhen (ThunderTown)" Message-ID: <75b4f3be-1e79-5602-5774-aa1fab3f07ce@huawei.com> Date: Fri, 16 Dec 2022 19:40:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/12/16 18:40, David Laight wrote: > From: Geert Uytterhoeven >> Sent: 15 December 2022 13:25 > ... >> Looks like commit 3bc753c06dd02a35 ("kbuild: treat char as always >> unsigned") is to blame. >> >> Changing: >> >> --- a/arch/m68k/include/asm/string.h >> +++ b/arch/m68k/include/asm/string.h >> @@ -42,7 +42,7 @@ static inline char *strncpy(char *dest, const >> char *src, size_t n) >> #define __HAVE_ARCH_STRCMP >> static inline int strcmp(const char *cs, const char *ct) >> { >> - char res; >> + signed char res; >> >> asm ("\n" >> "1: move.b (%0)+,%2\n" /* get *cs */ >> >> fixes strcmp, but the test still fails: > > Try 'int res;' and an explicit sign extend (I think): > "3: extb %2\n" Compilation failed. I tried "return (int)(signed char)res;", it's still failed. > > The strcmp() is still wrong if either input string > has characters with the top bit set. > The result needs to be based of the carry flag not > the sign of the byte subtract. > > It is too long since I've written m68k asm. > I've checked, all byte operations leave the high 24bits > unchanged. Currently, only ASCCIs. So it won't be the reason. > So it is possible that gcc is making assumptions and > skipping the sign extend under some circumstances. Wow, because compare_symbol_name() works properly during the previous binary search, the compiler must have done something bad. So I add 'volatile' to prevent compiler optimizations, and it's OK now. diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h index f759d944c449940..3db81e5a783c72a 100644 --- a/arch/m68k/include/asm/string.h +++ b/arch/m68k/include/asm/string.h @@ -42,9 +42,9 @@ static inline char *strncpy(char *dest, const char *src, size_t n) #define __HAVE_ARCH_STRCMP static inline int strcmp(const char *cs, const char *ct) { - char res; + signed char res; - asm ("\n" + asm volatile ("\n" "1: move.b (%0)+,%2\n" /* get *cs */ " cmp.b (%1)+,%2\n" /* compare a byte */ " jne 2f\n" /* not equal, break out */ > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) > -- Regards, Zhen Lei