Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3201150pxb; Mon, 9 Nov 2020 05:28:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyV2lNO0m1nkBQqOOOdWX1eAXEyr6hUSgoeiiNnKFOr38NGie8Yw0XM6vsnEJkdXzjCP6rB X-Received: by 2002:a17:906:660b:: with SMTP id b11mr15411231ejp.190.1604928492449; Mon, 09 Nov 2020 05:28:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928492; cv=none; d=google.com; s=arc-20160816; b=tA5B1KC11Xvlj7tA9bkbb7vawiTwHX322X+EAQ8eFsYUz+h/jFeGe0wXXem9y9BcLV csmakeZL6fkzcijx2zvMcSkzzw4SgssqH45GB6O3HPw1B6vZerzGvPn6cB8UUEDWzSWi Bym+u/Kl9qbvEm/3oC0OZC9vdgoe0OxlO+H3zT2y3GeBBzLJ24kWSVvmIFzocScsoBRd lYeId1QUjayRSmwbOw/CoNVbE0VeWv+5QuMRiFe9VpYTbuR+KOrSb9Un0CSahRDLJrfE X1zuRn2AvuyDNE69/Y+4A21GpVYCB5kZ/UafmHS2cKjEyJpF2RDzpMuRt5ibpnUlq4xy 9xFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ifeKTTNHORc2IQqP6XllygfqlAxotJRtJmQ5z1byOVY=; b=tF2BYgkky6WeJvHlskmJ/VqMADv6SKMRQDrLAVFyGklWTbH8cuWzX++vr3RaXmS+Ik lY1cLlea7Xi+LYN6Q51xG7FOQDhtgGwNw8fVuLcAw0EYzlDjgWg+om7yp3DFLX1EiwCV /QQSRGpX3LQw9viajJ34Kc5tWZHshMYYsneuHQYijFalxfNbuQH9zO++DtvVD/PwXFQO z5kaYKmOG0AhM+u5rPtf+2xK8N8p1YkIsujOu2IWFflBXe8jcaikYccH5N2k7PmFXHWY TavDZxj5x7aIKR8e3PIH7fa9QY3DjF1w5dXzIfbHNZt/0WWs2rS4XovweVcUubzoS97A dLog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GA0MlbGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si5442739edw.120.2020.11.09.05.27.48; Mon, 09 Nov 2020 05:28:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GA0MlbGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387792AbgKINYe (ORCPT + 99 others); Mon, 9 Nov 2020 08:24:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:46222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732068AbgKINSx (ORCPT ); Mon, 9 Nov 2020 08:18:53 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DFB120731; Mon, 9 Nov 2020 13:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927932; bh=aft4VR6Md1hz15KwZUa5D6V3fCjPDzE7wYrBVYKRdXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GA0MlbGzXq2HA/c2iNn9s9V0bnZsf++4r/obCoxIRiKwi8YHPL8aUJV00MYDY8C1L YD6LxdITEA3m7pwVxScQowirQqEs7+dlxVeUQq/RWjGi+vG8Cvk8vjumQgV67Wbs3v NfsQH1zrDfg0hF+DnBAQXcn/rFRdiAte12mtzmj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , Fangrui Song , Borislav Petkov , Nick Desaulniers , Nathan Chancellor Subject: [PATCH 5.9 071/133] x86/lib: Change .weak to SYM_FUNC_START_WEAK for arch/x86/lib/mem*_64.S Date: Mon, 9 Nov 2020 13:55:33 +0100 Message-Id: <20201109125034.148823655@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fangrui Song commit 4d6ffa27b8e5116c0abb318790fd01d4e12d75e6 upstream. Commit 393f203f5fd5 ("x86_64: kasan: add interceptors for memset/memmove/memcpy functions") added .weak directives to arch/x86/lib/mem*_64.S instead of changing the existing ENTRY macros to WEAK. 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. Commit ef1e03152cb0 ("x86/asm: Make some functions local") changed ENTRY in arch/x86/lib/memcpy_64.S to SYM_FUNC_START_LOCAL, which was ineffective due to the preceding .weak directive. Use the appropriate SYM_FUNC_START_WEAK instead. Fixes: 393f203f5fd5 ("x86_64: kasan: add interceptors for memset/memmove/memcpy functions") Fixes: ef1e03152cb0 ("x86/asm: Make some functions local") Reported-by: Sami Tolvanen Signed-off-by: Fangrui Song Signed-off-by: Borislav Petkov Reviewed-by: Nick Desaulniers Tested-by: Nathan Chancellor Tested-by: Nick Desaulniers Cc: Link: https://lkml.kernel.org/r/20201103012358.168682-1-maskray@google.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/lib/memcpy_64.S | 4 +--- arch/x86/lib/memmove_64.S | 4 +--- arch/x86/lib/memset_64.S | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) --- a/arch/x86/lib/memcpy_64.S +++ b/arch/x86/lib/memcpy_64.S @@ -16,8 +16,6 @@ * to a jmp to memcpy_erms which does the REP; MOVSB mem copy. */ -.weak memcpy - /* * memcpy - Copy a memory block. * @@ -30,7 +28,7 @@ * rax original destination */ SYM_FUNC_START_ALIAS(__memcpy) -SYM_FUNC_START_LOCAL(memcpy) +SYM_FUNC_START_WEAK(memcpy) ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \ "jmp memcpy_erms", X86_FEATURE_ERMS --- a/arch/x86/lib/memmove_64.S +++ b/arch/x86/lib/memmove_64.S @@ -24,9 +24,7 @@ * Output: * rax: dest */ -.weak memmove - -SYM_FUNC_START_ALIAS(memmove) +SYM_FUNC_START_WEAK(memmove) SYM_FUNC_START(__memmove) mov %rdi, %rax --- a/arch/x86/lib/memset_64.S +++ b/arch/x86/lib/memset_64.S @@ -6,8 +6,6 @@ #include #include -.weak memset - /* * ISO C memset - set a memory block to a byte value. This function uses fast * string to get better performance than the original function. The code is @@ -19,7 +17,7 @@ * * rax original destination */ -SYM_FUNC_START_ALIAS(memset) +SYM_FUNC_START_WEAK(memset) SYM_FUNC_START(__memset) /* * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended