From patchwork Thu Nov 5 18:15:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 11884917 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=-17.7 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,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 8BFFDC55178 for ; Thu, 5 Nov 2020 18:17:20 +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 F298B2087D for ; Thu, 5 Nov 2020 18:17:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nWPdaBsM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="mrsCyjcg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F298B2087D 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=uR2pHaccPn7rcverAbpv5TaYbJwP2F2rOIJshYH7BU8=; b=nWPdaBsMZfyv9+nQ6BqZ6LSG8Z 0W6mG6RyVb7g8OP+h0zH0lQ1XoGqygNGn6CB1XYZetFxCckJB833QZydghS/VCqOQb+CQOWVeRAjR Wg+BLCpzVpzu5/rRmobnlVgyTpKsr4eApXdwIddxOlKXPb5FPstsQzWKLO3RWB0l6s/TM0XO178Rj uwl4niceMI6Gm1B+76I2eJwDa0KY0VNtEJrKJXqdRJANH3NmDoVWtyB6BqAk3vG1OQFEjZ5yAPlTY 2QCMSRr3mH/FJ/WUIRC4PjPkVnXmnKA7Ufu8DQvgTgNeDhtbZAWUWNCM349NVpkxa8WKpTwx6Gtve 55W7Bm6Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kajne-0006Kk-8o; Thu, 05 Nov 2020 18:15:54 +0000 Received: from mail-pj1-x104a.google.com ([2607:f8b0:4864:20::104a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kajnb-0006Jw-03 for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 18:15:52 +0000 Received: by mail-pj1-x104a.google.com with SMTP id lb5so533470pjb.2 for ; Thu, 05 Nov 2020 10:15:47 -0800 (PST) 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=Fulm6bh4vJe0WfYOxJrqTZUhsR1WOBLa0EYYfbd7Xic=; b=mrsCyjcgTIQkO/TeQk81H8g3jj6Ou2PZh29bYCB8dDUunV3rTuAPBSKuXGy2uJCpAR fcZBensd0YwEpu+yhOqh409KS3yYhm/hHXZQvI3udsXVJPdLkkupKQLKFgVYD/fCVKMi Y0nAC6fIuj3Xk+o/rLYR9qsw55r/dhTiPPKtddDXM1ce03gnWfvNvl8f8F7g3dzfHpZ2 6Z96K42xbIsLToUOTdtMAUY/16XOusaNJAy7BA0STuYZqIQT20No5LDxHb9hO63acc/F 1aoLejXtMKXoeim523fprOfEvG7xALyvJjWSq28IgdeWrIOpBOIjmRxghW674mp1/ncF X2yw== 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=Fulm6bh4vJe0WfYOxJrqTZUhsR1WOBLa0EYYfbd7Xic=; b=SF94dmi2Rf4N15UDF7lJPtzzJm1OyUiOsL8XSlHZgABlwH7SGTe15G3h68JXbAdJYe pm9wdnp1psSs+WdlzGaWCW3jX+aCkktLQeCDFiJMi/jLR5Yy0+93OTcvB+NcC9ohgUNj mdXgiolhytT/AWWfcdCCVIPfJvonFOhDhYJhu2yD1VZpTRwRScgzwMjD5kgcnObmSfDy TsruR5DMDcpw39TMd6C5Pvq+XlSa0uvpkkFw6JXl2jdPZuNjI9Gh+eKZeRNUKe7nOSlO i2X5FuS0PkM52AUisn1fY40C2Cx1uM41c4EPn/SlS+E7vc+mocccvA8c+pVbnhO5k1ZN Sx8A== X-Gm-Message-State: AOAM532u6xDDS8OQkVDuRN0MAgTfjudEoozRPaaOzgTu5bEdn9/SSbtU 8//DYRMMGncmzfrEy/Rp918tRr6buAqi X-Google-Smtp-Source: ABdhPJz+HuuJKHBAwsIjouSLfVNBQsk2QKY+xckTtEf8TlVgoz0vJydEBqFmGlV1EofWt73zMOziiQpPCCZW X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) (user=maskray job=sendgmr) by 2002:a17:90a:9b15:: with SMTP id f21mr398825pjp.0.1604600145433; Thu, 05 Nov 2020 10:15:45 -0800 (PST) Date: Thu, 5 Nov 2020 10:15:42 -0800 Message-Id: <20201105181542.854788-1-maskray@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH] ARM: Change arch/arm/lib/mem*.S to use WEAK instead of .weak From: Fangrui Song To: Linus Walleij X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_131551_088726_7D5269C5 X-CRM114-Status: GOOD ( 12.82 ) 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: Florian Fainelli , Fangrui Song , Arnd Bergmann , Abbott Liu , Nick Desaulniers , Russell King , Mike Rapoport , clang-built-linux@googlegroups.com, Andrey Ryabinin , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit d6d51a96c7d6 ("ARM: 9014/2: Replace string mem* functions for KASan") add .weak directives to memcpy/memmove/memset to avoid collision with KASAN interceptors. This does not work with LLVM's integrated assembler (the assembly snippet `.weak memcpy ... .globl memcpy` produces a STB_GLOBAL memcpy while GNU as produces a STB_WEAK memcpy). LLVM 12 (since https://reviews.llvm.org/D90108) will error on such an overridden symbol binding. Use the appropriate WEAK macro instead. Fixes: d6d51a96c7d6 ("ARM: 9014/2: Replace string mem* functions for KASan") Reported-by: Nick Desaulniers Signed-off-by: Fangrui Song Link: https://github.com/ClangBuiltLinux/linux/issues/1190 Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Acked-by: Linus Walleij --- arch/arm/lib/memcpy.S | 3 +-- arch/arm/lib/memmove.S | 3 +-- arch/arm/lib/memset.S | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S index ad4625d16e11..e4caf48c089f 100644 --- a/arch/arm/lib/memcpy.S +++ b/arch/arm/lib/memcpy.S @@ -58,10 +58,9 @@ /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ -.weak memcpy ENTRY(__memcpy) ENTRY(mmiocpy) -ENTRY(memcpy) +WEAK(memcpy) #include "copy_template.S" diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S index fd123ea5a5a4..6fecc12a1f51 100644 --- a/arch/arm/lib/memmove.S +++ b/arch/arm/lib/memmove.S @@ -24,9 +24,8 @@ * occurring in the opposite direction. */ -.weak memmove ENTRY(__memmove) -ENTRY(memmove) +WEAK(memmove) UNWIND( .fnstart ) subs ip, r0, r1 diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S index 0e7ff0423f50..9817cb258c1a 100644 --- a/arch/arm/lib/memset.S +++ b/arch/arm/lib/memset.S @@ -13,10 +13,9 @@ .text .align 5 -.weak memset ENTRY(__memset) ENTRY(mmioset) -ENTRY(memset) +WEAK(memset) UNWIND( .fnstart ) ands r3, r0, #3 @ 1 unaligned? mov ip, r0 @ preserve r0 as return value