From patchwork Fri Aug 21 19:42:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA7C9618 for ; Fri, 21 Aug 2020 19:46:26 +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 A54242072D for ; Fri, 21 Aug 2020 19:46:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kEvJOqKO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="i/HEp8a1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A54242072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v0HyhcCW0YjFovL3PrzZYtmtlTc2FFQ/psykID48Fs0=; b=kEvJOqKOoRsggpzin54GmAxal omI3rbFIEoe3K0mDMdOS1xzfNvNHj2BnlSM7wE9164tVhd5xwYEbMegoqNSGMcdyjy2ydJu2Lhu0b Ub6pxNfWOuDATmPbrUCpj4cIhsqCKgk2oWWcyPdO2jVSZwkrUi+yupUZ4uWCQnhbtXdmfhl5J1plw /xPtW4hMCMQeSoyX1nS6QD9bnZpwEU6iEzqVrxzak7WI4iGnzRZhHYpIEqnwe56UnY5S2L6qcKOoD jukPK+wIWLcaDXoa4zs13fYtev9R6a9GdQ0daEWqvLPNVEw0v5tSqEpjfmRiWm8KWDfiMMXsBsWla 6eu1RohDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxi-0006Xv-0D; Fri, 21 Aug 2020 19:44:30 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxc-0006T3-51 for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:27 +0000 Received: by mail-pj1-x1043.google.com with SMTP id ds1so1261307pjb.1 for ; Fri, 21 Aug 2020 12:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7KJKUmMIwELFiu+Jhx3PR/flYgx4mAaM57h538oQIMM=; b=i/HEp8a1E4h+pDbbs57HZpbPpxh1OsfRH2Yd/8W3bgSphxcIhvxHJMoOUFbJ6b/Lo5 9aJS4qOv+ZRLhprPhhQyVLMufErKaJZg4b7i1PWzbmYDeM8hm39fYJLK/IT+cxpFTdWz TuXn2CWgQSDT0wuxFJZoOlwQ2qTgwxpZ9CNOg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7KJKUmMIwELFiu+Jhx3PR/flYgx4mAaM57h538oQIMM=; b=cx7466vg29UstLFjhWKiQYcN9az2VQy4zGKSX9rhDRCRrG0fR4tNE0/+3q9tDdaOdO hLEVEHqIBTYReVcqfmwdotcNFfSaGwjEeeMxfHe1BWEbx07sY/cdIpYBn1m10wEixAGX PJZGPWe99cfTkjFu3VvfBtNqyu41rqWSq6sr7wPTFblITPGub0e9t2LZF+UScV528oGF TA1hUchL4LO7CqexuYeWJte4eA0sj0UZN6c/fzUo1S7ElPI7buYbcIF8ghZ+TsMc82Xk UxzW2BKyQWQU+GtmJsf9MkI3DIQonyumOPx42RWfjMzid5By3IStkqe008U7FWF4pmKV qR/w== X-Gm-Message-State: AOAM530zq01h/fHGr/IdAvu+unQKya62Rgk8kqHLsbWJiFmk3iEPAhh4 54P+eQfgb0KyApOnGiJatCD1Ig== X-Google-Smtp-Source: ABdhPJxhYfHQFi07yXAb+83c2N6Go68l40rd8GM9whIQP8616kjUIICp3ghwUq5gOnKTYPsXxrBOoA== X-Received: by 2002:a17:90a:4f45:: with SMTP id w5mr3754850pjl.11.1598039062148; Fri, 21 Aug 2020 12:44:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b9sm3354866pft.98.2020.08.21.12.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:21 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 01/29] vmlinux.lds.h: Create COMMON_DISCARDS Date: Fri, 21 Aug 2020 12:42:42 -0700 Message-Id: <20200821194310.3089815-2-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154424_237714_5C5B6E57 X-CRM114-Status: GOOD ( 14.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1043 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Collect the common DISCARD sections for architectures that need more specialized discard control than what the standard DISCARDS section provides. Signed-off-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 7616ff0b96ec..184b23d62784 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -954,13 +954,16 @@ EXIT_DATA #endif +#define COMMON_DISCARDS \ + *(.discard) \ + *(.discard.*) \ + *(.modinfo) + #define DISCARDS \ /DISCARD/ : { \ EXIT_DISCARDS \ EXIT_CALL \ - *(.discard) \ - *(.discard.*) \ - *(.modinfo) \ + COMMON_DISCARDS \ } /** From patchwork Fri Aug 21 19:42:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730373 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C52F13B1 for ; Fri, 21 Aug 2020 19:44:56 +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 E9D552076E for ; Fri, 21 Aug 2020 19:44:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zOdWG4cu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mPcfZIGu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9D552076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SfS33aJDhCJgkTSXUPkHruFqqib9eq9it1R/z01H5uI=; b=zOdWG4cuA4kHJyOCygNJ8fUKo 015L017tcoOs1mB8lNy3fPW3B0xEIoVNDjDl//hpSvHd7Vvzqy1o7nU/G3GoABov3+mVK6FUbFa2C Y84D0p+SkYL6XxCOdHT6vnG5broQvS52yoBrZCF/b2f23iIKV/yzzsuPqC0KRiRulDzu9Aj58Dggw lQVQhuM9tPseIkOs+ja/FYuAYxzClSz4SVNUEm0eqdgz0xanaMTUS7AfFJnD+IKaJAfnTboBbGzIk A7wY/tzuBG1OFpDNAy0nYk6xN9TBYRSiYpBicTOXyTd2GJxatsdYdkB0suvuaHMsd6+eef8qVfe7w 9oTWIfTpw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxx-0006ep-4b; Fri, 21 Aug 2020 19:44:45 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxd-0006UA-0u for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:28 +0000 Received: by mail-pg1-x542.google.com with SMTP id s15so1467061pgc.8 for ; Fri, 21 Aug 2020 12:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A9ju+r34sWfhod71XL1bT+zi6vF+Wn+whGvig44U/H8=; b=mPcfZIGuf1IZHjreJOKyf+8HKo4m4M4Fs7OCfWzQHGepGQ2VKw/pZolBRvYuRnsgrD iO6Sm/0z9adI7m403A/1my//6tCmpz/F5LGl8FcvQXkQNaGnonYynUO4LclCHmwMJqs0 O0N8myI4UIrjk5XmzJuV30avHlcvBnyogqviE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A9ju+r34sWfhod71XL1bT+zi6vF+Wn+whGvig44U/H8=; b=q+WAsuIJT6keN2aVByYws1NiRz+1nX9XaGJ3m7lxYP3CzPJQDf6EkleopUJXAaxjwK glIieMYjpnqDPHnBqIfQ/yUxLq2X4MAokDLXWn052hMnHwrCLr+OKnrRArGxb4mEPKmP twjOUgtLNkstvV7h4YvKjaACRdNps7PKw1g290/DgjB2A5rS/5oe0UB7J19sHkVCytsp VMkwX4FNsjlfKRDweVjvA6de3ugQel99lwmTMGu0ar9UfxfMPDej1x7f3WP29xnsetGK sLtkk9lVb6qcSQ/I1bGGTakLEu6DpckyOgP7aOfXKPJXS+qfPObqszm3VBmvTnkbPFFX hX2A== X-Gm-Message-State: AOAM530dTnjodqfswg0GLrbV+Owr/jjlHJKDfYA9A34oPM4yD1qPSP6o ANeu06e7M1JsFJNveklopYwwaw== X-Google-Smtp-Source: ABdhPJxNUi6ggriXccpA572qG6bm/FjMSOm/9dg/71/aIV6K+hAYLL89xzLCOF1RLAPDkBnD4lQ2Ag== X-Received: by 2002:aa7:8bd2:: with SMTP id s18mr3530477pfd.284.1598039062849; Fri, 21 Aug 2020 12:44:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y28sm3504632pfq.83.2020.08.21.12.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:21 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 02/29] vmlinux.lds.h: Add .gnu.version* to COMMON_DISCARDS Date: Fri, 21 Aug 2020 12:42:43 -0700 Message-Id: <20200821194310.3089815-3-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154425_124205_93C2278A X-CRM114-Status: GOOD ( 16.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Fangrui Song , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , linux-arm-kernel@lists.infradead.org, Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , Arnd Bergmann Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For vmlinux linking, no architecture uses the .gnu.version* sections, so remove it via the COMMON_DISCARDS macro in preparation for adding --orphan-handling=warn more widely. This is a work-around for what appears to be a bug[1] in ld.bfd which warns for this synthetic section even when none is found in input objects, and even when no section is emitted for an output object[2]. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=26153 [2] https://lore.kernel.org/lkml/202006221524.CEB86E036B@keescook/ Reviewed-by: Fangrui Song Signed-off-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 184b23d62784..f1f02a2f71b7 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -957,7 +957,9 @@ #define COMMON_DISCARDS \ *(.discard) \ *(.discard.*) \ - *(.modinfo) + *(.modinfo) \ + /* ld.bfd warns about .gnu.version* even when not emitted */ \ + *(.gnu.version*) \ #define DISCARDS \ /DISCARD/ : { \ From patchwork Fri Aug 21 19:42:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9762618 for ; Fri, 21 Aug 2020 19:45:03 +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 802512076E for ; Fri, 21 Aug 2020 19:45:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rQWaECuv"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WQAO8nzc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 802512076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/+sivLnK3Y/ykXHeTyfnVjfMOJLejSbxTvAPR2iS5tM=; b=rQWaECuvE7+sXNJjYp+tpFS/9 UQCNxZy4ZxBWuUbCUMB6pGc90xnDwhjg+L2pfPYhNewKW/VUV+FinZnwYP+rYr9ggs+ByQyEDSO0I gt89bHxObeeFgyPee1zW0EtDj+qE51pd48wD5AiCKs3oxi2oRZkXgl+dZ+ejnqnCXp/h+/NeAOAPW jkhWVjplbG+hxWxOI1ySvA+9affJy5xlppLaNxX3NEIIUxc2sdwc+QV3umism6qKlP2VTGLRnCfte BU9DvT8/EqgOhc0FWGYOT8PDl9gYkKrj3hlJzCqL5PrbGQnsl71JBeh4E/LlanMfcSSynG6u9VIUO aoanh40mA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cy4-0006gb-9G; Fri, 21 Aug 2020 19:44:52 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxd-0006Ub-PA for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:29 +0000 Received: by mail-pl1-x643.google.com with SMTP id r4so1347400pls.2 for ; Fri, 21 Aug 2020 12:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EUDDa5Q6lLloNoTQD6KqNHOrv0G5BcLftZGhmDIGIUI=; b=WQAO8nzc20p4joT5SWjFSFwNOUK151WWyLE1F1s8PdTuZonJVYgAtlZ8pDXZ4AqOqd vECfHj/uT7fKKd8Qks16HHdoIyHotqZJnMRENHTJLHqtxq4/EKASXKh/xIpHq1PCzQOe 6/Oopz6fd7xjErT/RlKOTUW3p5afBMZhqXfX4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EUDDa5Q6lLloNoTQD6KqNHOrv0G5BcLftZGhmDIGIUI=; b=THiWQramNRUlgXtKwu6WZWPKtSaYsJOUOmDXF9lpsB3jCHvJLGgGlUI6ygpTpVaozt IJ+o/DSsV+i0Ife/4D3L8JeWxx2hkV1nDBHUo0X/lYbpzX+O8YzFR7syiwjs7zyAvG2+ 0stVjCIay+Z87fMPfcWCqESFF/OpZnvWDFG1vci3EqmMAsB5q28cT8P+FGT36GmTmXN9 BtTHcFjGj8wB3Usb1MPCfmIvpBngzXI4QYPy3vONt336QecPUMhQ+8arLepE58Cr+6Xl LUINJT8a4x3hgifRmH+ZrKcHQNwBwUv0zgm6Fx8BWKqlDz+TZxqj1hipGzuHX0BacT40 HMKg== X-Gm-Message-State: AOAM533OIGNaivgqE7LdjA4uHMKIkDBApiRP09jKO0999Z48u/0Chi30 mtr31FkW77RqDZAWA/fmGxiekg== X-Google-Smtp-Source: ABdhPJwAkf1pEoEXTnteUwchu7GM7Vb0zPYumreldvv1hu9wDHdvHTU4ydc4PdV7f7+x8VGZjdhzEg== X-Received: by 2002:a17:90a:4dca:: with SMTP id r10mr3568315pjl.200.1598039063622; Fri, 21 Aug 2020 12:44:23 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 74sm3320208pfv.191.2020.08.21.12.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:21 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 03/29] vmlinux.lds.h: Avoid KASAN and KCSAN's unwanted sections Date: Fri, 21 Aug 2020 12:42:44 -0700 Message-Id: <20200821194310.3089815-4-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154425_838757_3FD8463F X-CRM114-Status: GOOD ( 13.64 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, Marco Elver , linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 Tested-by: Marco Elver Signed-off-by: Kees Cook --- 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 f1f02a2f71b7..6b89a03e636e 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) \ From patchwork Fri Aug 21 19:42:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE80A618 for ; Fri, 21 Aug 2020 19:46:42 +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 59CC02076E for ; Fri, 21 Aug 2020 19:46:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mgK+0mtF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kh8rUgVl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59CC02076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dxS6inB689+LESzFoqzS5cIdu110sjlsgViO4SxiqRw=; b=mgK+0mtFGCjRLfFRP0V0CTiWc 7vZxfBBVxN/dWwGaf+fuPHs0h2iaAK13rzti20VmQaSwLOi0uPolnL8M58JwvwWOK9++6YUaOXYT8 i4V/NmC7yPBw2yzpfRmgGbY/3M63mqbVLZPLhO5Aw0M+fqq1ZD15dTZtYDn6toZRI41C4fqR6wjiU f6MsF6xF2ol1CnH6lUHHYjeT6Ek4ahiA4+Wqb+mde0JP34XEua3oeEeZRPwtVVrsGRlSmmGNyToJ3 /fZ1WeG8ppfCsh5pSyYmVjw7noovkDAaR9oX0yO7bgkwJuk0EHumnWUMSuS0D/liJA8VqD7WNaYqU O87d0tTKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxp-0006cp-Pe; Fri, 21 Aug 2020 19:44:37 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxb-0006T1-CU for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:27 +0000 Received: by mail-pf1-x444.google.com with SMTP id k18so1559677pfp.7 for ; Fri, 21 Aug 2020 12:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yvp4o2qxjsx/g4fp5+EngLXg9VgoAsFpnYqBwOLxFH4=; b=kh8rUgVlrZY9K/ZD9C4Q74FPPLt4tP+o0u0YRjhs57dI7bXBW761fyegN7oNIU26ml 9QH4PV+R1VZDOkMsiLsNm9MfFthrNzmQBVlBDW6GM73jT5yaGW/epEXNuOTID4H2u/vN ykcU14bBkMyIgQtMDF1hp/RmQi717dkCNOy3E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yvp4o2qxjsx/g4fp5+EngLXg9VgoAsFpnYqBwOLxFH4=; b=SK9OHpl3WELJIPUN57ApWDDhlFxjrdtqtF9S7ciAwe1LcSE9r1vGEUV5qh7WP3JA49 i6rdzY27U2PuafVlLsK/tH6leSuVkO3sjnp1eXk+XSwl7x+Ex5SmLqqeZtg/+hgtPgcu gwzq1z6ZBVpg6xvXEryYh6Y6TsI+s5YGp8o+sx01wKL2piuFpThkHwy30M9MKBZJ1PPp XNsw13a9NFZ8C9fewZpd7PlKBYs8ulEFgmNU4UCUAvofPLoAhDjYCSzVGZye8CnaaKNy ZA7SjZ9hPOwgf5FhyCxbaPCIz7R50IFbKvCiUxqHBfhP7Lik/4DCtC0ZsNQNJdncqBle oL8A== X-Gm-Message-State: AOAM533gHbx9Url4fp08/oQg/4F27N2uilDyAdNQ6a5a6A1lphPCjryU eeJpHAvmVhmtDCsKrwbkeKykIw== X-Google-Smtp-Source: ABdhPJxnlLrqsfuF+xfd9G0eXO+gbevfUrRObVPj0oDtE+Rq1arsfY+XUMuUKmKLua+8x1og9yr0yQ== X-Received: by 2002:a62:3303:: with SMTP id z3mr3826111pfz.252.1598039060999; Fri, 21 Aug 2020 12:44:20 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id p11sm3129748pgh.80.2020.08.21.12.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:19 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 04/29] vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG Date: Fri, 21 Aug 2020 12:42:45 -0700 Message-Id: <20200821194310.3089815-5-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154423_449980_0F0A7C86 X-CRM114-Status: GOOD ( 16.64 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The .comment section doesn't belong in STABS_DEBUG. Split it out into a new macro named ELF_DETAILS. This will gain other non-debug sections that need to be accounted for when linking with --orphan-handling=warn. Signed-off-by: Kees Cook --- arch/alpha/kernel/vmlinux.lds.S | 1 + arch/arc/kernel/vmlinux.lds.S | 1 + arch/arm/kernel/vmlinux-xip.lds.S | 1 + arch/arm/kernel/vmlinux.lds.S | 1 + arch/arm64/kernel/vmlinux.lds.S | 1 + arch/csky/kernel/vmlinux.lds.S | 1 + arch/hexagon/kernel/vmlinux.lds.S | 1 + arch/ia64/kernel/vmlinux.lds.S | 1 + arch/mips/kernel/vmlinux.lds.S | 1 + arch/nds32/kernel/vmlinux.lds.S | 1 + arch/nios2/kernel/vmlinux.lds.S | 1 + arch/openrisc/kernel/vmlinux.lds.S | 1 + arch/parisc/boot/compressed/vmlinux.lds.S | 1 + arch/parisc/kernel/vmlinux.lds.S | 1 + arch/powerpc/kernel/vmlinux.lds.S | 2 +- arch/riscv/kernel/vmlinux.lds.S | 1 + arch/s390/kernel/vmlinux.lds.S | 1 + arch/sh/kernel/vmlinux.lds.S | 1 + arch/sparc/kernel/vmlinux.lds.S | 1 + arch/um/kernel/dyn.lds.S | 2 +- arch/um/kernel/uml.lds.S | 2 +- arch/x86/boot/compressed/vmlinux.lds.S | 2 ++ arch/x86/kernel/vmlinux.lds.S | 1 + include/asm-generic/vmlinux.lds.h | 8 ++++++-- 24 files changed, 30 insertions(+), 5 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index bc6f727278fd..5b78d640725d 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -72,6 +72,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S index 54139a6f469b..33ce59d91461 100644 --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S @@ -122,6 +122,7 @@ SECTIONS _end = . ; STABS_DEBUG + ELF_DETAILS DISCARDS .arcextmap 0 : { diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 6d2be994ae58..3d4e88f08196 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -152,6 +152,7 @@ SECTIONS _end = .; STABS_DEBUG + ELF_DETAILS } /* diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 7f24bc08403e..5592f14b7e35 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -151,6 +151,7 @@ SECTIONS _end = .; STABS_DEBUG + ELF_DETAILS } #ifdef CONFIG_STRICT_KERNEL_RWX diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index ec8e894684a7..13fc2ec46aae 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -241,6 +241,7 @@ SECTIONS _end = .; STABS_DEBUG + ELF_DETAILS HEAD_SYMBOLS } diff --git a/arch/csky/kernel/vmlinux.lds.S b/arch/csky/kernel/vmlinux.lds.S index f05b413df328..f03033e17c29 100644 --- a/arch/csky/kernel/vmlinux.lds.S +++ b/arch/csky/kernel/vmlinux.lds.S @@ -109,6 +109,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S index 0ca2471ddb9f..35b18e55eae8 100644 --- a/arch/hexagon/kernel/vmlinux.lds.S +++ b/arch/hexagon/kernel/vmlinux.lds.S @@ -67,5 +67,6 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS } diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index d259690eb91a..9b265783be6a 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -218,6 +218,7 @@ SECTIONS { STABS_DEBUG DWARF_DEBUG + ELF_DETAILS /* Default discards */ DISCARDS diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index f185a85a27c1..5e97e9d02f98 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -202,6 +202,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS /* These must appear regardless of . */ .gptab.sdata : { diff --git a/arch/nds32/kernel/vmlinux.lds.S b/arch/nds32/kernel/vmlinux.lds.S index 7a6c1cefe3fe..6a91b965fb1e 100644 --- a/arch/nds32/kernel/vmlinux.lds.S +++ b/arch/nds32/kernel/vmlinux.lds.S @@ -64,6 +64,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S index c55a7cfa1075..126e114744cb 100644 --- a/arch/nios2/kernel/vmlinux.lds.S +++ b/arch/nios2/kernel/vmlinux.lds.S @@ -58,6 +58,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S index 60449fd7f16f..d287dbb84d0f 100644 --- a/arch/openrisc/kernel/vmlinux.lds.S +++ b/arch/openrisc/kernel/vmlinux.lds.S @@ -115,6 +115,7 @@ SECTIONS /* Throw in the debugging sections */ STABS_DEBUG DWARF_DEBUG + ELF_DETAILS /* Sections to be discarded -- must be last */ DISCARDS diff --git a/arch/parisc/boot/compressed/vmlinux.lds.S b/arch/parisc/boot/compressed/vmlinux.lds.S index 2ac3a643f2eb..ab7b43990857 100644 --- a/arch/parisc/boot/compressed/vmlinux.lds.S +++ b/arch/parisc/boot/compressed/vmlinux.lds.S @@ -84,6 +84,7 @@ SECTIONS } STABS_DEBUG + ELF_DETAILS .note 0 : { *(.note) } /* Sections to be discarded */ diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 53e29d88f99c..2769eb991f58 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -164,6 +164,7 @@ SECTIONS _end = . ; STABS_DEBUG + ELF_DETAILS .note 0 : { *(.note) } /* Sections to be discarded */ diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 326e113d2e45..e0548b4950de 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -360,8 +360,8 @@ SECTIONS PROVIDE32 (end = .); STABS_DEBUG - DWARF_DEBUG + ELF_DETAILS DISCARDS /DISCARD/ : { diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index f3586e31ed1e..6f3af7bbc49d 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -97,6 +97,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 37695499717d..177ccfbda40a 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -181,6 +181,7 @@ SECTIONS /* Debugging sections. */ STABS_DEBUG DWARF_DEBUG + ELF_DETAILS /* Sections to be discarded */ DISCARDS diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S index bde7a6c01aaf..3161b9ccd2a5 100644 --- a/arch/sh/kernel/vmlinux.lds.S +++ b/arch/sh/kernel/vmlinux.lds.S @@ -76,6 +76,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index f99e99e58075..d55ae65a07ad 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -187,6 +187,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index f5001481010c..dacbfabf66d8 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S @@ -164,8 +164,8 @@ SECTIONS PROVIDE (end = .); STABS_DEBUG - DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 3b6dab3d4501..45d957d7004c 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S @@ -108,8 +108,8 @@ SECTIONS PROVIDE (end = .); STABS_DEBUG - DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index 29df99b6cc64..3c2ee9a5bf43 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -82,6 +82,8 @@ SECTIONS . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ _end = .; + ELF_DETAILS + DISCARDS } diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 9a03e5b23135..0cc035cb15f1 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -411,6 +411,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS } diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 6b89a03e636e..cadcbc3cdabd 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -34,6 +34,7 @@ * * STABS_DEBUG * DWARF_DEBUG + * ELF_DETAILS * * DISCARDS // must be the last * } @@ -811,14 +812,17 @@ .debug_macro 0 : { *(.debug_macro) } \ .debug_addr 0 : { *(.debug_addr) } - /* Stabs debugging sections. */ +/* Stabs debugging sections. */ #define STABS_DEBUG \ .stab 0 : { *(.stab) } \ .stabstr 0 : { *(.stabstr) } \ .stab.excl 0 : { *(.stab.excl) } \ .stab.exclstr 0 : { *(.stab.exclstr) } \ .stab.index 0 : { *(.stab.index) } \ - .stab.indexstr 0 : { *(.stab.indexstr) } \ + .stab.indexstr 0 : { *(.stab.indexstr) } + +/* Required sections not related to debugging. */ +#define ELF_DETAILS \ .comment 0 : { *(.comment) } #ifdef CONFIG_GENERIC_BUG From patchwork Fri Aug 21 19:42:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05D8613B1 for ; Fri, 21 Aug 2020 19:46:55 +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 CD7A720738 for ; Fri, 21 Aug 2020 19:46:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nSS7mZGH"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NugASbhH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD7A720738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SonaDNX1UxrSyQlsvALmnbkCPahlJgw4KtKwNkycMOM=; b=nSS7mZGHn95JryZg5J35wJVNK BzrALj83WgQA+Rlkh7YgkkjNmzglVrM9kQICE6Jg+ra7GNMOCqVQTGA6JRWW9x/3gQpk3f7d7o255 mhAl9f4NeAlmGe7cWCkYngZpZAzvEYzr+RRTjiIPymEAo6ci0sN2iEvyFzLz35gRIS1RtaFsZ7KaY bAzJ2QGWE68Vk9m25xXfC86XulFW8F98XrkN3A+SFI0SeuU+L9fJU9ycY9qQwzqjcH2KztmukOI8J mJh14/AaCP3+bKDZ3no8+wS0vthg8KbMN40NcMcv63wqGMNP2L28B8YHwsshdzMlOOGrUDeX+nTOg cMtnTq87Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cy7-0006hk-Ax; Fri, 21 Aug 2020 19:44:55 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxe-0006Ug-CJ for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:29 +0000 Received: by mail-pl1-x642.google.com with SMTP id h2so1349880plr.0 for ; Fri, 21 Aug 2020 12:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UQO/PcZpzZoe4IDChCWVkIxZf7tzI4XyeCxPmxC8FNI=; b=NugASbhHSLh4kJaKioodD/JRBqxUb7xOPm32oHVQ+brGiQkrNwDazPLYjk/bxUb9bc /X3UF/vMGgpmdxRlcpCXroq0TzwIcsJIZZtD6ra9JycErhlpr22IdOIR9+9MRF/J7oq1 4bN0HYcBhFQjhXKHHlOrjY2hDTe3dCGXNj624= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UQO/PcZpzZoe4IDChCWVkIxZf7tzI4XyeCxPmxC8FNI=; b=PUK8gruhR+MW8Ic5AdqA/bzIc+UMVSZvQft2Z3YafYKfUrWzbOo7xLIJP5ib/OdAO+ 7OOA16w3IE8UnnQ5CGcNxDmaUnYdU21aqAoRDUBoQBe27fB8iKp0CWhXV03NXvl+Ju5c 1UPFVJD1THhAR/K4ngNW08DzDbPn4cvpeXak2oHt52FvpzJd+sCSJTnUX7avEz4lJ72C JaXe/AIsKFA46xmShS5dM4BNYMQbWQb1Ez8oPDmuQVG3uREM1SG3CzL64kK8vzesEQnB uywY1mcU4duR49bewsIp/pN6COHtPOnnwg5Y1RXW3Y4uVTgKiifyRrjoem3/8XqCUYXc Kupw== X-Gm-Message-State: AOAM5303JD+qPstn4OdbuSA42502e5lZn8YQD3AniOqrbQbr47O3/55N OrINIsVizUu4WICyRfSKrxdl8g== X-Google-Smtp-Source: ABdhPJythyZxt12n8sEiGPQ9Kw/ofMF58pYY/nnVTG21TWExivmj/nZzvR/4NL1gss2+7xdDPHTiAQ== X-Received: by 2002:a17:902:8609:: with SMTP id f9mr3642315plo.324.1598039064310; Fri, 21 Aug 2020 12:44:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n1sm3563798pfu.2.2020.08.21.12.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:21 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 05/29] vmlinux.lds.h: Add .symtab, .strtab, and .shstrtab to ELF_DETAILS Date: Fri, 21 Aug 2020 12:42:46 -0700 Message-Id: <20200821194310.3089815-6-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154426_436151_2CC53D6C X-CRM114-Status: GOOD ( 14.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Fangrui Song , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , linux-arm-kernel@lists.infradead.org, Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , Arnd Bergmann Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When linking vmlinux with LLD, the synthetic sections .symtab, .strtab, and .shstrtab are listed as orphaned. Add them to the ELF_DETAILS section so there will be no warnings when --orphan-handling=warn is used more widely. (They are added above comment as it is the more common order[1].) ld.lld: warning: :(.symtab) is being placed in '.symtab' ld.lld: warning: :(.shstrtab) is being placed in '.shstrtab' ld.lld: warning: :(.strtab) is being placed in '.strtab' [1] https://lore.kernel.org/lkml/20200622224928.o2a7jkq33guxfci4@google.com/ Reported-by: Fangrui Song Signed-off-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index cadcbc3cdabd..98d013dcc11a 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -823,7 +823,10 @@ /* Required sections not related to debugging. */ #define ELF_DETAILS \ - .comment 0 : { *(.comment) } + .comment 0 : { *(.comment) } \ + .symtab 0 : { *(.symtab) } \ + .strtab 0 : { *(.strtab) } \ + .shstrtab 0 : { *(.shstrtab) } #ifdef CONFIG_GENERIC_BUG #define BUG_TABLE \ From patchwork Fri Aug 21 19:42:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730393 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39FC013B1 for ; Fri, 21 Aug 2020 19:47:07 +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 12E8C2072D for ; Fri, 21 Aug 2020 19:47:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K4k1fojl"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S9JWqqSo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12E8C2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lpsbJCPRVZValQmlegkRGF9han7qShnzBAGg1PJ7Kuk=; b=K4k1fojlTHIRrpHhorfiDKV+K o0C6jL8UuvK11flPTchdB/ms4DzbzaFVqI1DzX3ufawmqjpJLOgpj7RyDHIhTqGJ+Q0kTVceonyJf aEgilM5QIVZ2PIo48Z4+NIvvrwx50gmnsxgF2cefH12/Uy38flNCP85A4reyU+N20NtmJa+2zLIbV wy9AbwTcxiswWHWbVMND3hFORndKQqmQ/pVscxmKXA5ZqvOZ4bTonQKx1k5ptniG+YGRk7F9nDKPz DcP03APQTNo9OrYmKmyVv7dfmDcZ5KhwEim2oOThGrD8epkOQiS7ziWKLkN5Hjeite8EdmbgC8okj aUj5r7bkQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CyD-0006jI-AR; Fri, 21 Aug 2020 19:45:02 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxe-0006VN-NU for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:31 +0000 Received: by mail-pl1-x642.google.com with SMTP id f5so1334404plr.9 for ; Fri, 21 Aug 2020 12:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LhHa8hwizWicyR7AmABsSaI963QK2ejKgNvGzEzQJyI=; b=S9JWqqSou1s/FK9u3DQ4o9uu0Z66hNrndmRM9lwRys0IRRdCU3reoSB3x/0i4D3/0d FE38SPzh4Sjdcmnpux/wEu2YEvs49KaQ4x96TdKBVxMC1MQo/Pu6aF3uTjn2T4WoNN1/ 69NCo9CYct3Ga+OFZvqV0/uxV0gjNFTPm/uUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LhHa8hwizWicyR7AmABsSaI963QK2ejKgNvGzEzQJyI=; b=gIpX14Fu89Y+env0qxeqQ77o+VknexdPUNXJX845gWdG9wZV896IPrlEwF6YE+8nL3 CGwiJvBeMvVHSgu5QmeaUx7bjvOQYG8Wj+IB6vOuegcbV+Xegg0GDjfC9c3DmvwYn04x SY02QlmRgOV0KR8RVtgkV2WLkegXPvwZs3n77Yo/vTE/qG5Flfcvbm4uBWLzvZeXQFSp LVHYZG0fcqGucG8EiSqZPzj7OTvnXpikCDyxqgNU50qMvmZfEDBZrZAnT/6xugzH0RBE lZbuDVGKlQr34ONAQPVUgs7J+eF+63SUXt1kvtDvNQoz2Dt7GwU4MTAVcmC0+DuawqKI yg/Q== X-Gm-Message-State: AOAM531gvMDOjM9PADoMhl6yMc8mf/BIqr80A5X39uIxuexyuV3HuL4C Lw1GsygNr5iHIa4r1KR7Y/JWKg== X-Google-Smtp-Source: ABdhPJzWv+Ua2gk2lyj7ptkVCQDZcrq9EuhQmtA+I5dIDb9MoFHSNp7AHZuTqGfhtxhz0zpt9GJ9mA== X-Received: by 2002:a17:902:b70e:: with SMTP id d14mr3365610pls.253.1598039065065; Fri, 21 Aug 2020 12:44:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a193sm3460814pfa.105.2020.08.21.12.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:21 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 06/29] vmlinux.lds.h: add PGO and AutoFDO input sections Date: Fri, 21 Aug 2020 12:42:47 -0700 Message-Id: <20200821194310.3089815-7-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154426_804436_9FE9E0F6 X-CRM114-Status: GOOD ( 19.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-efi@vger.kernel.org, Catalin Marinas , Arvind Sankar , Manoj Gupta , Ard Biesheuvel , linux-arch@vger.kernel.org, =?utf-8?b?RsSBbmctcnXDrCBTw7JuZw==?= , Masahiro Yamada , x86@kernel.org, Russell King , clang-built-linux@googlegroups.com, Ingo Molnar , Luis Lozano , Borislav Petkov , Kees Cook , Arnd Bergmann , Jian Cai , Nathan Chancellor , Peter Collingbourne , linux-arm-kernel@lists.infradead.org, Nick Desaulniers , linux-kernel@vger.kernel.org, stable@vger.kernel.org, James Morse Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nick Desaulniers Basically, consider .text.{hot|unlikely|unknown}.* part of .text, too. When compiling with profiling information (collected via PGO instrumentations or AutoFDO sampling), Clang will separate code into .text.hot, .text.unlikely, or .text.unknown sections based on profiling information. After D79600 (clang-11), these sections will have a trailing `.` suffix, ie. .text.hot., .text.unlikely., .text.unknown.. When using -ffunction-sections together with profiling infomation, either explicitly (FGKASLR) or implicitly (LTO), code may be placed in sections following the convention: .text.hot., .text.unlikely., .text.unknown. where , , and are functions. (This produces one section per function; we generally try to merge these all back via linker script so that we don't have 50k sections). For the above cases, we need to teach our linker scripts that such sections might exist and that we'd explicitly like them grouped together, otherwise we can wind up with code outside of the _stext/_etext boundaries that might not be mapped properly for some architectures, resulting in boot failures. If the linker script is not told about possible input sections, then where the section is placed as output is a heuristic-laiden mess that's non-portable between linkers (ie. BFD and LLD), and has resulted in many hard to debug bugs. Kees Cook is working on cleaning this up by adding --orphan-handling=warn linker flag used in ARCH=powerpc to additional architectures. In the case of linker scripts, borrowing from the Zen of Python: explicit is better than implicit. Also, ld.bfd's internal linker script considers .text.hot AND .text.hot.* to be part of .text, as well as .text.unlikely and .text.unlikely.*. I didn't see support for .text.unknown.*, and didn't see Clang producing such code in our kernel builds, but I see code in LLVM that can produce such section names if profiling information is missing. That may point to a larger issue with generating or collecting profiles, but I would much rather be safe and explicit than have to debug yet another issue related to orphan section placement. Reported-by: Jian Cai Suggested-by: Fāng-ruì Sòng Tested-by: Luis Lozano Tested-by: Manoj Gupta Acked-by: Kees Cook Cc: stable@vger.kernel.org Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=add44f8d5c5c05e08b11e033127a744d61c26aee Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=1de778ed23ce7492c523d5850c6c6dbb34152655 Link: https://reviews.llvm.org/D79600 Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1084760 Debugged-by: Luis Lozano Signed-off-by: Nick Desaulniers Signed-off-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 98d013dcc11a..91dcfb91ac45 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -581,7 +581,10 @@ */ #define TEXT_TEXT \ ALIGN_FUNCTION(); \ - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \ + *(.text.hot .text.hot.*) \ + *(TEXT_MAIN .text.fixup) \ + *(.text.unlikely .text.unlikely.*) \ + *(.text.unknown .text.unknown.*) \ NOINSTR_TEXT \ *(.text..refcount) \ *(.ref.text) \ From patchwork Fri Aug 21 19:42:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730381 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9525A13B1 for ; Fri, 21 Aug 2020 19:46:25 +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 6F3332072D for ; Fri, 21 Aug 2020 19:46:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K/aY0xLN"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JT4pVb10" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F3332072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vdQXMkkky7cnY+p9N1nBcRZHaGq1qt+2Ti72RYVWGqQ=; b=K/aY0xLNneHOjFkHjg3QW92CW SudX5YoAld6Stx4dWIUztS7qXi/+ZaDV4iy+oCay0K45RsXTAKw1iQQPoTS/Vw7acCJodN3VFD+OC tD6RQeMF85GWaLzs5C4SchVHZDNHBSBJm24N21sHQqR0VgxS4FEY9vVSegCJdfWyMhZTfjQKd8pua VVn7dxcfes6zBavZzt7/ZdWHsN3ij0GZ8eQ2pyNRaxL53DwzjLMrEKVV9B7nHxf0pKv7Z/9flu88e a954NVbmXceFqw8KSZ1Ww8uq+JdlOmCR0KZhIVn6TMQ9mCDUfk3fAWOIRHjWsCvyfDQD0u0oC0vsy QkNN5E4/g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CzK-0007GN-Ol; Fri, 21 Aug 2020 19:46:10 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxi-0006Xw-Fk for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:38 +0000 Received: by mail-pj1-x1043.google.com with SMTP id 2so1255865pjx.5 for ; Fri, 21 Aug 2020 12:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0/rE8jJuXRc1airAle0+onivAY85nE0+tqDHT+XyY88=; b=JT4pVb10IceVeDm1adcHLxdY4EdYIPEWA3KjTJabgl0d0VA5WUnoX/ushJfgCok6Ho 4B3EVm8AF4NzrvER3XCq7eZ+7m4BIvPPR9geOnruF42EwoVDjqeHzLgmffnFdRS+y+Bg 5UlsXllprv18ipGiriocq+G9bM7cQTotoNyOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0/rE8jJuXRc1airAle0+onivAY85nE0+tqDHT+XyY88=; b=LnLz2frG0dJT53pDehrGab+P9I4pgdFwk8phf+FMiuI+SypQqN3F02vTbPBUGgua2B SOcYOp2hM1af77dKwxRu1n2zxn67ZdkkIAunzNSrIObWTvK+2Kdft5DoPiaRzzr3AWX6 AsD2OMYXCwFDubznAsGIUj48kF18MZWS8S9bK9QkPElaGJ4zXIcwNgBE9aYOOBICpOTr RqslFhs83zVZ3NxoWGvZPdsCYsmBOIxjEWdh5iDeGCdxFnskFzFspo+4zJvtzfTquv1F 4ssWXR8o9IB8hfxnerUfG3a20hpg+DCcEgNufJOT0urYIucnla1hwsr/fg47XJ7ydMzA u6SQ== X-Gm-Message-State: AOAM532AqFs/7XejjkZsPnyogsUS3pulhbQOIlZTvhkUxS5rxlgfYpaC 6y+bqoA4tnIKFhDJ8HUbAr2SQQ== X-Google-Smtp-Source: ABdhPJyuGIVQ0b+PhpdQKCs1+OXOtpRIrOjbVmWZxwlIoSAwv7AnBEr84ug+NmvksNd2aTZqqIZrEg== X-Received: by 2002:a17:902:ac84:: with SMTP id h4mr3560297plr.334.1598039068646; Fri, 21 Aug 2020 12:44:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e125sm3411364pfh.69.2020.08.21.12.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 07/29] efi/libstub: Disable -mbranch-protection Date: Fri, 21 Aug 2020 12:42:48 -0700 Message-Id: <20200821194310.3089815-8-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154430_647305_D129A8F2 X-CRM114-Status: GOOD ( 16.58 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1043 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , clang-built-linux@googlegroups.com, Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, Atish Patra , Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for adding --orphan-handling=warn to more architectures, disable -mbranch-protection, as EFI does not yet support it[1]. This was noticed due to it producing unwanted .note.gnu.property sections (prefixed with .init due to the objcopy build step). However, we must also work around a bug in Clang where the section is still emitted for code-less object files[2], so also remove the section during the objcopy. [1] https://lore.kernel.org/lkml/CAMj1kXHck12juGi=E=P4hWP_8vQhQ+-x3vBMc3TGeRWdQ-XkxQ@mail.gmail.com [2] https://bugs.llvm.org/show_bug.cgi?id=46480 Cc: Arvind Sankar Cc: Atish Patra Cc: linux-efi@vger.kernel.org Acked-by: Ard Biesheuvel Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook --- drivers/firmware/efi/libstub/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 5eefd60917df..0c911e391d75 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -18,7 +18,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin cflags-$(CONFIG_ARM64) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ - -fpie $(DISABLE_STACKLEAK_PLUGIN) + -fpie $(DISABLE_STACKLEAK_PLUGIN) \ + $(call cc-option,-mbranch-protection=none) cflags-$(CONFIG_ARM) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ -fno-builtin -fpic \ $(call cc-option,-mno-single-pic-base) @@ -66,6 +67,12 @@ lib-$(CONFIG_X86) += x86-stub.o CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) +# Even when -mbranch-protection=none is set, Clang will generate a +# .note.gnu.property for code-less object files (like lib/ctype.c), +# so work around this by explicitly removing the unwanted section. +# https://bugs.llvm.org/show_bug.cgi?id=46480 +STUBCOPY_FLAGS-y += --remove-section=.note.gnu.property + # # For x86, bootloaders like systemd-boot or grub-efi do not zero-initialize the # .bss section, so the .bss section of the EFI stub needs to be included in the From patchwork Fri Aug 21 19:42:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730377 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EF881731 for ; Fri, 21 Aug 2020 19:45:35 +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 E8F5D20838 for ; Fri, 21 Aug 2020 19:45:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bo0mhvnb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="k/ZAm37V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8F5D20838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wm/Jq+/MBOEg1BsiTZ2M2cG2LsHgFTeaflWYdVBQfYc=; b=bo0mhvnbD5sorybPABhCb3gjs hJxsXC8lPKOuI6KdyRt7f7JBqPTzgRzs76iABb0AA7jWSGJZgkI5Au0Avhc1QzgxRXW3nzJ4i/JPL nk+rMSre7g+OQBn0oKHftJm6pvskuvJanj6wvyhIj8l810bMwWD4pD/2JTvVzP1AgbFq82hXwLXSo KSptFCKQLjb9D+Wpkwpwvb9iO8+2dggeC15MYruwVwt8WC1LLGXcMAa3HOhswbvBJhGqRBZ798EXM 8mnwPZSyTnDZqTYgx8fxrGkB7PeD2ybmuh70JxeI/f0rhTteURpuemBKMxi+aaQCgsRG7akbIxpBo qCpbKbKjg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CyQ-0006q0-NP; Fri, 21 Aug 2020 19:45:14 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxg-0006Wd-BQ for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:31 +0000 Received: by mail-pj1-x1043.google.com with SMTP id j13so1248140pjd.4 for ; Fri, 21 Aug 2020 12:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hbD6RkxNdJTcKmyBxOnwhwhFLlA3pFOZa2+9BxU1UDc=; b=k/ZAm37VP1X0Kj1z64OdTHZH+kgOl4h92xzOZByWNVg3dzcR1sl/edZWM4g7/9LMAK 2Od2ht3mMCq299yi5RNhkiAxOqIYIKOtTPXtLMLUZ5+K4ApR8llZWbSSfqPKO9vpdM54 u3IVf46CxIC/7wREtzNOaKaD0JXG4ZkzQ/GcQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hbD6RkxNdJTcKmyBxOnwhwhFLlA3pFOZa2+9BxU1UDc=; b=fWD8SX5TlF2iCLSv8yUe/Ljutg2RrVkJyPIHOyO6R61h1F7RiyUXtd6YMb4K7xWVQ1 o7xMX1wrapXIyvBQCjL8ZI0rUnLBAo5DNVpoBNoy+1tRT4+qXxpRLecKhdSySzGh+ByT uk+uuecxxY9lrZ5y/yZr7P1XVB60pXanvnbAZ0/9PFJCFHWtOCjfIpl4gR7CtOlUTAN8 H6pHncCYHvcJo+lfjKG+MU+s5kjZ8cFEYAlSQuSMm9SvzqlL3j8k34F4c0TZ341LFqyL Zr8RE67Xxsu1kMXDleivPBgx/acI9Bh/EGM5Z2TEG7o/GjNfLrFkpsoVyWWo85WaT/TE G3MQ== X-Gm-Message-State: AOAM532ZQEgZLIzh2Tl65OMgvsP9W9YWiRC2SmES48e6h8zrsOZWqAOF s7hsfq9yKUt4Gx+MXANnYMVi+A== X-Google-Smtp-Source: ABdhPJxDM/ng4HXO1XmyLDVgiDpkbXCWteROsynvEzbdVUNlJ67l4Ln6nf23ww8a+EXs+mGvmFV0/Q== X-Received: by 2002:a17:90a:307:: with SMTP id 7mr3757015pje.37.1598039066650; Fri, 21 Aug 2020 12:44:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 2sm3556730pfv.27.2020.08.21.12.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 08/29] arm64/mm: Remove needless section quotes Date: Fri, 21 Aug 2020 12:42:49 -0700 Message-Id: <20200821194310.3089815-9-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154428_460338_DAF8C87C X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1043 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Peter Collingbourne , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Fix a case of needless quotes in __section(), which Clang doesn't like. Acked-by: Will Deacon Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook --- arch/arm64/mm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 75df62fea1b6..e43c805b7b8c 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -43,7 +43,7 @@ u64 idmap_t0sz = TCR_T0SZ(VA_BITS); u64 idmap_ptrs_per_pgd = PTRS_PER_PGD; -u64 __section(".mmuoff.data.write") vabits_actual; +u64 __section(.mmuoff.data.write) vabits_actual; EXPORT_SYMBOL(vabits_actual); u64 kimage_voffset __ro_after_init; From patchwork Fri Aug 21 19:42:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730397 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9ACA2618 for ; Fri, 21 Aug 2020 19:47:31 +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 5E3D4214F1 for ; Fri, 21 Aug 2020 19:47:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jAHhL0Gb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bzEVhilQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E3D4214F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4Riqd+Fl9IQTFPJY+2tqtPMcsxCiTdjlQmxGMvC9NuA=; b=jAHhL0GbI/jRtsTPyi48HgIj1 SNVcDe+mFwoKqxHxyzbrrrsav/9nUX1UiA9Vkq9x3sOGWCmscuctbVWPumf0k5YXGzrDsf0XoLE2A /y05qUVipRKey4jnTVeAPxaQTgBHjVN1RyUFvjo2RnekjrA02yRKfz1TUJ6depo2KNyN2HlG1V0HV sXAWtdHgcl5Df8nObuTCykZcW/NEP4ox8y9wmvoykLFkygU0/Ru7iRvdDjqxbhFt5sxgQf8NZSRj8 eI+pxnkTElTxWiDH8AhE2V1UIhWE5DH4DK+sB+qTlqp8Z6RVzismRHW5I32HWZiaLDwxmrNEEdpil wKl0j1u7w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CyX-0006sX-AF; Fri, 21 Aug 2020 19:45:21 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxh-0006Wr-4E for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:34 +0000 Received: by mail-pf1-x441.google.com with SMTP id u20so1580422pfn.0 for ; Fri, 21 Aug 2020 12:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y6H7F3yYvyF+nG4ZythWO1q4A4EGexkc0hsQxsFmb9Y=; b=bzEVhilQDoNZ88CqeMIylY5czHrj5mvx3pyI0KZHCOwCCad75pWPogmJocbzqDIa4M jCL7LMBOWN3BWIkvwxCZD0INBFknxTPTqmEyLqGKlmZvjvzASSQMjNtetIJK/36sGUfc tpPl9PGejZzGddLdSQuM8jUBTC9zPIENj4PdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y6H7F3yYvyF+nG4ZythWO1q4A4EGexkc0hsQxsFmb9Y=; b=O7Gzo94qf4Ll5gP++R/RU/P3dGz3tT2aOKIfRtRuGMTQPK9OjfaUFGfckLWK9+wWqz DjAeu9nSVHBu2To+Xiv0pz3E9161OJjp68cuTxBxFjIuQPbGEyeHeIAOI9amI4pQwIyL 6zuCrZvx+NmjmvvnqS3wim5wsCD9uQG+ufe5hBq5WNCXFuRaSC9jvkYGpCmGEg1/2PR0 7Yv1hYjQXayqOIohiTeSdHmqLJ0KQf8i8oCZ6Pc97j6jiua205bKWQTEeeJaqimcRAtU 7+Ti4/5qymJtwTNYPVJB68PDoV6KOZHsVYrwPswZNDfX/Q1sQxev+xWobQ4sUYZq2PTa PcSg== X-Gm-Message-State: AOAM533eGCgHTB/oyzkX0pK8pDQYRca7nremEF+4Gl7h13+NbEet4LfQ HYjgjVp6IPCFDZjXvD5vNjhIUg== X-Google-Smtp-Source: ABdhPJzovlQLohuyGck2L97aDvFQQrVLNN8WGQiiMLGQhFilz17skLPcq8rq1acZQatUKm4A+V3zJQ== X-Received: by 2002:a63:9c1:: with SMTP id 184mr171258pgj.265.1598039067233; Fri, 21 Aug 2020 12:44:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g23sm3243141pfo.95.2020.08.21.12.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 09/29] arm64/kernel: Remove needless Call Frame Information annotations Date: Fri, 21 Aug 2020 12:42:50 -0700 Message-Id: <20200821194310.3089815-10-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154429_277643_04088975 X-CRM114-Status: GOOD ( 12.59 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Peter Collingbourne , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Remove last instance of an .eh_frame section by removing the needless Call Frame Information annotations which were likely leftovers from 32-bit arm. Suggested-by: Ard Biesheuvel Acked-by: Will Deacon Signed-off-by: Kees Cook --- arch/arm64/kernel/smccc-call.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/kernel/smccc-call.S b/arch/arm64/kernel/smccc-call.S index 1f93809528a4..d62447964ed9 100644 --- a/arch/arm64/kernel/smccc-call.S +++ b/arch/arm64/kernel/smccc-call.S @@ -9,7 +9,6 @@ #include .macro SMCCC instr - .cfi_startproc \instr #0 ldr x4, [sp] stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] @@ -21,7 +20,6 @@ b.ne 1f str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS] 1: ret - .cfi_endproc .endm /* From patchwork Fri Aug 21 19:42:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730399 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8353F13B1 for ; Fri, 21 Aug 2020 19:48:04 +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 5C9EA208DB for ; Fri, 21 Aug 2020 19:48:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aQ28nDXo"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="j1sa53Se" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C9EA208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SzQsMuCCrMuastXxIbfn9LI6sBVNM7heIlKhSBeuGpo=; b=aQ28nDXoPK/4I9Ws3CrUw4AlT 2/H0TwHhWmo5euTSs0Mpad2cDbX3SQcvhvGHnqQV4Dk/d43unoJVGRS8EcLGwp9CrAnHcILSYBvAQ u/j+x/Td7y0QtW7tYsyacZMzp9r8IYuPvDmQtUGQ8zD2Lzhlwxy/4anBYP+9K+RQSmI404FbHQEz9 2PEGzEiGTUCiuCUZY+IQcDzs2FpdZXJQYjeoHXvCQtPjPX/mabHpPk5wMz7IKMydgI0feEUL1sNww ktHMaWzE1v/NzBiiXQpkhDEm81LJ7qIja7mITMySiiF+nyhTaLDSBYw8ibDFVcZCXER8H+yViivNh MR570orNA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CzF-0007Cz-7n; Fri, 21 Aug 2020 19:46:05 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxh-0006Xb-Lb for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:36 +0000 Received: by mail-pg1-x542.google.com with SMTP id j21so1464135pgi.9 for ; Fri, 21 Aug 2020 12:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XUX2/F199MEO0A5MxoqXk+lRBktQIKiWBEBF3o8wM8g=; b=j1sa53Ser9mup3Pv1fHYCK7qkFQ8JkWE5b9bJ2WYsLFPuFUJI+77KvzI8C6EnJ19+U HOx5t7CYCG20lCrUcZggNSgWvsVF0d2eqTd4pLYBAA6zYjF6GRTQ4yiYD74vhBk3D1th 23E2s7EIY6h+0C6fBfpGXayEHW+B0c00eaZ9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XUX2/F199MEO0A5MxoqXk+lRBktQIKiWBEBF3o8wM8g=; b=p0GVuBp1sYuhz72wp0lx5oLR+VskiZgxXVv76CEH0DhHq5/o4LocAizXbLreaYXuZM ioJ7jBqpP77Vhr5XEFXhBTvmH+xuP7MpyaUV+jK7zxFW94tsqKmHlCdw9tsHMRqmB0NV A6DZQReN31Q7MoYKXlvbbFdVJ91h+5wPNG7v3eLc/88NfskPUEhOhGj6U+4aTBdgALO6 OtlUM5zj4I42j1uCEzryxEnyI5nyFrXy2g0O7D+XH6fvhr0nNBhZlAfDyWWsmr1L20OL gmLgtfzM1kaQXfnoiL+gPGJ38vkzwjJ+OKycoqYGBnqPX6sJviM07y+4swB226Q21asx tAyQ== X-Gm-Message-State: AOAM533pN+oWm6sxzYnVyqVfhp7csnueBLxUVvJLzr6+4B2RAUeGxc1V g+lZ4MFjlnMSA52IUbvJBQbXkg== X-Google-Smtp-Source: ABdhPJxMWaonUSXNP/PpdB0d3pPrg3ZHtK9FuUs2ySecf3qKVDwynmOApOgUDdedWpVyLheXGVlFJw== X-Received: by 2002:a65:679a:: with SMTP id e26mr3467507pgr.167.1598039067977; Fri, 21 Aug 2020 12:44:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id p20sm2611002pjz.49.2020.08.21.12.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 10/29] arm64/build: Remove .eh_frame* sections due to unwind tables Date: Fri, 21 Aug 2020 12:42:51 -0700 Message-Id: <20200821194310.3089815-11-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154429_773834_D9953918 X-CRM114-Status: GOOD ( 13.21 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Peter Collingbourne , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Avoid .eh_frame* section generation by making sure both CFLAGS and AFLAGS contain -fno-asychronous-unwind-tables and -fno-unwind-tables. With all sources of .eh_frame now removed from the build, drop this DISCARD so we can be alerted in the future if it returns unexpectedly once orphan section warnings have been enabled. Suggested-by: Ard Biesheuvel Acked-by: Will Deacon Signed-off-by: Kees Cook --- arch/arm64/Makefile | 5 ++++- arch/arm64/kernel/vmlinux.lds.S | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 55bc8546d9c7..6de7f551b821 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -47,13 +47,16 @@ endif KBUILD_CFLAGS += -mgeneral-regs-only \ $(compat_vdso) $(cc_has_k_constraint) -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables KBUILD_CFLAGS += $(call cc-disable-warning, psabi) KBUILD_AFLAGS += $(compat_vdso) KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) +# Avoid generating .eh_frame* sections. +KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables +KBUILD_AFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables + ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y) prepare: stack_protector_prepare stack_protector_prepare: prepare0 diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 13fc2ec46aae..c2b8426bf4bd 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -94,7 +94,6 @@ SECTIONS *(.discard.*) *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) - *(.eh_frame) } . = KIMAGE_VADDR + TEXT_OFFSET; From patchwork Fri Aug 21 19:42:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730403 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1BCB7618 for ; Fri, 21 Aug 2020 19:48:23 +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 8B90320FC3 for ; Fri, 21 Aug 2020 19:48:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qoumnD+M"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GlR5zQFU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B90320FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KzGFhoZIgSAkwqVV5+hN3lyQO7BgnYKzFCiEQNdrcfg=; b=qoumnD+ME43flXcHvYmWJjIwR 0M0oXH58nEhHcs0pAXZS251yedntEODQh4OZZpNOpWrbaGcAAuDcXvq6kk9MUbAk+o/df4+GWLP2z bMaPmctJl9JpVP/zuOlrrylKuJjFg+tFca0X3466JXT7WkxgMTMARlC4MyZxT51lVul1UJzmzd/D6 N4cH2BxZddYV7B8FmjUsukLd6F9iE/FmZsJRhKXfsUGthJdqhG2dzK9rfMEpZ7o3guLy0EXIwzjZV dWc1wpgv3dHLYQrHmtg6ZamUamESM4FxfEJCROQ1iaR6PnPZMofEq8QBCSa5F1LWrUooVB3jusqG6 T/iqGrA4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CzR-0007JN-7R; Fri, 21 Aug 2020 19:46:17 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxj-0006Z8-Cl for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:39 +0000 Received: by mail-pj1-x1042.google.com with SMTP id d4so1246018pjx.5 for ; Fri, 21 Aug 2020 12:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DuU6+2YeRUFxWKjj7Z5/wAYkCT2n/Otc0iy3c5gDK6c=; b=GlR5zQFUZPyZN2xj2JZwbsd+nhmW4YrsAiNDspKlZSHIVFCaiwpu22zpQk8g1mPkD4 uL0gfTyd6RZ41fhOBJ8O7qPIY2yarQAieyWySyZtzw9F84HAFF/dGTHkR8qjcoeeFhLR kxmlF5bkG7LX0OWEqpt9f6F/IKJimzW3fMjFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DuU6+2YeRUFxWKjj7Z5/wAYkCT2n/Otc0iy3c5gDK6c=; b=JfZKxsrvc1m3iQSYvLHV7EkY3lkqIv4ol6rglAHIRccqwe8sgC7O8NqRQivKySj24B dWxqtWNyyZS3G7MVnhr3wK0WgzkXNZW/AUTkKCIA7zPIzJ9Hk9xFnQsAJ/yNTWa9g6Xy fZBKWGzaFkrtC5eSCCNZ++h22y2v3bLssp54wgMzTsKgryeOREmxojKROugrUTZ6ZOsx W2Q13VeKltVkQKI2XyBRXjEXCx2fZCU84XPbYJkHMO7CWIM+sTHStPuBxnzr+TMakdEY GqAZWNo9A+QxytvZdk2TEt8iftihVv3a8SZ+FXE/Kxg0JgdJ1NP1lnykeAGwtQ5uZJ0g Uzmg== X-Gm-Message-State: AOAM531D7ZNR3OeJSFreoHoI7vSvcy1mtbqLIapUj8rcsSeU0QHs3X1V 5dxbPEM/KI7Q5Ja3Xwj5v+q9hQ== X-Google-Smtp-Source: ABdhPJwhqJDgxru2YIkrhKiac4wFZ7e/7/Sgw8YpVmg5RV/C1Br7xa8dVv+HqKXZX/CaKWJr+nVfqg== X-Received: by 2002:a17:902:b686:: with SMTP id c6mr3542403pls.133.1598039069315; Fri, 21 Aug 2020 12:44:29 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h5sm3442830pfq.146.2020.08.21.12.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 11/29] arm64/build: Use common DISCARDS in linker script Date: Fri, 21 Aug 2020 12:42:52 -0700 Message-Id: <20200821194310.3089815-12-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154431_482274_E4993B24 X-CRM114-Status: GOOD ( 13.86 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Peter Collingbourne , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use the common DISCARDS rule for the linker script in an effort to regularize the linker script to prepare for warning on orphaned sections. Additionally clean up left-over no-op macros. Signed-off-by: Kees Cook Acked-by: Will Deacon --- arch/arm64/kernel/vmlinux.lds.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index c2b8426bf4bd..082e9efa2b43 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -6,6 +6,7 @@ */ #define RO_EXCEPTION_TABLE_ALIGN 8 +#define RUNTIME_DISCARD_EXIT #include #include @@ -88,10 +89,8 @@ SECTIONS * matching the same input section name. There is no documented * order of matching. */ + DISCARDS /DISCARD/ : { - EXIT_CALL - *(.discard) - *(.discard.*) *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) } From patchwork Fri Aug 21 19:42:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730385 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F04C413B1 for ; Fri, 21 Aug 2020 19:46:38 +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 CAE5B20738 for ; Fri, 21 Aug 2020 19:46:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xU07DDWN"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="cEhj/1dX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAE5B20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=i1bAxHU2ffVdhaxF+yM8VeFMd2w9HSm4GL49xlmk66I=; b=xU07DDWNiKyUDUIrddLPM9DI/ GDFRnhB5Eq7D1wpok2Qhz/CDFx2iP1HaXHwKpIyLjMBiR30kSC8sB1qr8vUSBv20fqvI5aGDc+yc3 /wrcy7Zn3AbEOYXccEq/RoMZ5EtyVwMvKeKzpmZpjlh2De1bs98F1Gj+/siPLCPe4QPE3AxL32PwA 4YmUkZRJIxR4tRWXJqk71VjSrSakh3oOSb9Xp3mtKc7YIhEw1YeDMaUFZdz9smb8ooIFlZ8laUKrr oYgkdrWwo/lwN0LwA+E/sIIfzTeZpmDK+IrAb4QUIM3sU805kyhhYyHn+oOayhBPIADWISqFK29Fi FeWhRxBzQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9CzW-0007Mt-Lp; Fri, 21 Aug 2020 19:46:22 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxk-0006ZN-1C for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:39 +0000 Received: by mail-pj1-x1044.google.com with SMTP id kr4so1263470pjb.2 for ; Fri, 21 Aug 2020 12:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Iyu1hqfWZF/Rprc+orVpuMlUtMs4mrBdsJ6TcxbP7dg=; b=cEhj/1dXziGzNz3rzCPAyy+0VKr4B6ufAh5DgKVx30rzDGb14ve/eXfOAOHLNwWMoJ CdTN2XCZlucbNHybqLceeWOXF09o+ktLiVPykM1lpIJxxYeBbq0GUTQ6Y8QnLr5f8mJp 2Oh+xOILfK2AkARlkRq0fbM9ZA6auqArJxZb8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Iyu1hqfWZF/Rprc+orVpuMlUtMs4mrBdsJ6TcxbP7dg=; b=YbStt1FMN090utV+hHy7JGLWAFnn0RbRzLtU5F780ZHtNyaVinxuT+4pXgQW42RFJ6 E1ijMnml8fdO4jJ5pty0GUPs4hDnb3lGHeeloJ5iQig+dqWQWgGTzpQz6HmwCDszu5EA r0V6UcvsXEQZBe8FJcqU/Ro6gcPE8u3PODNF1ThWvXDn0MpthNgXE1+3P0ZHWEtmlupz duybR8IiwvLGXAvi2V4HVo+y/sWq/rIHUvcpiuTizPIlEnIPwAT/S9m3RBRkUFaq7dh3 5edS3h5MoN4U9Mi91kAOFNJYLpHBRm6bQ2TA55hmOHk20Dpbt9eVaLMyoR+jb35ejB8q koGA== X-Gm-Message-State: AOAM53056svZ/pGywrY1W5wC3G/1tGM3O4TCBHv4dHav81Vx6zuQfZ0d UiFzdTvxzx1CqHcUQ8P3cz4Vjw== X-Google-Smtp-Source: ABdhPJzpIJZx9fWtR3JYrT9Hz00IB8Bbc5lbvCNlSB2U5AhmKzx1WV+9QjdpbeHcGVcZ/7aFyUdG+g== X-Received: by 2002:a17:90a:9d83:: with SMTP id k3mr3788859pjp.19.1598039070005; Fri, 21 Aug 2020 12:44:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z9sm3224171pfn.59.2020.08.21.12.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 12/29] arm64/build: Add missing DWARF sections Date: Fri, 21 Aug 2020 12:42:53 -0700 Message-Id: <20200821194310.3089815-13-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154432_155402_FD3BF71A X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Explicitly include DWARF sections when they're present in the build. Signed-off-by: Kees Cook --- arch/arm64/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 082e9efa2b43..16eb2ef806cd 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -239,6 +239,7 @@ SECTIONS _end = .; STABS_DEBUG + DWARF_DEBUG ELF_DETAILS HEAD_SYMBOLS From patchwork Fri Aug 21 19:42:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8EC9138C for ; Fri, 21 Aug 2020 19:57:14 +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 8FF7E20724 for ; Fri, 21 Aug 2020 19:57:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O8jJ3R4P"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BjCkHROY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FF7E20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hPcx7SnULPeWgadBvGcd2SxE9IKwvTlZEARA5pzO6wg=; b=O8jJ3R4PW/cucMlaXpo7pWUCW 4wUm+Kcb8SsatmJoUbIheH1aZOs8wiaUAhQ89YhL3BkKlyejUanC5dBRjcVGv8CJDPdEm01D7w+9m EDufCfRxwtlzjjgek/7Ht9FSpVgWKuWGWb5CIKRdf+M4sfG/Uo4lBHtq+Svnp/a/z0REr+f75kc47 FURO9SlErs0fqiMt2ChQg5K/AXBjnnQnJOT3PtPYu6b5ngsMLq4d1PWOXVguKEkQtHXGTaJn1VzzR Vt7EAgdzuQvmRQ8GLsIfH5uu3fH4U5g/6DupX/0yqp6xMuFsfGJCcSRxD6E16BDKUrfPCDp+34w05 Fddf7nL1w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D8W-0003jV-Gg; Fri, 21 Aug 2020 19:55:40 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D71-00038F-Tg for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:14 +0000 Received: by mail-pf1-x443.google.com with SMTP id m71so1590957pfd.1 for ; Fri, 21 Aug 2020 12:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RsnjhsnTEGM+Cj4mkGtPoVyQesfOultuLxrGhrBG5/A=; b=BjCkHROY2CmoPNZCfAPOetFdIvdym0/mRthIj0PP/ZbxWLiS1o8kmsIYg0iFHhWFr8 A1Ch9dHodBjR4Kgfc/+/25Zi2M2gQZpGoSfr+Pjwhdw6LLPfKoFH3OIlxQdx816GQUNA NreqRzvr9dx2ItAUVHWMIgobbpacT3nHTvf3A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RsnjhsnTEGM+Cj4mkGtPoVyQesfOultuLxrGhrBG5/A=; b=EwbwRy4qRMp45/jFw6Eng7by1eMophSb08JhDPWsa4LYcWFi3m+rMhAN4focChZvzf XC2yLL1Sm93T3cwdC8o9iE5TcZWHPuhBXYrYmxOxcAPGz/z3qnHi7Po63nQg8rNJkI5j rYq+wi6lPz2LEenZqSDOaGW2JTzeW3jT+qo+kLZCEKaSV3T8HyJy+5h4e7EKGL+OZtXw 63FpMj4LgYc5EanTWkmKWmqyvWQoaTe3XzIx83EwVoGhtGBgBc6q3eyiRZ8xr/ppv+dE lrrX3mtjvey9H1SqyuHv7cJwNvPSD+cfgWr67SgFtLix0WouGCtqvrjLLUa+kNNJ7N7D xmXQ== X-Gm-Message-State: AOAM532UM52uxOUgjnW9CCZG/ZTyy6qHcVpAbGM61qjLLFJwDCGROcFJ hUVV9ApbHbFrQBVug7SzH0batw== X-Google-Smtp-Source: ABdhPJyPCEIQonjaCu7PamGqZDSgUVRQO30q/exO3L7q+oKI5u+eXQ3pQsbPZBczuMA9B/OknhGw6g== X-Received: by 2002:a63:2809:: with SMTP id o9mr3518924pgo.410.1598039646154; Fri, 21 Aug 2020 12:54:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r15sm3651023pfq.189.2020.08.21.12.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:54:02 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 13/29] arm64/build: Assert for unwanted sections Date: Fri, 21 Aug 2020 12:42:54 -0700 Message-Id: <20200821194310.3089815-14-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155408_027501_75A316B5 X-CRM114-Status: GOOD ( 16.11 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for warning on orphan sections, discard unwanted non-zero-sized generated sections, and enforce other expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Suggested-by: Ard Biesheuvel Signed-off-by: Kees Cook Signed-off-by: Anders Roxell --- arch/arm64/kernel/vmlinux.lds.S | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 16eb2ef806cd..6ccf19fd2b39 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -121,6 +121,14 @@ SECTIONS *(.got) /* Global offset table */ } + /* + * Make sure that the .got.plt is either completely empty or it + * contains only the lazy dispatch entries. + */ + .got.plt : { *(.got.plt) } + ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, + "Unexpected GOT/PLT entries detected!") + . = ALIGN(SEGMENT_ALIGN); _etext = .; /* End of text section */ @@ -243,6 +251,18 @@ SECTIONS ELF_DETAILS HEAD_SYMBOLS + + /* + * Sections that should stay zero sized, which is safer to + * explicitly check instead of blindly discarding. + */ + .plt : { + *(.plt) *(.plt.*) *(.iplt) *(.igot) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + + .data.rel.ro : { *(.data.rel.ro) } + ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!") } #include "image-vars.h" From patchwork Fri Aug 21 19:42:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 598E21731 for ; Fri, 21 Aug 2020 19:56:53 +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 3321D20724 for ; Fri, 21 Aug 2020 19:56:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ICFl8nYA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="R1LdeZIF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3321D20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nX21WxRgRHm0oejxGnLgywsj+WBZUuv6mtZHfCEG4TM=; b=ICFl8nYALH2arhcF4ZCpxgGnt O0o1B2NU/69otmqqOztLzfLI24Q16Su3/pT32YHC1PB1aMFwUsZsEhtPlC+ETpTfWWKX3x++wzMk8 SqcoiA4uPjnh380FVNIkClw8tidNSx0hh1VyjThrNxoIsO+HAR0nykbq+NAdbPIni+fMQE8AK6tA+ rST9cqs6EwF+lXJzXi0hL/M5PKlT5G+vZkYNlNa/5uJ4WPMmUnoviLnz66UV5UpLlYTyWNvL/lMiU pbEGYDS+vwPH54k272NecJKVPhsqaM1H7ioth/ntD1wbwOamSE+c0h3Qf+2xi342Q5ZOFqg+6KlLx pmuBtELkg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D8A-0003YB-53; Fri, 21 Aug 2020 19:55:18 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D71-00037g-Cm for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:11 +0000 Received: by mail-pl1-x641.google.com with SMTP id bh1so1340493plb.12 for ; Fri, 21 Aug 2020 12:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SwQmKOlsNP/z38IYejjYj+yvvrS1Eywv52+2HVAlv9Q=; b=R1LdeZIF9QjkB4RICKULaFwrCsS1XuI99/vuiq4cUyDFMXBxzUFujL6oWyYM2UH1nh tWsZAtfxgGw6HkqEKt7TA3Ijkwr1LM5uL39F+VTZxX20aJt3RSZikDLByfg7RB4zZr5x 8gQzvir0FqNAzAZV4VAGlv9FBJ+2iKZA31XYI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SwQmKOlsNP/z38IYejjYj+yvvrS1Eywv52+2HVAlv9Q=; b=jz2DDhuc1SBp8oB2Co89s9HF9VhiM6MELA8eAhA/3EQPQiV4AAscs2o3IZ+LEBMA9a GrSfFEE3TyzQwSZKkWWoeUEj0AfIo7CgTmu4WDaqXi4xrKdkDELVW8+ZtOj4CQ4/TeIN gv23SF88VNm4uY8M+jG80aQ/55ImvSakqdOFT1lL4YvI1WqKPXwyCm8Lgir2Dm+kb4nn B5w260FJNldeMwFoFlYetiUSe1T5NfqKNkhmjxUS4M2sxZ8fTz0MJ673YA2aY/J6A3sS cc/aRuLcQ8pPL/HQ/5wItGJWqojD8klV32+bHqYTJFVghRzo2kpIXrJNwcdhRPU0ihRs z/eQ== X-Gm-Message-State: AOAM532jLB1drltPXgosi9JkZ1Cv5salGXgeYmBQo0A+Xj1X+aCkKtTZ CkF146iYXIXJhYSY2w3BbNdhmQ== X-Google-Smtp-Source: ABdhPJy2WKMv8VZqejr2E0c2Supk2WQRHgcBJPLIvDE5jyc3fVqM70J7mGGAwnDLjFOWQ8g7AvXYxw== X-Received: by 2002:a17:902:9a43:: with SMTP id x3mr3388759plv.31.1598039645460; Fri, 21 Aug 2020 12:54:05 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z77sm3469389pfc.199.2020.08.21.12.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:54:02 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 14/29] arm64/build: Warn on orphan section placement Date: Fri, 21 Aug 2020 12:42:55 -0700 Message-Id: <20200821194310.3089815-15-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155407_491931_D9349840 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Peter Collingbourne , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly handled in the linker script. With all sections now handled, enable orphan section warnings. Acked-by: Will Deacon Signed-off-by: Kees Cook --- arch/arm64/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 6de7f551b821..61a46f56ff33 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -29,6 +29,10 @@ LDFLAGS_vmlinux += --fix-cortex-a53-843419 endif endif +# We never want expected sections to be placed heuristically by the +# linker. All sections should be explicitly named in the linker script. +LDFLAGS_vmlinux += --orphan-handling=warn + ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y) ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y) $(warning LSE atomics not supported by binutils) From patchwork Fri Aug 21 19:42:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730405 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00EE613B1 for ; Fri, 21 Aug 2020 19:48:41 +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 96E91208DB for ; Fri, 21 Aug 2020 19:48:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pjIGVj+l"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NyTgbCze" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96E91208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2q/cP5jG+NOJ4txNGngd6la+Qhg373Hxu7L80nbp25Q=; b=pjIGVj+lEdj2WQPSW6IiJaItS RBzQIIMiO7FoE1HNdvx3gxVLvJM8lLCyT23hSpBdgOuVw5Zmx61MoLMEqKIaNiJbayLXe4QhakDQU 6rZEVmPqKyslab0Yw7IZpvH76DSUunuRx9BmCmNzTVrg8s7/wLjde6PbyEbyou64xb8cytelUkFbL aFJ9I+BItpnyFJMyLnG6z1v2fIVdpzgD/ZADAdJcYHSgd3D0hVnSWhZwZl9VJiGFe99Y/qm36GoA7 XvZrVeLOdPQi/KmT4dGxP6FiPuSp/aGq28IibEbSpR80ISiTVzhICnEkgiwRZ9EEzjS3Hb6J9bLlE 7YHJQi0Hg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Czd-0007Rv-42; Fri, 21 Aug 2020 19:46:29 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxk-0006a1-Dl for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:40 +0000 Received: by mail-pj1-x1044.google.com with SMTP id n3so1152251pjq.1 for ; Fri, 21 Aug 2020 12:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aNMQ3F5q4g/Uk/+s5Q6WGurCwVwunmhXKYzGhkTYsIo=; b=NyTgbCzeEp1ym59DR/QNoKj0uG9hbvo/o+utcH9r4Kqq9qDleAjXl0OOU+wa72oid0 FrDeaXspf6qhKYOuNZye4L/12pgzRr6iZoEOwV7U/CjWa9fCFKPcsbBgybjxujpqjzK7 J1y+nrPz7erQ0BcWjuHUvdi/5/c1Bpagd89nw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aNMQ3F5q4g/Uk/+s5Q6WGurCwVwunmhXKYzGhkTYsIo=; b=fRdL+e11dqzm/1iUr9M2eie3jQg1gPfP9HFmB9WNgdqUl/f2yM80YkywwnzeYfQeEz eB2D1TgEQohS3BeaK/FDjeVpJBpVv3DykvMOKdZ9ArVE975FTf3eJqwuu0WDDUcLB3wK 9UsMtC03o7ZWjMQoQY+IvBuuw8zg/HIJttXWWnNd4sRNG27dx9r+7ew8BPIiMdDOfjVx t7Wc4dy7kxcTbl4GYPDkvuQidDMZTXnFnX1+AehLj1Ry5FNvSpTW6jpNa3bUk0u9zRiK lkLw6wYFeoX5cae979yTJAwcEJrAUXULuxG5MhTRocl4fa0E78fYFIimO9RnZiZLHFJe ucFw== X-Gm-Message-State: AOAM532Kdk7th+1+b0femXNyEegyNSSNOIS/znuK3EpDUYLrBJzRHWCy oOzWrfGWBA/LjilBSev6V8e8aw== X-Google-Smtp-Source: ABdhPJwx2k11/u4a4HxHG8VAxnrqER3e8md8d+tJb6KWY7SBST29tpxto+MAjoOMhPh2+M9prsPHmg== X-Received: by 2002:a17:902:c181:: with SMTP id d1mr3416243pld.296.1598039070655; Fri, 21 Aug 2020 12:44:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u5sm3268710pfm.149.2020.08.21.12.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 15/29] arm/build: Refactor linker script headers Date: Fri, 21 Aug 2020 12:42:56 -0700 Message-Id: <20200821194310.3089815-16-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154432_550430_B2434967 X-CRM114-Status: GOOD ( 15.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for adding --orphan-handling=warn, refactor the linker script header includes, and extract common macros. Signed-off-by: Kees Cook --- arch/arm/{kernel => include/asm}/vmlinux.lds.h | 13 ++++++++----- arch/arm/kernel/vmlinux-xip.lds.S | 4 +--- arch/arm/kernel/vmlinux.lds.S | 4 +--- 3 files changed, 10 insertions(+), 11 deletions(-) rename arch/arm/{kernel => include/asm}/vmlinux.lds.h (96%) diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h similarity index 96% rename from arch/arm/kernel/vmlinux.lds.h rename to arch/arm/include/asm/vmlinux.lds.h index 381a8e105fa5..a08f4301b718 100644 --- a/arch/arm/kernel/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -1,4 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#include #ifdef CONFIG_HOTPLUG_CPU #define ARM_CPU_DISCARD(x) @@ -49,8 +50,12 @@ EXIT_CALL \ ARM_MMU_DISCARD(*(.text.fixup)) \ ARM_MMU_DISCARD(*(__ex_table)) \ - *(.discard) \ - *(.discard.*) + COMMON_DISCARDS + +#define ARM_STUBS_TEXT \ + *(.gnu.warning) \ + *(.glue_7) \ + *(.glue_7t) #define ARM_TEXT \ IDMAP_TEXT \ @@ -64,9 +69,7 @@ CPUIDLE_TEXT \ LOCK_TEXT \ KPROBES_TEXT \ - *(.gnu.warning) \ - *(.glue_7) \ - *(.glue_7t) \ + ARM_STUBS_TEXT \ . = ALIGN(4); \ *(.got) /* Global offset table */ \ ARM_CPU_KEEP(PROC_INFO) diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 3d4e88f08196..904c31fa20ed 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -9,15 +9,13 @@ #include -#include +#include #include #include #include #include #include -#include "vmlinux.lds.h" - OUTPUT_ARCH(arm) ENTRY(stext) diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 5592f14b7e35..bb950c896a67 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -9,15 +9,13 @@ #else #include -#include +#include #include #include #include #include #include -#include "vmlinux.lds.h" - OUTPUT_ARCH(arm) ENTRY(stext) From patchwork Fri Aug 21 19:42:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96F6A618 for ; Fri, 21 Aug 2020 19:46:11 +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 7032A2072D for ; Fri, 21 Aug 2020 19:46:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SaW9mnBE"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dwH4hSFn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7032A2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=scBNER4zZC/YJQv8U+HvyQp7Cq7gE2lPIR+ncOf97q0=; b=SaW9mnBE5TXzuI4CbHQnZWi5D b3Mkl1GEgi9JE+j1/wL0lTnYX5kxHwL9UZiRM4NYHzMU7k9XcO4xMpzyCrwr3ErcDXg/5q47bTMoK qvoNlNvmtF5cPBvqq5WJbua1MXXqwJzRP21POw1bDKZIX5cdDocKSVEp7aUX8pPX4xH5Y9mcG2WSE GTbQTJI9yPhqBLy+hYiIuoCZSHqRJK0MTgI1vRLjNn2hXtbJ/sAfkSLA6iOIswiRpWfvMDEjVBrqK +kd0gx6HMTU2vokwH/MAcnyfe6YSbztjiaRBjiqLkkrHfYPUkpZXZI6x/196CdPQmjHotRT/OH0+n 2dMjWBBpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cyw-00073m-PV; Fri, 21 Aug 2020 19:45:47 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxh-0006X9-Kh for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:35 +0000 Received: by mail-pg1-x543.google.com with SMTP id s15so1467149pgc.8 for ; Fri, 21 Aug 2020 12:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5FUB3tjALH2XvfA6zdfdUjwI0GuDEI1l9XpW++dZco8=; b=dwH4hSFn+M/JShOAvoDuz49SFgRTdFlTWo6hGZr9AwLMcNzDM8CCErZhyY7e1uO/Xx uqiHf1O97j60Dk9p27VnNcHgm3AvxP83RVdw0qpFJ6YHuX6CzA2/zf5uWMROb5mfhFC6 0KXGu5Y3b4E5gPfjCLnwSk3EL5h0NSoEoS0pw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5FUB3tjALH2XvfA6zdfdUjwI0GuDEI1l9XpW++dZco8=; b=qPqUZBF5+A3OmVyzlwXYIcUkwL1TlDOxEyMYJzBNEO/pUiTeha8kMjnj0mjH5eBH2d ob1EVACEsfQuHyxWRn6d1J6eiwfaSj8udwcJqVt/unEItrd7u4nA6l0g4tYp1qpId6oR /V+/QWNELPIcF9DRKaDarLogT3aPMGWgZNIbsQS79/6fCm/D/JkFMLv3Vjj6g9N+qo7i IZKUM4LvNXOPjWymo3O6o7VX4tUYCKZ6FQTugOXM3PbhgQmfcawF5p0HoSzonVXQf5OZ 0BeidwGqKBpWRwy0+dlQT9iu4qDGGinNQeFt0DpB6d6ih6ulq6AQwg9UT50txyZGYDRj dKkw== X-Gm-Message-State: AOAM532IsSU+imJBWvPbGnskNp9xy92T7gTAiEJcHaLx1Q5rJDOooGGI sX6i5yHlAI6fprsTlg+FPVFaDg== X-Google-Smtp-Source: ABdhPJyehd01pOgX4gGLWRe5I8XmNR/SFexjrkeURt8pREiENkcrce1cR+99MhoC96hPn3LnwhjcIA== X-Received: by 2002:a62:2ace:: with SMTP id q197mr3509274pfq.77.1598039067613; Fri, 21 Aug 2020 12:44:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u14sm3393575pfm.103.2020.08.21.12.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:27 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 16/29] arm/build: Explicitly keep .ARM.attributes sections Date: Fri, 21 Aug 2020 12:42:57 -0700 Message-Id: <20200821194310.3089815-17-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154429_773207_657675CD X-CRM114-Status: GOOD ( 15.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Fangrui Song , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , linux-arm-kernel@lists.infradead.org, Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , Arnd Bergmann Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for adding --orphan-handling=warn, explicitly keep the .ARM.attributes section (at address 0[1]) by expanding the existing ELF_DETAILS macro into ARM_DETAILS. [1] https://reviews.llvm.org/D85867 Suggested-by: Nick Desaulniers Link: https://lore.kernel.org/lkml/CAKwvOdk-racgq5pxsoGS6Vtifbtrk5fmkmnoLxrQMaOvV0nPWw@mail.gmail.com/ Reviewed-by: Fangrui Song Signed-off-by: Kees Cook --- arch/arm/include/asm/vmlinux.lds.h | 4 ++++ arch/arm/kernel/vmlinux-xip.lds.S | 2 +- arch/arm/kernel/vmlinux.lds.S | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h index a08f4301b718..c4af5182ab48 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -52,6 +52,10 @@ ARM_MMU_DISCARD(*(__ex_table)) \ COMMON_DISCARDS +#define ARM_DETAILS \ + ELF_DETAILS \ + .ARM.attributes 0 : { *(.ARM.attributes) } + #define ARM_STUBS_TEXT \ *(.gnu.warning) \ *(.glue_7) \ diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 904c31fa20ed..57fcbf55f913 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -150,7 +150,7 @@ SECTIONS _end = .; STABS_DEBUG - ELF_DETAILS + ARM_DETAILS } /* diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index bb950c896a67..1d3d3b599635 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -149,7 +149,7 @@ SECTIONS _end = .; STABS_DEBUG - ELF_DETAILS + ARM_DETAILS } #ifdef CONFIG_STRICT_KERNEL_RWX From patchwork Fri Aug 21 19:42:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F262A618 for ; Fri, 21 Aug 2020 19:48:53 +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 C97F0208DB for ; Fri, 21 Aug 2020 19:48:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fab6OKWK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="hSwetOEX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C97F0208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fQraj4PUthaQbt/UfIzLEwmEBM2sv2xCJsskufKRIks=; b=fab6OKWKjAflJZplOq52s9JQ1 lUFZ+kgcxvQPNaxpQbtemgWmaWoFf79Nlh5Csx9Ff8PSl1P8AS32ZBOPMAXgP6c6munmcJx2jAdp2 5k4Qpm7tQFuMCATpaF/ZykM8D6djoFZlukxDsOarNysNS3Wsz5+cAK7qr2ZPRLgFvP4eqYF4CEZMS fB1w79t42e43SY3jZ9h4ItZ6lGx+AYIbcfg5ExAqkbbfv6oSBiJkW9XYWYZjXnNYQ8qLT3P1XVVob LHeRs0J7iegpI6uTux7piIFlmuIoGKpRjl/F63TZSd7joHxBXCAYRw6Bqrn/lNoGwLb8fOXmgtASu H+qHByK6w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D02-0007hd-IK; Fri, 21 Aug 2020 19:46:54 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxm-0006bK-Cy for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:42 +0000 Received: by mail-pl1-x641.google.com with SMTP id g15so1337059plj.6 for ; Fri, 21 Aug 2020 12:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j7Lys61YjFpfMX3OTBjlFH6rsXYj3ZGDYGY4DwTK5Rs=; b=hSwetOEXXxyxeqO2If++xh0K5ka/8LVM4nGggu0hSfsYxPm6EElfkKCKJXvMPutNd2 +nEASJBRgtVPVNXEsdkY2ic7EKx+blKB8AzP2lSSIUTBVYnSjMvenCFrH6X5tNxRdcSy u0VnAuKKc+tad0YmxEFMvwCtQ4NCnqkFN296g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j7Lys61YjFpfMX3OTBjlFH6rsXYj3ZGDYGY4DwTK5Rs=; b=Uv3WHnKE5zuftmeq4N5iPJiyaYHy005/i1UOFbUtmP+kQUFf84AvuCbc5qAPQN+/TE mTLqL0JRMW4g/PMqrHl6bm4PdiIVpVgrohe0Q7BjoDaH4gT8fBgv5HsvYtwlG+YDd0qm 0Plvj+xFF6poejkPATFIXHRcAmuTqj40f6o5afT3XuUUge/yb7nXfR7YXVXShIKEe65Y PPh5iwmduD7JiOo8QUdDWlU5otOIw8kt45BNbU6gYi35lngqnmupMlgyrTIdMFUo3H2W R5b75FmGRLqqRFVOBl60MPaf6Dk7bx6PAWap9iestbtS+O+UZzTuaiJwITUO+PdzJRHb xhxQ== X-Gm-Message-State: AOAM53338w35tCMKfrj5TblrIt4z7OFAoJvXMNDYpH2JCKLmPFJrjV/P drcMMLGO2whKJchdb04S8Nu1MA== X-Google-Smtp-Source: ABdhPJwFMRlTYY2KYKppAuaQC9yLtjntKg85fiBsI+6m2kKPSyZ8YXZJFboskYZxMwNbk8lwKTO2kw== X-Received: by 2002:a17:902:8d89:: with SMTP id v9mr3489157plo.289.1598039072600; Fri, 21 Aug 2020 12:44:32 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 207sm3467672pfz.203.2020.08.21.12.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:30 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 17/29] arm/build: Add missing sections Date: Fri, 21 Aug 2020 12:42:58 -0700 Message-Id: <20200821194310.3089815-18-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154434_581567_431008EF X-CRM114-Status: GOOD ( 15.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add missing text stub sections .vfp11_veneer and .v4_bx, as well as missing DWARF sections, when present in the build. Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook --- arch/arm/include/asm/vmlinux.lds.h | 4 +++- arch/arm/kernel/vmlinux-xip.lds.S | 1 + arch/arm/kernel/vmlinux.lds.S | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h index c4af5182ab48..6624dd97475c 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -59,7 +59,9 @@ #define ARM_STUBS_TEXT \ *(.gnu.warning) \ *(.glue_7) \ - *(.glue_7t) + *(.glue_7t) \ + *(.vfp11_veneer) \ + *(.v4_bx) #define ARM_TEXT \ IDMAP_TEXT \ diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 57fcbf55f913..11ffa79751da 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -150,6 +150,7 @@ SECTIONS _end = .; STABS_DEBUG + DWARF_DEBUG ARM_DETAILS } diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 1d3d3b599635..dc672fe35de3 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -149,6 +149,7 @@ SECTIONS _end = .; STABS_DEBUG + DWARF_DEBUG ARM_DETAILS } From patchwork Fri Aug 21 19:42:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730391 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB238618 for ; Fri, 21 Aug 2020 19:46:59 +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 A3FE920738 for ; Fri, 21 Aug 2020 19:46:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Dxfu3YpV"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GF8WNGGb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3FE920738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=a5awlCvQ5F8JmMiMdHRqAWLr4pPSosvqv1d/3QL6VBY=; b=Dxfu3YpVKJxmPMCw/fZgAYZtx kBZTtV1yP2au2/dyodFLOhwcQ+eb9Mxpl+8g9V0rFRPEk3gDm6oWFsi9HGXcTXe2pj5xMhrHd39eB sFrw1AF8B94DEumObYYoYLfQw2cxBFgZ1BAKatrCRl6dUgBuk1OoWk/F7q2eJS1/y8f7Y/AMQJ42I NAvAn+vXB+C3MlGn97CKnET6PAaibfDhuoOFBE90+BnSz+Nb6a1n5A/928UYCOO57p0pDhv7ep5zc 5m2GpfjNpCZulrpbbdozQfVu0PrM5/XgoaYP1chimp3brblbI+OiAVKDAdZ6UcBnWvva0E9RWCguL 3C0FiBc+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Czp-0007XX-CG; Fri, 21 Aug 2020 19:46:41 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxl-0006aL-5J for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:41 +0000 Received: by mail-pl1-x641.google.com with SMTP id y6so1344743plt.3 for ; Fri, 21 Aug 2020 12:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2SO+UGcbCrLenHkErAflqsGtJX/MLOFJ7NqTGBJ73x8=; b=GF8WNGGbz0L91U/cKK8hFCLiRU4GwBwG4dOQCTOrpJCd24QY/0vGi6vnGJMoYwqo9j tg5x5+RDELdR2JEO4trH7JtQZw3eWL1PnG0VNMUjRiMWm8/9k2VtuwglST1tWIBAWTS1 P+x+GSWOlYP3io7XqFUjxcgSnBkW/qZP7U2eY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2SO+UGcbCrLenHkErAflqsGtJX/MLOFJ7NqTGBJ73x8=; b=rkZov+qwcRuNylS98dhgMVqovENia5VsZ7t7RMBygj+p6GZFIZlJBSFRoR7A2gDuSy i7yXcWraUCW+Bjcweqa3U5XgIPMK5qrZKcBBsSSWvrn8+z0wdFHhhZxd3C7gDJEPwcxh KvDxyIoR5JkA1Kdgm9poWF619i0e61mT0An+LiC+ulpiGUh3kwFxlBbiwXU0mNHlPcNv kQKcPOSAv6CWXOkkrTq3/933IZ2es+eRky9UzBXxJAODiRG470x2Ge5Rh6fm/8lGsAqk FGasuw9UXso0vgkdw9T4J/lqvSxuUFWTeBndl1MUNFCAPpOmqSmz8NGFjFRz+LphkP6U Z6NA== X-Gm-Message-State: AOAM532XhuchMumxu5Q/yBZdheQrzFtz6MooM1vjP9yi7465ervCppcj 4vzFxa/lmHLcAEadmvAKz9oiBQ== X-Google-Smtp-Source: ABdhPJzikcTbC/fNRsbXZsG6J+yKOcBq9l6HMfMb0yjrQqmgOT0JeBslBYouM6YVYP4aQU9tg4bQUA== X-Received: by 2002:a17:902:d691:: with SMTP id v17mr3392145ply.235.1598039071121; Fri, 21 Aug 2020 12:44:31 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o66sm2795858pgo.25.2020.08.21.12.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:30 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 18/29] arm/build: Assert for unwanted sections Date: Fri, 21 Aug 2020 12:42:59 -0700 Message-Id: <20200821194310.3089815-19-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154433_296114_2BD84A47 X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for warning on orphan sections, enforce expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Signed-off-by: Kees Cook --- arch/arm/include/asm/vmlinux.lds.h | 11 +++++++++++ arch/arm/kernel/vmlinux-xip.lds.S | 2 ++ arch/arm/kernel/vmlinux.lds.S | 2 ++ 3 files changed, 15 insertions(+) diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h index 6624dd97475c..4a91428c324d 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -52,6 +52,17 @@ ARM_MMU_DISCARD(*(__ex_table)) \ COMMON_DISCARDS +/* + * Sections that should stay zero sized, which is safer to explicitly + * check instead of blindly discarding. + */ +#define ARM_ASSERTS \ + .plt : { \ + *(.iplt) *(.rel.iplt) *(.iplt) *(.igot.plt) \ + } \ + ASSERT(SIZEOF(.plt) == 0, \ + "Unexpected run-time procedure linkages detected!") + #define ARM_DETAILS \ ELF_DETAILS \ .ARM.attributes 0 : { *(.ARM.attributes) } diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 11ffa79751da..50136828f5b5 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -152,6 +152,8 @@ SECTIONS STABS_DEBUG DWARF_DEBUG ARM_DETAILS + + ARM_ASSERTS } /* diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index dc672fe35de3..5f4922e858d0 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -151,6 +151,8 @@ SECTIONS STABS_DEBUG DWARF_DEBUG ARM_DETAILS + + ARM_ASSERTS } #ifdef CONFIG_STRICT_KERNEL_RWX From patchwork Fri Aug 21 19:43:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A69A618 for ; Fri, 21 Aug 2020 19:54:22 +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 22CCF20724 for ; Fri, 21 Aug 2020 19:54:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gs8iVZeq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MOtH6g06" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22CCF20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qzof/fhz5BrSYdxb0ugaGU2r5MlioDzmOKBJk0RIZEI=; b=gs8iVZeqDl7n/N7eG0Hq/AtND RETrfflVIJk1yy4rujKlNoEstNvyCrOuw+iumS/ULXGBusiYBkCYAKBD5Lc6hRyxuFYVPu8WQApGb x/gSY9YwGTlOSpqrZuusigT0Xs8smOXd2lrCakWhaLRhPvKk0VQ50x8C2k685fUKM1dgEGTL+VHCJ ZC3D73baDtWMtUPpJ+Y6p/uyYPtfOsJxho78Yr3jJTLrZhnFLaYBd0Z3ADqSQ/rjHylGVZxFAIECI nbzvjuOwJY9TjCnK5N8IjPucgt3sz8TZMViwoaHt+CI5xcAqu3ZRvznxT/n8rdtpFnihL5eIKkWzA acmbmzIAA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D74-0003AJ-Ci; Fri, 21 Aug 2020 19:54:10 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D6w-00033g-SN for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:03 +0000 Received: by mail-pf1-x442.google.com with SMTP id f193so1564939pfa.12 for ; Fri, 21 Aug 2020 12:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cKGWDIrBEs2dh6Vx6JHQWt/T3ziuaJ6+D++qA+lLK7w=; b=MOtH6g06WVQoxhMiwvjXdIDUiCnhNQLZstpkLeL0aigF1WIuztgjF/SOV6mc40YW8E wDHh058AHq5ePmSwdD2DjlRGgSmRaxVSd4mi0Zx9sor/UExqSvQ8V/L8d0p9DL/TQe7y p5lo8dxel2Zghjrb75dYwEndSMILJRoFoM+74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cKGWDIrBEs2dh6Vx6JHQWt/T3ziuaJ6+D++qA+lLK7w=; b=MlahpTiv1BOl9hleyWS+N3epxpgftT0THs3WNVUaE8hofVM8y/rfQ0dlJLZadUlLM4 wEolyZ0YGsOTbawqoPp6I9LIYPPuohlDxUp3TuskuBBkLjmrUmpR4JfHBIOrp69KrNyM aLpOFc9ozfZ3YoD5qNLH3n13tNDuUSdjOjjzbFc7Zm6+XmNq1rg64fV0BeMYRvnYGN5n UOO/goRysDYXV/ddUga2mwSHwexUGd9iuC/L0uDNmxfvUkF27FdtZdfqA+DYtnEY9HdP znymh5lBmTP2aORyLmZNeT30Vc6sW9TG4coiMQaK0HBlTd9X/PGqfP5IvscQEPh/UA6A KaLw== X-Gm-Message-State: AOAM530yjSn6RWihyJwDdQ+7vay2FPhcIaUIlpTL+pyFDjUNdFbQytz+ t03o7IkHGFLCrtV8ZM0GFZWGUg== X-Google-Smtp-Source: ABdhPJxjgtmoBh+TjhY4jwZBRLmOO/t4+4cu+yIFtjbg4mFY0zXTI5TZCcanxWTLjoIsmfezhzbI5w== X-Received: by 2002:aa7:968b:: with SMTP id f11mr3724767pfk.63.1598039640596; Fri, 21 Aug 2020 12:54:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k29sm3378601pfp.142.2020.08.21.12.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:53:59 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 19/29] arm/build: Warn on orphan section placement Date: Fri, 21 Aug 2020 12:43:00 -0700 Message-Id: <20200821194310.3089815-20-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155402_943382_D6690479 X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly handled in the linker script. Specifically, this would have made a recently fixed bug very obvious: ld: warning: orphan section `.fixup' from `arch/arm/lib/copy_from_user.o' being placed in section `.fixup' With all sections handled, enable orphan section warning. Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook --- arch/arm/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 4e877354515f..0aa133c4ddec 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -16,6 +16,10 @@ LDFLAGS_vmlinux += --be8 KBUILD_LDFLAGS_MODULE += --be8 endif +# We never want expected sections to be placed heuristically by the +# linker. All sections should be explicitly named in the linker script. +LDFLAGS_vmlinux += --orphan-handling=warn + ifeq ($(CONFIG_ARM_MODULE_PLTS),y) KBUILD_LDS_MODULE += $(srctree)/arch/arm/kernel/module.lds endif From patchwork Fri Aug 21 19:43:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730395 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86B4D618 for ; Fri, 21 Aug 2020 19:47:21 +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 5F9AF208DB for ; Fri, 21 Aug 2020 19:47:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hkjg2fpD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SBMpGd4s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F9AF208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2WXPGIJU8qpSSFBdu3WOPVu61xwF7Cd+3jVKNr+mhU4=; b=hkjg2fpDw2KoDZXtry/QPOZ2r F1sdzoH3ND5UqgvmA4glV4EG/mBeQd5yavs4KMqZl1oCA4j6GgbdhHsan6HceK5IcGFDk0RE2W2ia A/vGfKuWeEW23ajUMHsa5phAxENu20HxcLfzCalb2ks2xOdcxnIieuz4hhC8hjMIbQne/jQimSDhi 2jG7+UnB/0M4zRRl7+lcI+VKJb/sLUD+Dncd5cHR0yT9bKXDjAO/6PtSJX1rVq5NpDxN/p+ouc3NV JtT6Ql/P+bKhsbbap/A3i+ysIv2QSnPTU+ycnDPxfHlrAJPC4w8rAQr02QhvXRT/ywRSXmBL5MOGg dMfNmRARw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D09-0007na-Gy; Fri, 21 Aug 2020 19:47:01 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxl-0006aV-Js for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:42 +0000 Received: by mail-pf1-x443.google.com with SMTP id a79so1562357pfa.8 for ; Fri, 21 Aug 2020 12:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ASfOQ/kuJ12Krf5ZSehq5O7QSVOARTcDMayUR4wNtMg=; b=SBMpGd4s+UiKQvpd6FIf7mmyr/JgBt10+TVD7Ii5kFCkzS10pEX4X6/EJKoruoKLtC 84CuRzaeQOC+BRoI8+VIgcXpHdJXsz8pSr5eHHUk9OeOiMGvPWNv9o2E266UGfgRx9Rg lryfQ7kHnS4YgNbKzDh3sJwiGeiFPyEFPetDE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ASfOQ/kuJ12Krf5ZSehq5O7QSVOARTcDMayUR4wNtMg=; b=nDttJxDpV3KulnwiN0ME7DEYoqlYRtvMkJUYCTu74IKG0R8WOPq4VpMLNeaWXRTEKk IaUubMKNweMmxuWPfQ97D0cFhFoWKbZCdx4MLFnbyr6Gs8QK79o4LUhpH3xn+44u1EQZ qkcN/lSs9fnqnL4mIPpg99lneqGCnKUffr7TXurcWxX9/jMvGPL6Lp+wZaVzjzQ95hIQ zv+Ztpxw7UJWNCJnh+gQn9LnvKBs6OTT0EaQlDP2eh3oS9DtQSIGhelNVDbToZ6gCPpw eOzPVhMvuIQtpWic/2+fuOb8ntKyZESWysEmBv/+K6m2UQCJJx0fJ/o3c0LoFj/uK8+v U5WQ== X-Gm-Message-State: AOAM533XPDx43PO7KJASsDu9fcrnUHYwqTOl/Di3zDdsHjNcegYT/xCW AvHmNFMVC4Up7nWmEQtLjNsLfg== X-Google-Smtp-Source: ABdhPJwFeS2gDku25b5tGzJc/XuDkDFgWDxSYaN0Nyvsjs90n6spX4UwCV0A2j+35rUoflUm3Ku+YA== X-Received: by 2002:aa7:83cf:: with SMTP id j15mr3532874pfn.251.1598039071474; Fri, 21 Aug 2020 12:44:31 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q7sm3300258pfu.133.2020.08.21.12.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:30 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 20/29] arm/boot: Handle all sections explicitly Date: Fri, 21 Aug 2020 12:43:01 -0700 Message-Id: <20200821194310.3089815-21-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154433_720103_0C0E8FFD X-CRM114-Status: GOOD ( 14.50 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for warning on orphan sections, use common macros for debug sections, discards, and text stubs. Add discards for unwanted .note, and .rel sections. Signed-off-by: Kees Cook --- arch/arm/boot/compressed/vmlinux.lds.S | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 09ac33f52814..b914be3a207b 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -2,6 +2,7 @@ /* * Copyright (C) 2000 Russell King */ +#include #ifdef CONFIG_CPU_ENDIAN_BE8 #define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \ @@ -17,8 +18,11 @@ ENTRY(_start) SECTIONS { /DISCARD/ : { + COMMON_DISCARDS *(.ARM.exidx*) *(.ARM.extab*) + *(.note.*) + *(.rel.*) /* * Discard any r/w data - this produces a link error if we have any, * which is required for PIC decompression. Local data generates @@ -36,9 +40,7 @@ SECTIONS *(.start) *(.text) *(.text.*) - *(.gnu.warning) - *(.glue_7t) - *(.glue_7) + ARM_STUBS_TEXT } .table : ALIGN(4) { _table_start = .; @@ -128,12 +130,10 @@ SECTIONS PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data)); PROVIDE(__pecoff_end = ALIGN(512)); - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } + STABS_DEBUG + DWARF_DEBUG + ARM_DETAILS + + ARM_ASSERTS } ASSERT(_edata_real == _edata, "error: zImage file size is incorrect"); From patchwork Fri Aug 21 19:43:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FC03618 for ; Fri, 21 Aug 2020 19:56:03 +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 4751020724 for ; Fri, 21 Aug 2020 19:56:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B2xu2cwq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iZ6STMhf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4751020724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YJfVnYHQg0b9a9z/fBw7wskH5D+42Bo0AZadEfA356w=; b=B2xu2cwqKxpjI2s63hh2Z5Gaa Z3wq5+FEradBcqGKh9b0HbgxAMJI2+SAEH2Me5laqL+PpZxbuaicLVUaa9Vpxc2+EwyFb+cSFHg7Z vF9p34q0dvCq6pKwU8cAL0KM/uaV1B+0K3QCcYVAb4iznM2/jFEuuPq9A7S35fDBmc6Po65YvLiiK 6uN/Z7cMQ4WWyhw20uSDgPL7v+BeEv9AXN+I4I4iO4DcdwdsT3UNNE37HLnmXriZuWDVto9gvApVG /wUqeB19TAmqsV6fsn6AvP2F52oEoWfpmBz+jIz0AUwEbJ38EIvQmCFUfiDVx6HKp343Mvtdmjr1y Psjg2Aazw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D7F-0003D6-1Q; Fri, 21 Aug 2020 19:54:21 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D6x-000340-6v for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:04 +0000 Received: by mail-pl1-x643.google.com with SMTP id s14so1355982plp.4 for ; Fri, 21 Aug 2020 12:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vdQE3ckXVQaQMZctNKe7+WI4MMPWGnzLaa/Ga3pSK5c=; b=iZ6STMhfCfnlcIksH6lFcgl1iRc5Ipz40ciRwj5/xUiB2quTrrBfw1cgVpJYFMbyFi wLkm/B4u1iW579uXJIrcTAmAqLtJgXuQlTr0Jw8TE4vUm+lyJaDqm+THT2m14yyN/64A qOkwxIhzTLvBmqaLWYpt/YgXsfKu4Nl9ZprsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vdQE3ckXVQaQMZctNKe7+WI4MMPWGnzLaa/Ga3pSK5c=; b=KSPVkMFiP3uHnd7vQgMjrn6MMf+F+kmddR+osCJLMIBmtAxf9hSM69LKg67/EPDipN 3pBJcEcrHy9GBbToe0fQG0CJORKC3cBhanjicGStj40O7VBPYXqzYbvVEoMOQVvWNkm3 bHq3EfXSDDVQ4EGU/FYObViceC/CRPzdeiBJ6PqBlUZ2B/N4tDfVMf/zQx3SLC4I3Jqg smNDIL9CguJ+mKQK6CfuEB2ESbQpSMnqT+D9o5z0Y3GM8y8ZitduawZx0mba7xWFxNks Dh9E6KUs59THB+JFDVmuPpGF5W/1IgWCsC5Ep3wE63kgQTcusGN8KF8BzhgPp499Il2r 9qRg== X-Gm-Message-State: AOAM533uvgysRZ6pm+m2hnx6ks4jSkw4SzJNSwdeQz1PhiD6DxxevZDn BxseRODhnJOIc/cTnYz20gFZEw== X-Google-Smtp-Source: ABdhPJx3+jtNnnJd5zpPHLfvhbuFAhJz5nokpNldUaNYUUJcrj2heuGLYxm1XOgYFBH0L7ukexa7gQ== X-Received: by 2002:a17:90b:238d:: with SMTP id mr13mr3515645pjb.132.1598039641368; Fri, 21 Aug 2020 12:54:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l9sm3165356pgg.29.2020.08.21.12.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:53:59 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 21/29] arm/boot: Warn on orphan section placement Date: Fri, 21 Aug 2020 12:43:02 -0700 Message-Id: <20200821194310.3089815-22-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155403_269058_1ADF5A03 X-CRM114-Status: GOOD ( 13.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly handled in the linker script. With all sections now handled, enable orphan section warning. Signed-off-by: Kees Cook --- arch/arm/boot/compressed/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index b1147b7f2c8d..d6cd2688ad7e 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -123,6 +123,8 @@ endif LDFLAGS_vmlinux += --no-undefined # Delete all temporary local symbols LDFLAGS_vmlinux += -X +# Report orphan sections +LDFLAGS_vmlinux += --orphan-handling=warn # Next argument is a linker script LDFLAGS_vmlinux += -T From patchwork Fri Aug 21 19:43:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F2FC618 for ; Fri, 21 Aug 2020 19:56:35 +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 E92AC20724 for ; Fri, 21 Aug 2020 19:56:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LXivZxe2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KCpWIGu2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E92AC20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dW/lxaRZTyce0W0Xs0HpVJchWUg+YeXPbhQFJWzByi4=; b=LXivZxe2MzoceU6eHR2Kc35Mn 7siVzKujfUj+zPeb+Xb7E83VfYwoHXLZt7WzXMtTL7H7I3aJNVGt0XDHnYUuwLF1sR6KsEkYqp7/l UVDDBtZDol+h4ytTA0dySN6SGoerlQ20C541zHvOEHtYWBoYNt3bXMzOPixGzsEMogVHzdR9xanEZ RFEcSCFihACLG2CjByVnGYeUeCz3CHxLiSpbp4WkAod6+xTyarVyeHaVneY617WvB47UJoZt7O2qh hbzdobxZ+Ho/ibjAJEkytHFSBj76j18ISkQcaL83QL4tqUp5wk415XDTSvHrq1a+b4rmomr5y5I+7 XCgzJTU8A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D7Y-0003K6-Iq; Fri, 21 Aug 2020 19:54:40 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D6y-00035F-IJ for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:05 +0000 Received: by mail-pf1-x443.google.com with SMTP id u20so1592400pfn.0 for ; Fri, 21 Aug 2020 12:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PeNFh808sp94203AedRRDxtBogHXBjPfBsBbm9/bM3w=; b=KCpWIGu2/MoubKQjEEdpSZyLun4iQCojW3eL8PjI2Ey8IgO2OcGgVhrFyHJn60Oux1 fAkef240dPlqqfWatRfeUzI0UXYkuVBgt7cQxaJhM6IEUsH+zU6+dsXGqqDYhsj3l+/E d+7ZofSbpYqxDUrDxEuyZZyHy5U/1ElZSYieo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PeNFh808sp94203AedRRDxtBogHXBjPfBsBbm9/bM3w=; b=s1C70X1mAAX2KGzc8d5c/KBsbfLi3fHgQLd8WZ3O/PKp5Yh0ek9rxHcny9pmogwXdE KMJKk/MR9E8gFOZv+XXTxLZJSfCvpXoa/o0WVr1PLnHx3iFz+VyWdrJ3Fab3/TwW1qN4 4amfgldHUbnnvuzeSIn/KUa7j68rWZpqRVUsVO1pJedldeGGUiGt9QNVbN2aiYE9mnaT +zeOufIOqSxSXTMd5fnMhRpSz5xDVNZzGM/IrN4auFO252Whz4Zn7MxKAjoEiPysxZ/N 8b/tNjKnhJErG/0ruKdeShfSxyWBBiTzHPndUuxXxBrhLFRTP7h/kbrNndZOsnGisbAw Cfqg== X-Gm-Message-State: AOAM531EvPYClCifzaf6rLWaejJbrfEZ9t84jU9rl/4SsQRR2TsI4s91 T4I9xIPso27mKMq0ojQ1ka+9YQ== X-Google-Smtp-Source: ABdhPJz2gpH4NA/nopyFe5T4J16P06sAq6mOjn6oaCK64m6qXX90A5MjjPsdZ/Av2ZQInlq5xfJc5g== X-Received: by 2002:aa7:8bd2:: with SMTP id s18mr3553849pfd.284.1598039642687; Fri, 21 Aug 2020 12:54:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x11sm2748233pgl.65.2020.08.21.12.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:53:59 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 22/29] x86/asm: Avoid generating unused kprobe sections Date: Fri, 21 Aug 2020 12:43:03 -0700 Message-Id: <20200821194310.3089815-23-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155404_626547_F8D61036 X-CRM114-Status: GOOD ( 13.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When !CONFIG_KPROBES, do not generate kprobe sections. This makes sure there are no unexpected sections encountered by the linker scripts. Signed-off-by: Kees Cook --- arch/x86/include/asm/asm.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 5c15f95b1ba7..4712206c4325 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -138,11 +138,15 @@ # define _ASM_EXTABLE_FAULT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) -# define _ASM_NOKPROBE(entry) \ +# ifdef CONFIG_KPROBES +# define _ASM_NOKPROBE(entry) \ .pushsection "_kprobe_blacklist","aw" ; \ _ASM_ALIGN ; \ _ASM_PTR (entry); \ .popsection +# else +# define _ASM_NOKPROBE(entry) +# endif #else /* ! __ASSEMBLY__ */ # define _EXPAND_EXTABLE_HANDLE(x) #x From patchwork Fri Aug 21 19:43:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730401 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8762E1731 for ; Fri, 21 Aug 2020 19:48:04 +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 61A8220FC3 for ; Fri, 21 Aug 2020 19:48:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p8COVmDO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="m6myLEik"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="nMHBYCD9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61A8220FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=I6FgiJ7MdDyl+QGwc2sZlkKHD+YLhIQsnecr/jxVFT8=; b=p8COVmDOubQabbHAGSJuq/490 52YO8erMp+RbRLhaGiGzmYPynBtXsXzMfKjBP5R/x06MlHrcggxKeGwAK6RMOm1udFFV+KhDrUtva QfFptYPvbzJy9lcqPDqld3+FUgBo7PqmDd0DznSKkUOUlPWv66uPBXEUKu1d757rhs/6MD4eJ2wiQ GSG8ZI0x2B4zwmzM+t31YxMjHiIfy0rdJRqGku57XCsx8VHWZDCeJpVYXEdXxHx0oPbk5INyb/tMr 6eUojcl0xgutxBOCF7n1jqYPK0AjOhkHNkhOLY97haVTMmBQFgAyufXadGBBZvz0oDhO7YgCx6+/d gvJKthAOw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D0r-0008FJ-U8; Fri, 21 Aug 2020 19:47:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cy2-0006g9-5a for linux-arm-kernel@merlin.infradead.org; Fri, 21 Aug 2020 19:44:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Bq/BqxHywJ//unZ/FFsOI/I3RLFn1Ht881hz0pa/nMs=; b=m6myLEikHD0+SNPITu9eBWVFrv szX1/zbHQkDSgO6uZftjTRNcu6GH7BF/WakhoimZahBFcnCBSvvjIYIobizln0SfdRkijqM/MUuLA 3Ep99y1mwxtaz7Nqmpp+Ky4dRhwwIdsbrr9IRlDOW7VmX/JwfnFsbFRwM3S9M58/kj892z4QOcUYh 0ejG5urfl07oa7mvk0kUx9z4cV/sh8M5hXgJeus9ZxosigrQRD1DeZuXCnvtH7RS1U0681IumohHz k39kZ7TQgRIdnGtTKdExwZcSp8X7IYhY+VgI+9G9le95J/n51wDKTdQ7WYGG5rjRRVBOqePnIMP13 9/4OKRBA==; Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxp-0005iB-1X for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:48 +0000 Received: by mail-pf1-x441.google.com with SMTP id u128so1567601pfb.6 for ; Fri, 21 Aug 2020 12:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bq/BqxHywJ//unZ/FFsOI/I3RLFn1Ht881hz0pa/nMs=; b=nMHBYCD9syPtJ/9CNgyFfuEGCZA0qp6OIY3dAoZSUWHpHc+Q3Ev747cyfJWrxPqTaN 9e2MrjpkqhQ+CCitsRw/dNMuQKUwexmgZUVqIjnoSQr9FtrpZ8sf1wqr3WXSo/B/W8Fk h225U7BBpzt+8zMUaIT5V8sZTmMP3VxgJIx3o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bq/BqxHywJ//unZ/FFsOI/I3RLFn1Ht881hz0pa/nMs=; b=WWIegG/2ajnePAPvUc9w7reF3wyPGu4SjUT57J5rIYGUZiN4+WqADwxkE7zrSV17ac SwgF2l0ep+nIHn+F9Y4b6ISN/OchrFRqhlutcTkS+/cAGztS4UNTkG9nPhT31PI/K20s ljNRKGE45x2ZbVsS19etXOPJ0RNexeS0oVGsEoP4+d5hKVHoMFtOa5ngw9i8GMuBxP04 xkcDy2hcBJ/uWPzn9gcAcrENC2mD6viPgxpzbXldjAA6HzphWfWcQSjt6C7BXMMkCror CzoUgtj7qEDvZ0Xx8PJhYz/rTJFyMKC2SZktaX51C3uiYp/Im+XunJWwVp/QnS9m/0ir R63A== X-Gm-Message-State: AOAM5300RtkSeSInMvmuXQ61Nz5eGwK8dqky7tENj33huWOTC1bE7vkg XweuuHvpy36ZKJncVOklTVHs6A== X-Google-Smtp-Source: ABdhPJzLO9YcG4hPsntq7zaWUP4F+rgb2wZDPHFQhZoPhtEJ9GVket/dTKmqcPm1ABYBQRpoMUWFDw== X-Received: by 2002:a63:2324:: with SMTP id j36mr3471607pgj.221.1598039074103; Fri, 21 Aug 2020 12:44:34 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 132sm3025142pgg.83.2020.08.21.12.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:32 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 23/29] x86/build: Enforce an empty .got.plt section Date: Fri, 21 Aug 2020 12:43:04 -0700 Message-Id: <20200821194310.3089815-24-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_204437_212531_75EBFB0B X-CRM114-Status: GOOD ( 15.54 ) X-Spam-Score: -2.1 (--) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The .got.plt section should always be zero (or filled only with the linker-generated lazy dispatch entry). Enforce this with an assert and mark the section as INFO. This is more sensitive than just blindly discarding the section. Signed-off-by: Kees Cook --- arch/x86/kernel/vmlinux.lds.S | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 0cc035cb15f1..4b1b936a6e7d 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -414,8 +414,20 @@ SECTIONS ELF_DETAILS DISCARDS -} + /* + * Make sure that the .got.plt is either completely empty or it + * contains only the lazy dispatch entries. + */ + .got.plt (INFO) : { *(.got.plt) } + ASSERT(SIZEOF(.got.plt) == 0 || +#ifdef CONFIG_X86_64 + SIZEOF(.got.plt) == 0x18, +#else + SIZEOF(.got.plt) == 0xc, +#endif + "Unexpected GOT/PLT entries detected!") +} #ifdef CONFIG_X86_32 /* From patchwork Fri Aug 21 19:43:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730409 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A819313B1 for ; Fri, 21 Aug 2020 19:49:23 +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 76AE4208DB for ; Fri, 21 Aug 2020 19:49:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pwJPY9/e"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UoERYCO2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76AE4208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pQQUW+6jAXl/bAlLp/wlYgDacYYUDJJhHrsqQAFI10Y=; b=pwJPY9/epTMuNPbQUYKZzzWsh GsYPlRjYYtoBEwxO/df8fY709e/C+TkUEHBui2j7oydXJkTIP0E3f19Zvh9kJxwVwwHLJoo8Qgxde S3r4x4sPKPxIOFmtkOLLXSdvIsIzT0JqgndQtozoLsWRL/vkLQ1DVjYr/VCZEi/OiOLZBtxRoWoBt IscVC5TWezXGEx8H2vnnBOcLzlHIGQMOksybEjXBUVPfQZX6xGSEe6B/r5pxExC/dYA0n8L4syi5t nqAqj+R9A69zTgDxxvImDuMXpyobTuuR7MoK3GqSzwVedekGpbu46Zm89NEeh5RunhOC7VP4902WY q4qNkf5Gw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D0L-0007ts-0H; Fri, 21 Aug 2020 19:47:13 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9Cxn-0006bw-I4 for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:44:42 +0000 Received: by mail-pl1-x62e.google.com with SMTP id f5so1334559plr.9 for ; Fri, 21 Aug 2020 12:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LnzDApNoxwO5pBe0Rw0QWzekBEKvTuf/gsd4zpzC+NU=; b=UoERYCO24yjxw/nfIGuRfWgjYp/IIpMBbAVGy1Wh0MBis2sB6JQnzFux8I34fXIfzL XiTwAIwqPF4tOCBbtkjo2duqIpNp4WHF09n3SLEANmWxObkZKlAhR7FwKcJlzhd+gQgM C1S+79RksYz2j/ZELEmvpwtea99u0tMD9V+xs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LnzDApNoxwO5pBe0Rw0QWzekBEKvTuf/gsd4zpzC+NU=; b=sZjB53LvAkgFCCiyGIaN7SYfWjudP4xNOakJgCdxbCunSHkNGCI9bOfBCvQGihZdN6 v65epF9LQ+HasubiWAFfnBO3svyI4dDETcq4TbhxviiymKJpSQ3kiS7WnN2Lv6TjlBgk BMABn7D+vH3y/rONzAo0yEwLW02PLJvvY0rIVckMYfuqJnzRFUxB4Dbnccpg80kMduej KAcazgDWCCFdHuL223mJvk0YiIVZ9YArhSJy8FzTYzUYf9fH89lGKbm47Yts1B4l4C2q PEhqSc2wJ8g8kWv0kA7I80Zr4K5KnIC9Tt88xZtSlOkdUY5V7xULLxz6IPbkSKZAFZgE PZ4g== X-Gm-Message-State: AOAM533AdhJNg7pDjoiZ/AKZPfGtfwVYvkjBTj+QNqptOlZR8ksrwx5Y ZE5tJF2ccnlQd6P9OHdAY5nYHw== X-Google-Smtp-Source: ABdhPJyu0JBnryH7c2ygqsir+GpNNDwC3kcAJ7djAIPlnuSXRNo65MZU7eflxCCpW8/XD/Xeo3NXaw== X-Received: by 2002:a17:902:ac84:: with SMTP id h4mr3560513plr.334.1598039073450; Fri, 21 Aug 2020 12:44:33 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o7sm2570901pjl.48.2020.08.21.12.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:44:32 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 24/29] x86/build: Assert for unwanted sections Date: Fri, 21 Aug 2020 12:43:05 -0700 Message-Id: <20200821194310.3089815-25-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_154435_664308_B3262E13 X-CRM114-Status: GOOD ( 13.82 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:62e listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for warning on orphan sections, enforce other expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Signed-off-by: Kees Cook --- arch/x86/kernel/vmlinux.lds.S | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 4b1b936a6e7d..45d72447df84 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -427,6 +427,30 @@ SECTIONS SIZEOF(.got.plt) == 0xc, #endif "Unexpected GOT/PLT entries detected!") + + /* + * Sections that should stay zero sized, which is safer to + * explicitly check instead of blindly discarding. + */ + .got : { + *(.got) *(.igot.*) + } + ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + + .plt : { + *(.plt) *(.plt.*) *(.iplt) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + + .rel.dyn : { + *(.rel.*) *(.rel_*) + } + ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") + + .rela.dyn : { + *(.rela.*) *(.rela_*) + } + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") } #ifdef CONFIG_X86_32 From patchwork Fri Aug 21 19:43:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730413 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28241618 for ; Fri, 21 Aug 2020 19:54:43 +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 F2F7320FC3 for ; Fri, 21 Aug 2020 19:54:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nPB8d301"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="h4th2Gwt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2F7320FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jVzLZ5RrBPmdqQIDu73I2zDjCfZht89lNHdQOZPJyms=; b=nPB8d301BEFVdjM/RzCEJLuvr LDOLdtUBfiYyza5QQBpWsJTfetfxV5lwqfJ2cPCvFQRp3JNc3XeyGErxF/juswCrzzznHqmQGced/ ArP1YON803/7WsdV8NlPEHUIpqAc3H9L09a6IoQbU1fJadjNofg6MXxlQfo1nYaAowH7u+OCmzD79 ykIkZ+d56hyii7a15g4CBn3lIjdNMgqqfkEvycJmC+Fu8+vBKf1r1JHIZDUIdKyLARV4tUabz5Wl1 VVvG8KVw3z4baabkrO1I7nsVZ5mU6IMqEBE2RwVOFj8nEau89/Ym4WrXbDcJWXSai73sg+RyPgDdV 55dr0453Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D7L-0003Fj-55; Fri, 21 Aug 2020 19:54:27 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D6x-00034b-Ug for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:05 +0000 Received: by mail-pg1-x543.google.com with SMTP id s15so1478185pgc.8 for ; Fri, 21 Aug 2020 12:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X7lCPABz4JNrayMBdAlXz/o0k5wzYACi9B/neD0BSpY=; b=h4th2Gwty/g8Cg6oI4xBM2C9OsM+YtTMFNWMQxaSJxeMsiGbGHmjIpyPzRqnDYUohj mZEWv+JTiMGCqWpGcvezka0JZwFqupIZBq+bYlxEMz2m2f5RPnDUM/esPBUqClXzhknr KDHkGu/E7WUrNYpV0Two51F+fgNxBgpigGGNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X7lCPABz4JNrayMBdAlXz/o0k5wzYACi9B/neD0BSpY=; b=oNtxum0xJpaF7pFXtEHuN2AyeQ3/J9DACvUdwA1ADe8s2pSzpgrpJA6yOxERz06NUZ rEsGXa0UZP1ih2QDMpbo4cyrzj7Q5C69hH1PWysNEfArhoK2yuzU5p6dgrXntxXewHwV QLkzakAb5vM51PNnXF5Lk2fo6HCN/L2vJJjdZLJh3z6XUboJ5XT6JQEnKBvr9+VE3qUF LMF3LrkstCHVimwrhSzPaoyZvQBGKw+RFXuwPen3ozAUDJpNjfJ3Ue7OpDSG7jKkC01S 86PdH5s6haBQZZM0NtkF3qcYDMXCZ35awTpLCUw5LO2l+6dLIbxz4SRj0ItGL29FBcm7 xmWw== X-Gm-Message-State: AOAM530XgIP7VSEVtiH+3Ww3gKjflLBdZyrCDW20t4Dro6G24kYO6TmR wSPXtrsLImBIHnYRqx41kyFWmw== X-Google-Smtp-Source: ABdhPJxhC+bVf5xz8oKClettUbKDwzdI3ZXBGK3DWk9rxsSxl1YyINcFuh70sERopw/lGiEEpzQkVg== X-Received: by 2002:a63:cd46:: with SMTP id a6mr3322488pgj.267.1598039642059; Fri, 21 Aug 2020 12:54:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l67sm3026438pga.41.2020.08.21.12.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:53:59 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 25/29] x86/build: Warn on orphan section placement Date: Fri, 21 Aug 2020 12:43:06 -0700 Message-Id: <20200821194310.3089815-26-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155404_030522_DAFE88C1 X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly handled in the linker script. Now that all sections are explicitly handled, enable orphan section warnings. Signed-off-by: Kees Cook --- arch/x86/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 4346ffb2e39f..ccacbf808552 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -209,6 +209,10 @@ ifdef CONFIG_X86_64 LDFLAGS_vmlinux += -z max-page-size=0x200000 endif +# We never want expected sections to be placed heuristically by the +# linker. All sections should be explicitly named in the linker script. +LDFLAGS_vmlinux += --orphan-handling=warn + archscripts: scripts_basic $(Q)$(MAKE) $(build)=arch/x86/tools relocs From patchwork Fri Aug 21 19:43:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED62F138C for ; Fri, 21 Aug 2020 19:55:42 +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 C478920791 for ; Fri, 21 Aug 2020 19:55:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2a5FYZ1t"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Sh9vRY/S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C478920791 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=siXTnPtG/tBFuTO2deYNhRM82Iv6GPJcAcf+LtZB9aE=; b=2a5FYZ1t54LXVHOnUV5GldQPt DlgmviEmxDV7YxMeyMQ0SRwXRJ9I7Ulmn7gF/NqDSi7Ol8PWUGldNbk13Qm8oTWjAlqQlWi+4O4Td z6Hb+V4R9iBROmb8bedtfs+UNT8fyZwxXID7PZdcR4RVsK0m5QDp0JvdCDMXmhajgcUA1KLgYTy4n efaZCuuLcEuU0siv+BjXKAAbas/liQ1HqpQTIJZaJ+ANXIEzQDBGFAtXD3liQAWKVYbTYv9MmW8gG 1vUpsfaUcpsvMnq2OC+fwdtDtjm+jwtn/OI5/y+sP5ZIDSyLElwJ9Puz52Chc7b975eL1ETwSYLkn DiH3d0r0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D8I-0003cD-KF; Fri, 21 Aug 2020 19:55:26 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D70-00037E-Qt for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:11 +0000 Received: by mail-pj1-x1044.google.com with SMTP id t6so1265469pjr.0 for ; Fri, 21 Aug 2020 12:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0UnndhLoIUPQilO6J2hBojAKmFC4OCA3zcUIp6ZOMro=; b=Sh9vRY/SnIiq5Ijo9twGKuJvIro+2ScdJC7L8hqNb74wvpnUXW74552MBiBf5c9ho/ BOqwZzPM/KRTMkdU/ope8Bau3ipHQ8VZu0l4lmJP8/F6K4yUVcmPySQ5Ug2/EOEQUcoO ZdMtW7Ylxl5Y+uUwL1z39akrMncft2tc4GNeQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0UnndhLoIUPQilO6J2hBojAKmFC4OCA3zcUIp6ZOMro=; b=gX9oQuDifqlycj9KrB1opYe4o7xSvbmV55w8TzMYKs7ThTbpAmOBENnHxKSaPlMpaf 91icn1XrebUgkiZyH7rz/7WDYtXg/eyWtLDRkrCVQXd03wyIL8RhiogXz7XqIV2wYjGX ewQQ+MWQHFUBU2Pewl4YW2g4j9m3TD6HkPR8x39SR5dklVlSEnf8cOjCGklrrG51RpHo fZeZ+N/fp5LmRf07/WARafeviwEetRas0JHvbSjstSVFhXJAQ1XwAgAp1EUscd6uzzFQ DEEd70D/CuNL1AEw7H/zGRJkUVUlRi8ybzsO1zoGSoJQONqT1YM0jJYXJ9p+cJ3ET3mZ ArvQ== X-Gm-Message-State: AOAM5318XbHp0KFzldb6tFSp2fYMpE3x5yvrWOEodTkGmT1wuD27KSqv nLIUWp6uKDeRZqX9WLCu4PTysA== X-Google-Smtp-Source: ABdhPJwmCnmOTUQk1XKd+olibX9ZOXDXcitcUxjr93v5Do636rUlnfDVQTuwBKBQgeAByyk2C/5Y4Q== X-Received: by 2002:a17:90a:6787:: with SMTP id o7mr3611282pjj.76.1598039644813; Fri, 21 Aug 2020 12:54:04 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e2sm3424685pfm.37.2020.08.21.12.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:54:02 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 26/29] x86/boot/compressed: Reorganize zero-size section asserts Date: Fri, 21 Aug 2020 12:43:07 -0700 Message-Id: <20200821194310.3089815-27-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155406_916489_CF197FCC X-CRM114-Status: GOOD ( 14.41 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For readability, move the zero-sized sections to the end after DISCARDS. Signed-off-by: Kees Cook --- arch/x86/boot/compressed/vmlinux.lds.S | 44 +++++++++++++++----------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index 3c2ee9a5bf43..ca544a16724b 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -42,19 +42,6 @@ SECTIONS *(.rodata.*) _erodata = . ; } - .rel.dyn : { - *(.rel.*) - } - .rela.dyn : { - *(.rela.*) - } - .got : { - *(.got) - } - .got.plt : { - *(.got.plt) - } - .data : { _data = . ; *(.data) @@ -85,13 +72,34 @@ SECTIONS ELF_DETAILS DISCARDS -} -ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + .got.plt (INFO) : { + *(.got.plt) + } + ASSERT(SIZEOF(.got.plt) == 0 || #ifdef CONFIG_X86_64 -ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!") + SIZEOF(.got.plt) == 0x18, #else -ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0xc, "Unexpected GOT/PLT entries detected!") + SIZEOF(.got.plt) == 0xc, #endif + "Unexpected GOT/PLT entries detected!") + + /* + * Sections that should stay zero sized, which is safer to + * explicitly check instead of blindly discarding. + */ + .got : { + *(.got) + } + ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + + .rel.dyn : { + *(.rel.*) + } + ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") -ASSERT(SIZEOF(.rel.dyn) == 0 && SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations detected!") + .rela.dyn : { + *(.rela.*) + } + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") +} From patchwork Fri Aug 21 19:43:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730429 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E27F618 for ; Fri, 21 Aug 2020 19:56:00 +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 EBFFE20724 for ; Fri, 21 Aug 2020 19:55:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="clVB1fSX"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UXMo0g81" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBFFE20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EmgyWuWF3nXalHEiLOPIK7EYt5LGLT+H7VgS51aZMGI=; b=clVB1fSXafKSOb58cxs0ndgHV oFmvIf9mMAhOWJUsKHvKyxcpBOsNROMRrEU2uATJF7xIV+t75EAxKrOHc1Blptkl/fdJA1WFYcWmt /XIgyk4E0JBJik+zIpsP3gj/xaLsbL/pt9M4niqiKzmmUXZlMDcrLUONIz619/W1wvNDRakNvQdf3 VxknoDkaD/sx494j+awNS7sFeCPh3bkHKyz0ICCMoxAPbnUypujmsBClo+chJQWq/RGv5CLtnkooX wKDr8XRMT2Kc4pjicqhEB52fRKlS8yDURVvv6UNHqF+dqs+wvlfHX46n/2XXKXAe08KZxOIRyWTWV Bnf+9K+6A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D8a-0003mX-NJ; Fri, 21 Aug 2020 19:55:44 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D73-00038k-1E for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:15 +0000 Received: by mail-pl1-x62a.google.com with SMTP id v16so1360511plo.1 for ; Fri, 21 Aug 2020 12:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qYY4BGMZpEUoUw6pwB0rAYIo+TQmYGtCQDuwjk0rFfA=; b=UXMo0g81IhuQadz0t0IT637YY3O6sDavMlgOlN8BROJi+h21xme8wQSpHfKN4VSjs0 0zvn+K7mSlGI5ABhdq61uvamMUHMZX9mI8BGcLCW0h1nwgeZH2CIU7gdquipMxGV/X/g LkXmXYJdkoUSQ1wvEfsI5FA5lu5Z42khMLWbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qYY4BGMZpEUoUw6pwB0rAYIo+TQmYGtCQDuwjk0rFfA=; b=dAjKQbfYvsH8wc4Jp3eexAROmYEMwT2Es9XYtvcArsRnfcQX85QqFESnXRAkmMxnLF 35clbbKch23PD3tE2vT9OMk+SlvVSqVHKHl1VhG0BTBrKBQBszZEEXAmVKT1aXlgtd1l PI53VHrFGg3HLgrmoqTF4LzVJjUC6w0fgPZFsV4Gxlmi77F8cX+K2qwjFSsT/BbefSAt Twld+jwN6fOZQ5QXK3iKYSUSnV4+M3tpfdpwoKvmWUfSCRKDosjHKHgqOvlbCw7lJbwD f0UZXQuASJw7FZBux7k4vF8WYuKGyBSm/jn8hd3+RvvexDcn0xaZGcXphML3eU6h/JIF l1mQ== X-Gm-Message-State: AOAM532unnyN738hCfbHogBkIJaoE8gYJEEFI/LHolMmzhpAOsN8u9GQ EkrFVCdhDn543hgTO9+TXr+l0Q== X-Google-Smtp-Source: ABdhPJzdBaK0lQXKTsLBcoY+gieqzSTMIlMFnB1R1B39G09fhcKe/Ne3I8UbPt7DQq2SxYcgDyyTKA== X-Received: by 2002:a17:902:b402:: with SMTP id x2mr88446plr.97.1598039646692; Fri, 21 Aug 2020 12:54:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x28sm3555441pfq.141.2020.08.21.12.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:54:03 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 27/29] x86/boot/compressed: Remove, discard, or assert for unwanted sections Date: Fri, 21 Aug 2020 12:43:08 -0700 Message-Id: <20200821194310.3089815-28-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155409_192351_A967F60C X-CRM114-Status: GOOD ( 16.14 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:62a listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for warning on orphan sections, stop the linker from generating the .eh_frame* sections, discard unwanted non-zero-sized generated sections, and enforce other expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Signed-off-by: Kees Cook --- arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot/compressed/vmlinux.lds.S | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 753d57266757..5b7f6e175b03 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -50,6 +50,7 @@ GCOV_PROFILE := n UBSAN_SANITIZE :=n KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) +KBUILD_LDFLAGS += $(call ld-option,--no-ld-generated-unwind-info) # Compressed kernel should be built as PIE since it may be loaded at any # address by the bootloader. LDFLAGS_vmlinux := -pie $(call ld-option, --no-dynamic-linker) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index ca544a16724b..02f6feb0e55b 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -72,6 +72,11 @@ SECTIONS ELF_DETAILS DISCARDS + /DISCARD/ : { + *(.dynamic) *(.dynsym) *(.dynstr) *(.dynbss) + *(.hash) *(.gnu.hash) + *(.note.*) + } .got.plt (INFO) : { *(.got.plt) @@ -93,13 +98,18 @@ SECTIONS } ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + .plt : { + *(.plt) *(.plt.*) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + .rel.dyn : { - *(.rel.*) + *(.rel.*) *(.rel_*) } ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") .rela.dyn : { - *(.rela.*) + *(.rela.*) *(.rela_*) } ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") } From patchwork Fri Aug 21 19:43:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730427 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 245B8618 for ; Fri, 21 Aug 2020 19:55:49 +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 F1E3B204EA for ; Fri, 21 Aug 2020 19:55:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="csFyccOJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TOCS9QXF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1E3B204EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=a+rPuBekGUbE4rzweo5sdqTaxVquKE33tq45zR9iCPI=; b=csFyccOJ8sHYw2stmqloxtoNW hYhPVPsnOftlzrgLHr1ls3sgsP/R6iAf6TOZFSOH6ZpayQC887Zm8D3wa91zvtS+n6S1Bsgu6czH/ pWW/X2px+ORf8ZMu5qUZZ6Krk4xGf7LLl6k50Th9rQelSSa0t8vlUdprVrFXxng0+5cq1o9wxOuOb 7dqvnlNcgH9IbJ/e6It0F/yxh7RsOvt87MEoMJJ9iKbLOV8eSn5l7J78VOgwAV3gQ+1sAx87pStPm UnMe5+Aees0Q/d2bKgZhRWAYhXGXOWyBuTJhCgRWozgWPXav1Sd4Hncyc/0PzV3msOkxvS8vVyDgZ 7F0uBYMQg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D6z-00036T-0N; Fri, 21 Aug 2020 19:54:05 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D6w-00033X-9N for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:03 +0000 Received: by mail-pl1-x642.google.com with SMTP id b11so1346710pld.7 for ; Fri, 21 Aug 2020 12:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DLGrXrQrOnwocgl0d2lDlCmyCMk0LzJNzAhGu1QupvY=; b=TOCS9QXFvi2sKYKTRr7ee6kse0TEhswUvVuKqMoKi3tljAuSEAQbpwLZo0K9qaprrb 0bsJpMg221HwjQsJw+E3oqeYuH95C/KSW+y5f5cGNHh1HZGSHWEcRCqDGVat33dSK1xj BvjA1iJ703xzao5ihIUvP0L+zcmeoM7uEoJQc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DLGrXrQrOnwocgl0d2lDlCmyCMk0LzJNzAhGu1QupvY=; b=amV856Nmtwn9+W0ujSVow727a1Pk/PtdqBB0qSBME09+BSp2X3sFlMJL+7IBveuBhx 5CEA1WUnMJ9EDqxV/KfF5TkQicBdkJ1vGTP9ByG90QK+IIYjUJweM4SDC7pyPRtpE7ug DhsgT36IU5LiRX2IpJ8v92mO9MEnKWMtLpNzyHleavIFkiU0tXkytl6gX594rmYbHVbT wmu22DsRdK1zokRU15uOFLdKXVyYeA8woVEb7Kx++pSirlzIn1j3zHFN6XKU7lAS1cRg mQwwg/SwE7eITgMXTvJ6dX/9y5Wb/1sAMsfewsU4dqxgZwaPCz/Sg3DB78YBDSvlq5r4 Bc9w== X-Gm-Message-State: AOAM533iRR/ZigGnTjl6D1AvSf8+oa7zev9ekX9RLfmN3r7Tt8Vt85Tn T0rH/vGSYxh39y21CbaIFv4vcA== X-Google-Smtp-Source: ABdhPJxQwlh39B9Zs+13fgS+Mj5RyeBXBYwZUtq7yzKxm2wrKQBpH/KK+GuDxakqY9UBFLOVsfmNSw== X-Received: by 2002:a17:902:c211:: with SMTP id 17mr2292148pll.343.1598039640054; Fri, 21 Aug 2020 12:54:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x26sm3139562pfn.218.2020.08.21.12.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:53:59 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 28/29] x86/boot/compressed: Add missing debugging sections to output Date: Fri, 21 Aug 2020 12:43:09 -0700 Message-Id: <20200821194310.3089815-29-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155402_353384_26E3AC37 X-CRM114-Status: GOOD ( 14.00 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Include the missing DWARF and STABS sections in the compressed image, when they are present. Signed-off-by: Kees Cook --- arch/x86/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index 02f6feb0e55b..112b2375d021 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -69,6 +69,8 @@ SECTIONS . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ _end = .; + STABS_DEBUG + DWARF_DEBUG ELF_DETAILS DISCARDS From patchwork Fri Aug 21 19:43:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11730419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8B1F138C for ; Fri, 21 Aug 2020 19:55:13 +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 811DC214F1 for ; Fri, 21 Aug 2020 19:55:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pU6eD3wS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PH6uKvVh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 811DC214F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fx7ZZ/yF4MAPa9qQDZYzVqMp83ppCk3VyuqFWQXYHBE=; b=pU6eD3wSDpoxlab/fOB2H38+o QrcQjx1thVLRu3y+6VMimOYsvn0jFge0ElN/ICCbFDtaorKi4+MeaQx/uuiyCkvMxYsRNVkkWF4JZ LBEm196PJOGqsgevPS4ERpDA8i/569YCnxehIirp2oEGI0AA5f/z2LxeWPEZFMpbiIs+iIwZXhaID jL7JO+qlcl2qzJSzJtBUErRew3JBLA88NbrmIsQQAXv5eWX8kQAHXRm3IaJv8q1e75UzbeU48ho5T keHh7AUk7P4IA0XCFxx+mkCM1hOPBtB2WQyAzthJHLJI3e/TK5D2+8zyyzwt/ZwXyhuikYzvR9Z9U yWyTTafvg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D7k-0003Nn-8Z; Fri, 21 Aug 2020 19:54:52 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9D70-00036o-3b for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 19:54:10 +0000 Received: by mail-pj1-x1042.google.com with SMTP id ep8so1262104pjb.3 for ; Fri, 21 Aug 2020 12:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X1pLED4dOZHjJehTtWdStx3hbiXOC8sBHN8PPW1XfeE=; b=PH6uKvVhsYajnUeu9WI2S5GhMXGTVSnkPRxAIXL2PQfyslzAd+tUmyU2hUVqyaQiNq R753MmTdw4LGV1AeWW4YF/PEX9V5Kij7VQwCWXLgHNxh+7mIIWrxJDxeVUGxkMY13cGg ETS7WkMSrGy3ull8otZSIbk81u4Ez6PoMkmzA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X1pLED4dOZHjJehTtWdStx3hbiXOC8sBHN8PPW1XfeE=; b=ol+2vdHuqUOszRheYag0FcvXK2e/YfBoyinXPs11HOu4aGK8jk//LuDt3EYivzPjIl puKOlOC5Mg93zwR7JuatzwDwM9X4hQQnf2r1zNzsh8+ceA3+uMinLWEx/Aw1+Pngp9Kv 4wqaUvaWXAbPN5YqcORz5AL6zk2eXSTeAkCFb6OwxU1AYEBBHQRTkSl3nWYHs+ufsiPH O0E1V9VvGJ1xyE3XD0+jjKYqhajVhDu2BnTGt2J3Ea87RwjPsgDWAEEAwb4d5qa7wsdn 2IPyvMdsgxBnQq1ttoui/y0m4acI/jlGM3SXVsJ0nRocH8LVyLWsO3JcJMQGRc/KCVk2 xIFw== X-Gm-Message-State: AOAM533qr39qlHYbI9RlMFzjL9GwiUDoOsbYGhSkrkPpuGpu+5l55wXa cT4xqJpwmGyektSfxYLWvECDwA== X-Google-Smtp-Source: ABdhPJz0nuBd9Wk5RpEnkrKlLdMQ6PcV+wFlYs/rvYLJ53wHdBdXbAoFW0IM+5VNqofeAUl0Piyg0Q== X-Received: by 2002:a17:902:a60f:: with SMTP id u15mr2567999plq.239.1598039644162; Fri, 21 Aug 2020 12:54:04 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h18sm3442336pfo.21.2020.08.21.12.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:54:02 -0700 (PDT) From: Kees Cook To: Ingo Molnar Subject: [PATCH v6 29/29] x86/boot/compressed: Warn on orphan section placement Date: Fri, 21 Aug 2020 12:43:10 -0700 Message-Id: <20200821194310.3089815-30-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_155406_206268_EC200240 X-CRM114-Status: GOOD ( 14.36 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly handled in the linker script. Now that all sections are explicitly handled, enable orphan section warnings. Signed-off-by: Kees Cook --- arch/x86/boot/compressed/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 5b7f6e175b03..647e15837a28 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -54,6 +54,7 @@ KBUILD_LDFLAGS += $(call ld-option,--no-ld-generated-unwind-info) # Compressed kernel should be built as PIE since it may be loaded at any # address by the bootloader. LDFLAGS_vmlinux := -pie $(call ld-option, --no-dynamic-linker) +LDFLAGS_vmlinux += --orphan-handling=warn LDFLAGS_vmlinux += -T hostprogs := mkpiggy