Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1793018pxk; Tue, 1 Sep 2020 07:58:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx73DetTARsXvDkD5gpq1oSkvUWgXMzvwMPN/mUTzHg5zxX5jiUz411kEP9Iz6L3F1e2rhu X-Received: by 2002:aa7:d85a:: with SMTP id f26mr2034695eds.363.1598972332247; Tue, 01 Sep 2020 07:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972332; cv=none; d=google.com; s=arc-20160816; b=Of41iB83GBrc+xAyZAhq51GWkl68nGn01VqQmstltoKvpfWt1xwgNwgfn5zjzhAwx2 DdgUuDfAJEx0u3DwGMH6C6rN9zk4a5TQDk7NgLL4PSqI91XgvQUG0kR5uYrHgZ7vZ/ME A/ww8UUP7qwBaC3GJER4rjp9mUvM/mWEiHFdj3huuM/jyhAUbj1QJ/A2ybCltk85JTqs E1Y3u/gpUrLpThhqDSzoIFqQz0gMYWag3Q07f2R2LQORD6KHSGEmL0+8KeAR2hFXykiI BtZtrqJ+XOWy0TCI3PoHn3oJB8zMEbJrcvkNf7NGaFroeGxiIq7jt3SKGja7O8E3X4sv tGvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=4pUta5Zk4FfoDx/NGPIBXT5qYhHCXO0PxXNn6+h/JFg=; b=Z2K7tFALn+CXkP4JGjrrErGvBnhEB36yApARDLmXu9ELK1W1+FhbUJt0Ge2T0ZUk2X tIq5SR58jGgbMsgtz/jhl9FlFBz3kWcCELqNiaxcEpZYJN9+fezvS0a4GA0yjBLe4b8g RwFXWZQPmPpV2M1EaOvm09hssq/yczunOuypMdGHg27M5R1V78sKv1FKKq1cZosqV/rb /INzbw++nWAStDDG3asfuaGnSXPG3aD/PVVUM7+L4rezM6RTZpOgbQ5BL4YVstXZeSen BF58i2d7Uoowlh68B7JSKvHxotIrbGuDYdIshfeDWjS7tCmj2ysiu6z6QjwIftrXcdos EEng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=NhtVVS7i; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IXxC7ghc; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e15si718762eja.467.2020.09.01.07.58.29; Tue, 01 Sep 2020 07:58:52 -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=fail header.i=@linutronix.de header.s=2020 header.b=NhtVVS7i; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IXxC7ghc; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbgIAOzg (ORCPT + 99 others); Tue, 1 Sep 2020 10:55:36 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39608 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727839AbgIALs1 (ORCPT ); Tue, 1 Sep 2020 07:48:27 -0400 Date: Tue, 01 Sep 2020 11:48:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598960881; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4pUta5Zk4FfoDx/NGPIBXT5qYhHCXO0PxXNn6+h/JFg=; b=NhtVVS7iynWFb+nPXvI/P9XVnUKRnH1SZA+UFbA6fs2TjAuTnphLpRyl3I0/GX9NsY8pVr 5FqW0bh96K4hASmqf/k1PL7HVPw8YmtZk7wAvNW/k6IhPuxuSk+8dtAzCupkpmfauJbZbS rTg+bY5IRqI/MqYAA0gtQZJ+gg3QDCAwRDT7xjcr7WobqDC5H7SIKHHbzZuOwREc4W4naf XnoQioAJNDWCrN7+aBW89aXcpYy51QBbxdbSf1SeRGTm5+CfXX6acD6M6Rg1vOSdaRXBxB 2A0ew7MD1vF5Szfcb6njqGnG7nwr89IvTDjgHn68tpwDzZFxkIWR9q3nfDFFFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598960881; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4pUta5Zk4FfoDx/NGPIBXT5qYhHCXO0PxXNn6+h/JFg=; b=IXxC7ghcoXOMkFsdiVCLXuv302cyIZ84U2uCR/fMI4ssPXTwPX7MTp3aLkHB4PK8kgWarx uxdASpMgK3ApyPCg== From: "tip-bot2 for Kees Cook" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/build] vmlinux.lds.h: Avoid KASAN and KCSAN's unwanted sections Cc: Kees Cook , Ingo Molnar , Marco Elver , linux-arch@vger.kernel.org, x86 , LKML In-Reply-To: <20200821194310.3089815-4-keescook@chromium.org> References: <20200821194310.3089815-4-keescook@chromium.org> MIME-Version: 1.0 Message-ID: <159896088072.20229.9345391960421718006.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/build branch of tip: Commit-ID: d812db78288d76d1e8c6df3a840c41a8875f6468 Gitweb: https://git.kernel.org/tip/d812db78288d76d1e8c6df3a840c41a8875f6468 Author: Kees Cook AuthorDate: Fri, 21 Aug 2020 12:42:44 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 01 Sep 2020 09:50:35 +02:00 vmlinux.lds.h: Avoid KASAN and KCSAN's unwanted sections KASAN (-fsanitize=kernel-address) and KCSAN (-fsanitize=thread) produce unwanted[1] .eh_frame and .init_array.* sections. Add them to COMMON_DISCARDS, except with CONFIG_CONSTRUCTORS, which wants to keep .init_array.* sections. [1] https://bugs.llvm.org/show_bug.cgi?id=46478 Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Tested-by: Marco Elver Cc: linux-arch@vger.kernel.org Link: https://lore.kernel.org/r/20200821194310.3089815-4-keescook@chromium.org --- include/asm-generic/vmlinux.lds.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index f1f02a2..6b89a03 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -954,7 +954,27 @@ EXIT_DATA #endif +/* + * Clang's -fsanitize=kernel-address and -fsanitize=thread produce + * unwanted sections (.eh_frame and .init_array.*), but + * CONFIG_CONSTRUCTORS wants to keep any .init_array.* sections. + * https://bugs.llvm.org/show_bug.cgi?id=46478 + */ +#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN) +# ifdef CONFIG_CONSTRUCTORS +# define SANITIZER_DISCARDS \ + *(.eh_frame) +# else +# define SANITIZER_DISCARDS \ + *(.init_array) *(.init_array.*) \ + *(.eh_frame) +# endif +#else +# define SANITIZER_DISCARDS +#endif + #define COMMON_DISCARDS \ + SANITIZER_DISCARDS \ *(.discard) \ *(.discard.*) \ *(.modinfo) \