From patchwork Fri Jul 30 22:38:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 490115 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=-24.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, 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 C567EC432BE for ; Fri, 30 Jul 2021 22:38:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9EB6061042 for ; Fri, 30 Jul 2021 22:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbhG3Wic (ORCPT ); Fri, 30 Jul 2021 18:38:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:59820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbhG3Wib (ORCPT ); Fri, 30 Jul 2021 18:38:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B00660F42; Fri, 30 Jul 2021 22:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627684706; bh=h7U1QIc72tE4CAGhduMNUTNeCMPsFA5JtAr1vUAT8I4=; h=From:To:Cc:Subject:Date:From; b=CBLwAqSqBb7fxSm9K3Ld4ESWOoyItdQ6tjS4JfQTlvIDAfQwugcR9JwqW31Up5r5a cV+iPS6ECYBjGxngiivQDzMpglK/Gt65JqCLWUO1bAXMvZJFkBU/KZaAreVT2bDlpC DTCEGRE0QBcaoaPDRKiQHogWhlHzG5ZSXWcRw3eJUPCzKe5PnCfvD+yWcAIgZgz6ax ux9+ufcDwqt5bk5PryujtVbiby9SXXJ/NS2S2Z0VMq64vwi4u/vfGMqelnhQY9nDua NQTLgVl13KUNrBtT52b8SjJuFyHO3MqCn6CVKhv1LLOeHkbdy7zG79o5IK2q+1z0FO X9TIza7z1MK2w== From: Nathan Chancellor To: Kees Cook , Arnd Bergmann , Nick Desaulniers Cc: Fangrui Song , Marco Elver , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, clang-built-linux@googlegroups.com, Nathan Chancellor , stable@vger.kernel.org Subject: [PATCH] vmlinux.lds.h: Handle clang's module.{c,d}tor sections Date: Fri, 30 Jul 2021 15:38:15 -0700 Message-Id: <20210730223815.1382706-1-nathan@kernel.org> X-Mailer: git-send-email 2.32.0.264.g75ae10bc75 MIME-Version: 1.0 X-Patchwork-Bot: notify Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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' 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 Acked-by: Marco Elver Reviewed-by: Nick Desaulniers --- include/asm-generic/vmlinux.lds.h | 1 + 1 file changed, 1 insertion(+) base-commit: 4669e13cd67f8532be12815ed3d37e775a9bdc16 diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 17325416e2de..3b79b1e76556 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -586,6 +586,7 @@ NOINSTR_TEXT \ *(.text..refcount) \ *(.ref.text) \ + *(.text.asan .text.asan.*) \ TEXT_CFI_JT \ MEM_KEEP(init.text*) \ MEM_KEEP(exit.text*) \