From patchwork Fri Mar 31 09:15:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 77676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp436688vqo; Fri, 31 Mar 2023 02:42:38 -0700 (PDT) X-Google-Smtp-Source: AKy350YpWLyK4tt6Tsd5qzRhHCfBvAsDtPfghM36G/sZj+p3+ZwM3k3jfTpCHHiJq9+iS2cG1ez2 X-Received: by 2002:a05:6402:2788:b0:500:2cc6:36d5 with SMTP id b8-20020a056402278800b005002cc636d5mr9008614ede.8.1680255758189; Fri, 31 Mar 2023 02:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680255758; cv=none; d=google.com; s=arc-20160816; b=dcoTrZGwKsNragdQPrwO8iMFLGELXV/FABVm9J/kv6cDUQjPwVbastT6TaMkyJzXLE U+Yvtmvn+0cy48YSgOWVJ1DRk2KWjXiaDpi5Ud+c4KTGbdFAJ3rzITwoLvsD+5BJ5bqo hzVxE3J5J1r64TYrwjYuzS4tnyLMFBo3Gy+jNSOpzt56fRZ0KQiPQHhWP5/BclvRSvBj K8cMwSwEWwgQKz+OF0uWhkAo22pnaODonTHM5VRVj4KlIp++L/IIuEQZbIL2UdkzaUMC rFdvWNttLBpY6XpFchHPxDfEGXr2I6X6AWttBkz1/FV0s1uMswQrBQqggi0MUrg8bYfQ GJGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=5G5k7U3Kz7t2029veOnxBC6PVEl4xZjLFeVzGs5ZXt4=; b=pEuWI7rHzoI6kgZtEP4162NCsAoByZSOaiCZe0BFkv0+ouWF+42rdmU8aPdOGeAWER 7ify7VveN+9LPHMRHnx0Gctd9qiD9t4uELffSMrKjb2gjiV7+HCod6ETW+amq2tRUTIZ rEcEJH0BIml1lyP2Bwq5vmDQo4PrAnRjn+I2Kyb3BC42Kk1OA7Bc1lZxH5xGnd+ja8At wxBa5ImDZVSBFVVmNA2s6AxEqlc62/HwRO9u1rDO2kpURRyCS7KqijyDzMqNs6eDsULR Y69dQyKCakFXIqykFa93cpAWCjFm85L9P/R4X7S/VQ0jObireFsb6+w4UeVVGYNegcA0 YZ1A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020aa7dada000000b004af7e6911b7si1346788eds.91.2023.03.31.02.42.15; Fri, 31 Mar 2023 02:42:38 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231384AbjCaJQd (ORCPT + 99 others); Fri, 31 Mar 2023 05:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231255AbjCaJQO (ORCPT ); Fri, 31 Mar 2023 05:16:14 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 31B249754; Fri, 31 Mar 2023 02:16:03 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8BxONnSpCZkvOQUAA--.32103S3; Fri, 31 Mar 2023 17:16:02 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxC77OpCZkVfMRAA--.14538S3; Fri, 31 Mar 2023 17:16:01 +0800 (CST) From: Tiezhu Yang To: Luis Chamberlain Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH 1/3] module: Sync code of is_arm_mapping_symbol() Date: Fri, 31 Mar 2023 17:15:51 +0800 Message-Id: <1680254153-14582-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1680254153-14582-1-git-send-email-yangtiezhu@loongson.cn> References: <1680254153-14582-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8DxC77OpCZkVfMRAA--.14538S3 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7WF1ktFy3GFWftrWDKF45KFg_yoW8WF4Upr 1DG3y5Gw4Fyr1DGayfWF1kWryUua4vqw4kA3sxKryfZFnxXFW0qr47t3W3uw1IvFy5GFsY gr1rAa45Aa4fCF7anT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS 0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1l Ox8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC20s 026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_ JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JV W8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8P5r7UUUUU== X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761875861902201882?= X-GMAIL-MSGID: =?utf-8?q?1761875861902201882?= After commit 2e3a10a1551d ("ARM: avoid ARM binutils leaking ELF local symbols") and commit d6b732666a1b ("modpost: fix undefined behavior of is_arm_mapping_symbol()"), many differences of is_arm_mapping_symbol() exist in kernel/module/kallsyms.c and scripts/mod/modpost.c, just sync the code to keep consistent. Signed-off-by: Tiezhu Yang --- kernel/module/kallsyms.c | 5 +++-- scripts/mod/modpost.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c index 3320586..a9045fe 100644 --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -251,8 +251,9 @@ static inline int is_arm_mapping_symbol(const char *str) { if (str[0] == '.' && str[1] == 'L') return true; - return str[0] == '$' && strchr("axtd", str[1]) && - (str[2] == '\0' || str[2] == '.'); + return str[0] == '$' && + (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') + && (str[2] == '\0' || str[2] == '.'); } static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index efff807..79a27cc 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1114,6 +1114,8 @@ static int secref_whitelist(const struct sectioncheck *mismatch, static inline int is_arm_mapping_symbol(const char *str) { + if (str[0] == '.' && str[1] == 'L') + return true; return str[0] == '$' && (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') && (str[2] == '\0' || str[2] == '.');