Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2917522pxb; Tue, 24 Aug 2021 10:33:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2Xr8ogvMA+aBaMOX189HTcVQvslztNkPbizmfptaOK5fpHwVcQaRa7CsU1UHTJRHcPoWd X-Received: by 2002:a05:6402:1cb9:: with SMTP id cz25mr17638850edb.11.1629826390667; Tue, 24 Aug 2021 10:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826390; cv=none; d=google.com; s=arc-20160816; b=PXfcjR2QzX2kN0W//WjCNDJjMDEZ00R9h4sTFlGSZH90h3A9y5g9bYrLqzBcleqBq0 iuDhK6lEhWKoRnegK8ZT15orT+bs3AUe2wzLH1AzE23Z+p33Uu/xWbWTll1GM0alP8rD rVfyL8t8rNwAC+WnkGqluSwm9Dvhi7nmp+3GUpqSkrbYB9bn6MguEvoRDs+T2GBaooYL To558eTGxW6TNjcPcWKJSNiqW+JVXdk/Q84krP4cfmLG/xdxUKAnbkvUhrYWidbw9hfU 3ikAjsP00UZbSeEK5+ALdMy6mRKr0iB7keszn9HWOh2NqTm4xVGMaGzCe/tUgwFyJMv6 BXdA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ew7+XHiuwmPKiWL7K3mWopFzbrs/lnaC8zT9h+nL+cg=; b=PVs0ACwA6dGEAuHXuu/09K0J6quDGKDRaluoKebVFzaL/+ovF3PRLPPhRFb5u1Ce/b nokTw7aCOgE5i8gQvnHXsYR+M2TojzcG4b/og56EcZsNnVUUDqk2ZBr1vCgC5GQDQX+H OCYPsjyJIc/7/1iWXq4G8KuFH+f9g3pIJKswMJrPBLdUoC1m43UIMi+5lpMV10jGCL7s 1ZZES1aVGo2pg9Nxd1U/83Q5wt3iO/2XVK9R+F6LlrzIAMrw5Ers05uaYAsKPJUm+dUM crIvnKjrXJehI5hDtWnS05Y5XeMIi5bkXem5ygBXc1mi7tL7ldweqor4CU+yWLD8kdj8 a2uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Je8xPFdd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf22si17443249edb.311.2021.08.24.10.32.47; Tue, 24 Aug 2021 10:33:10 -0700 (PDT) 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=k20201202 header.b=Je8xPFdd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241633AbhHXRbp (ORCPT + 99 others); Tue, 24 Aug 2021 13:31:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:35846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241074AbhHXR3E (ORCPT ); Tue, 24 Aug 2021 13:29:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E83361B5F; Tue, 24 Aug 2021 17:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824727; bh=oQF46W8ELvGiGS4EY5krkIykNoMUeMOnVH1Ocyu/Nl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Je8xPFdd5+xQ03iuUP9H+PFGBEDa3K5kJxeF7FtSGQJMQlHl191jKnhc4PqL599K5 lK1xU93v/oFNCJIh8MaOQNxc/Za6HlxHDGz/iav569QBYKlRAx17Y5d+CTOQjtePF7 GKBYOtb8hnSfPVyBKxm5owVDZvjxxkALz5+Gkqj5F53MKwFfFh2xC1o7uoiUJdfcKW Ck+godB3PsrJRGAkNfwvkHSzmqXCun0rGwQG0qT/aDXauQwqtcNUuLpHTDqKCba0B8 HiV5NsgHp4ID8NWttTawRRls10rCn6CQ8V8f6PFntJjqzbihO8ENw/3vQlM5AjiBF8 SUN8XJ4Z3qGbg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Nick Desaulniers , Fangrui Song , Marco Elver , Kees Cook , Greg Kroah-Hartman Subject: [PATCH 4.14 29/64] vmlinux.lds.h: Handle clang's module.{c,d}tor sections Date: Tue, 24 Aug 2021 13:04:22 -0400 Message-Id: <20210824170457.710623-30-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170457.710623-1-sashal@kernel.org> References: <20210824170457.710623-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.245-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.245-rc1 X-KernelTest-Deadline: 2021-08-26T17:04+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor commit 848378812e40152abe9b9baf58ce2004f76fb988 upstream. A recent change in LLVM causes module_{c,d}tor sections to appear when CONFIG_K{A,C}SAN are enabled, which results in orphan section warnings because these are not handled anywhere: ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.asan.module_ctor) is being placed in '.text.asan.module_ctor' ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.asan.module_dtor) is being placed in '.text.asan.module_dtor' ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.tsan.module_ctor) is being placed in '.text.tsan.module_ctor' Fangrui explains: "the function asan.module_ctor has the SHF_GNU_RETAIN flag, so it is in a separate section even with -fno-function-sections (default)". Place them in the TEXT_TEXT section so that these technologies continue to work with the newer compiler versions. All of the KASAN and KCSAN KUnit tests continue to pass after this change. Cc: stable@vger.kernel.org Link: https://github.com/ClangBuiltLinux/linux/issues/1432 Link: https://github.com/llvm/llvm-project/commit/7b789562244ee941b7bf2cefeb3fc08a59a01865 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Reviewed-by: Fangrui Song Acked-by: Marco Elver Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20210731023107.1932981-1-nathan@kernel.org [nc: Fix conflicts due to lack of cf68fffb66d60 and 266ff2a8f51f0] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- include/asm-generic/vmlinux.lds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index c9790b2cdf34..45fe7295051f 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -465,6 +465,7 @@ *(.text.unknown .text.unknown.*) \ *(.text..refcount) \ *(.ref.text) \ + *(.text.asan.* .text.tsan.*) \ MEM_KEEP(init.text) \ MEM_KEEP(exit.text) \ -- 2.30.2