From patchwork Thu Oct 29 18:19:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 11867099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0277AC4363A for ; Thu, 29 Oct 2020 18:20:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C7D6206B2 for ; Thu, 29 Oct 2020 18:20:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sgbDkG3Z"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="OIWq7obb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C7D6206B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=k0jy5liusHfO4IYkyMiKYmHLtBsgbl26oiyuDxdVwDY=; b=sgbDkG3Zo4keugtmz+J9X8+X7y qThZlVr26cQ+zQFVjp9AaUKJB1nwqdgkIDYeeTGHyl9ai76IxIU0HGvXKn53ELwJUDfAZKDH8K7p4 YzJQv2+kffZIQ/XJDerR+fXEGvjMAHNKF7Vwi40GIbinrwvErv20gH2a5DGP/bbsViXhaNj5+ao4E IulFb9qDPwo1aK+r/yXbaYOza7NYca6+py+9WtSOOE9vmyFWu7olP79R/ZT9ZGzdCeXtZKOJotfck yhHH6bMcqnbpvbfJEN0mn81iEYFe+rB/orrwNRrLVnmr8T/VXxz8EdcIug8Fp1E37NDmgEaL54KGt hnA3noHg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYCWr-0006Oy-Ad; Thu, 29 Oct 2020 18:20:05 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYCWo-0006OL-Mz for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2020 18:20:03 +0000 Received: by mail-pl1-x64a.google.com with SMTP id k6so2574563pls.22 for ; Thu, 29 Oct 2020 11:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=T3ma1Qme9sfSgFfmbVfimMuKf/8KN6t34PwJQ/OLZR4=; b=OIWq7obbwyuqQ56Q/ZI10sLGTFAImJtCMsZ7CpBcrSt+wQ/BHm0LUfEIQYS71gEO5+ jr79EQdkIpfCxwZ0cYNzI3dcgFGoqfxqUyiFrLcGCW0hRGgaOfYUQ+IiU6ykOAfSglvu Z85Xev19pHYr7LJLAPjLmva5sl9zQN57K5VWB3+RxoZk/ukyaOzdXd/ysY0GYmyn0jJE /NM6qtGEUhT08T0M6XPmWDsXvZFv07X+kSbvl3B0PMuJTh7shC9gXsV9k9EE2wOaSSrq t6C3HBwggrixBsgop1oOUZa9zv6QN/9TJiigjMOGoj6RVwsk5LjAZpJ5GZiGacrjdVLg Q5LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=T3ma1Qme9sfSgFfmbVfimMuKf/8KN6t34PwJQ/OLZR4=; b=Po2WfMiaPznzpKUY49QJcvPDBnAxfpkxNWqwlpWkwQuO3VqFNGd4Ys7HzDC7ot5Ndv J63uEEBl6UM6+HdnXN+9x5Grwahk8QTIJYtKenYoNpFp/+HffvFFcCMs1eaiwBip4bg2 Z6UZundFLN4Ag3ovQlhpTjnOHzYVmQtotEN9oZA7sInjCxv5KOKIaoY+QaHirnTxvy30 0nG/NA25AQ9gCJg6ayzefXEZkhT+G74XnKSQnB2JmhQBCujwAqcsRcdxZgErQkVDfc1D plhXq+ICPuJeiNiSgeUe/ypNmcEpm6LRdGYkUrTk1NvOYc7Y4CmkMeMCzcTRMH/YHp5U 3zUw== X-Gm-Message-State: AOAM531AN7x32N10ejStkRfkGsVode3dEZFmAciweEzyaXCHHVmv879B 8xmDnZShp/Ty+INMZS54fcL8fNn5MPF+FZwwdCAEkqr9PWdzZdxqVmpBBIRZQlDuChJvKSG4CG4 EHnpD4MakqWNecsaEvBDMdw19s5aMryGYKlWQBb8A7mBdqo7nIuLlqAuhXYd6k1N34nFEltSwzd bPlKB66Z4= X-Google-Smtp-Source: ABdhPJzbAxBUbWQjfF7B64iuL8b029PkHCk4plKT0cU6RIT583VAuy0/ZqhIswqU+5r5rHqPot5HAspJ3VBR X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) (user=maskray job=sendgmr) by 2002:a62:1d10:0:b029:163:deb3:5df2 with SMTP id d16-20020a621d100000b0290163deb35df2mr5349788pfd.68.1603995598076; Thu, 29 Oct 2020 11:19:58 -0700 (PDT) Date: Thu, 29 Oct 2020 11:19:51 -0700 Message-Id: <20201029181951.1866093-1-maskray@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH] arm64: Change .weak to SYM_FUNC_START_WEAK_PI for arch/arm64/lib/mem*.S From: Fangrui Song To: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201029_142002_790901_FAD174D8 X-CRM114-Status: GOOD ( 10.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: clang-built-linux@googlegroups.com, stable@vger.kernel.org, Sami Tolvanen , Fangrui Song , Jian Cai Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 39d114ddc682 ("arm64: add KASAN support") added .weak directives to arch/arm64/lib/mem*.S instead of changing the existing SYM_FUNC_START_PI macros. This can lead to the assembly snippet `.weak memcpy ... .globl memcpy` which will produce a STB_WEAK memcpy with GNU as but STB_GLOBAL memcpy with LLVM's integrated assembler before LLVM 12. LLVM 12 (since https://reviews.llvm.org/D90108) will error on such an overridden symbol binding. Use the appropriate SYM_FUNC_START_WEAK_PI instead. Fixes: 39d114ddc682 ("arm64: add KASAN support") Reported-by: Sami Tolvanen Signed-off-by: Fangrui Song Cc: Tested-by: Sami Tolvanen Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers --- arch/arm64/lib/memcpy.S | 3 +-- arch/arm64/lib/memmove.S | 3 +-- arch/arm64/lib/memset.S | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S index e0bf83d556f2..dc8d2a216a6e 100644 --- a/arch/arm64/lib/memcpy.S +++ b/arch/arm64/lib/memcpy.S @@ -56,9 +56,8 @@ stp \reg1, \reg2, [\ptr], \val .endm - .weak memcpy SYM_FUNC_START_ALIAS(__memcpy) -SYM_FUNC_START_PI(memcpy) +SYM_FUNC_START_WEAK_PI(memcpy) #include "copy_template.S" ret SYM_FUNC_END_PI(memcpy) diff --git a/arch/arm64/lib/memmove.S b/arch/arm64/lib/memmove.S index 02cda2e33bde..1035dce4bdaf 100644 --- a/arch/arm64/lib/memmove.S +++ b/arch/arm64/lib/memmove.S @@ -45,9 +45,8 @@ C_h .req x12 D_l .req x13 D_h .req x14 - .weak memmove SYM_FUNC_START_ALIAS(__memmove) -SYM_FUNC_START_PI(memmove) +SYM_FUNC_START_WEAK_PI(memmove) cmp dstin, src b.lo __memcpy add tmp1, src, count diff --git a/arch/arm64/lib/memset.S b/arch/arm64/lib/memset.S index 77c3c7ba0084..a9c1c9a01ea9 100644 --- a/arch/arm64/lib/memset.S +++ b/arch/arm64/lib/memset.S @@ -42,9 +42,8 @@ dst .req x8 tmp3w .req w9 tmp3 .req x9 - .weak memset SYM_FUNC_START_ALIAS(__memset) -SYM_FUNC_START_PI(memset) +SYM_FUNC_START_WEAK_PI(memset) mov dst, dstin /* Preserve return value. */ and A_lw, val, #255 orr A_lw, A_lw, A_lw, lsl #8