From patchwork Mon Jun 29 06:18:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630473 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 670DD161F for ; Mon, 29 Jun 2020 06:21: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 032C523131 for ; Mon, 29 Jun 2020 06:21: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="0m0fZ0AR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EVDjc0Vq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 032C523131 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=dnvc3pJoDEALW9Ni+U/RjvVFUad3YMbC7fvwTK1Jv0U=; b=0m0fZ0ARsH+/YC4nT+w7VBLdr 9QN5zFiaTqa1L1uP0AxWpqotRtqH3lq7mlT65qVMWUJyObRgyixXyqJh3P+NEpx/t0hXChTzdKtfP WAaURy8SZIvheSkoTHzIOgNlCNBWt789Ck5rDZ5TBuJWiPd+UTssuSV49/FvcNmaeIDfQdeSqLX6U gxm6XgLZZwhorn4jxWD1wXCM25hbeVQ0NJ74RlumMrq3NXTShmn6RdeVFvrHcdUditlzuFdtONZUV 9EPXc1lRlSi6yBbxEUZ0tqmCYgHm3P36GIfcndVZ5SzId/GGtbnVEGKHjoYQsqhOV2BOAEGEAWSx4 eks2pOizg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8F-0005uu-Vk; Mon, 29 Jun 2020 06:19:08 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn7x-0005p3-0d for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:54 +0000 Received: by mail-pl1-x644.google.com with SMTP id g17so6674631plq.12 for ; Sun, 28 Jun 2020 23:18:47 -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=4bArInUOY6/vKGVdecpLjfb0/2uC+GzWucHk89/LRTo=; b=EVDjc0VqYgRB2DG2EzHcBoN2SoQ4nLRItPJPDmHm0b1Z1rE2TFzvswTjV0UFJMg0A+ zk7wDPwhAdhR5pkqtDyugtOi4viSQFRF681TEkB9AOAbZShiWouWaRwMeqnrq0qniejQ Np9npLPCvLOYdVSL9z4v5SRp3hcbR0u8c56Q0= 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=4bArInUOY6/vKGVdecpLjfb0/2uC+GzWucHk89/LRTo=; b=bnf47c1j0FX27Va8paDTAS3KFNY3SX4BrdiM2ShwWYM7nhaA3JDswQUrOyDPsfb2dI BbbKOcvBM3h/M6SBEhqCQAloMbLkuJO8glZX1BiMZJmfG6mnH2rLDpRy2aYYKpfvZR6Y bS2CVZI6n7+LzQKSE2wYEdgVuIg1OY3o+rDezkf//aCsELcrWnvl2t7fezOuVG+Ou3gO ynlTr40BtCjlthtcHJy5J01fbFE1vDJshkkPlADC16ST1RquL0hcujBRfg43Eh9Im6KU egDDaxDRPL6sGdIeY5WhS+kdk5yqJvKZrC1kVhjFUWo9MxyRYEOxDKkulk6fqn8tlfoz 5O5g== X-Gm-Message-State: AOAM5305MIQ0po8tOr4pkmF+U8KTG6mkr5VFjnRmBPerZLZt7H3FIRgy ioHH3/KGQsjE78fT74Qj7GEVGA== X-Google-Smtp-Source: ABdhPJxYBenbTI5DJ7oZajl9d4KYYFff7a69/j4AFC+Rq7Vn12vxMy0qYgcyv5UfojptE8ebjeq4/Q== X-Received: by 2002:a17:902:8491:: with SMTP id c17mr4942997plo.262.1593411525398; Sun, 28 Jun 2020 23:18:45 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u26sm2979285pfn.54.2020.06.28.23.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:43 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 01/17] vmlinux.lds.h: Add .gnu.version* to DISCARDS Date: Sun, 28 Jun 2020 23:18:24 -0700 Message-Id: <20200629061840.4065483-2-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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:644 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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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 , Thomas Gleixner , linux-arch@vger.kernel.org, Fangrui Song , Masahiro Yamada , x86@kernel.org, Russell King , Ard Biesheuvel , clang-built-linux@googlegroups.com, Ingo Molnar , Borislav Petkov , Kees Cook , Arnd Bergmann , Nathan Chancellor , Peter Collingbourne , linux-arm-kernel@lists.infradead.org, Nick Desaulniers , linux-kernel@vger.kernel.org, James Morse 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index db600ef218d7..1248a206be8d 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -934,6 +934,8 @@ *(.discard) \ *(.discard.*) \ *(.modinfo) \ + /* ld.bfd warns about .gnu.version* even when not emitted */ \ + *(.gnu.version*) \ } /** From patchwork Mon Jun 29 06:18:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630469 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 30FDD618 for ; Mon, 29 Jun 2020 06:21:10 +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 CF78723131 for ; Mon, 29 Jun 2020 06:21:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f+XVVob6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UGuj7q/W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF78723131 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=T7b227aGF93+i8v5tQn2a/Hay8hsSj5meWVQjASV030=; b=f+XVVob6EfJV/+I/K9+7Gi+0s NS/f2MYmc3mOm5ntxUKSBSJiBzRARN9MevcJcyPiXvL5mhcMmh2IThklZNCmawQT6QC/4oazUY9T7 yKa+4QCi+Eu8aUrWRXbFEVwVAeywWBZVOt+T4Gig9ZhYNcpjmFA3fXRDushWHqi5qN2H1/tDIeKYB RgHfkX3rH6P4WXg1CTzqni9+aAKX6aDGtpSbEqOfkZtMeew0iUKGU7ABzDqCWANJi5f7rnNelpw37 8ZtRAjAgtXXSLRQFtGrwglyZa4mZRNqkCseMXnzkyy7mzsBjfEyYSPjtBXd6qHexzLMzm9VMDP+Fh 4y7dGCTDQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn80-0005qF-5l; Mon, 29 Jun 2020 06:18:52 +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 1jpn7w-0005oy-4D for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:49 +0000 Received: by mail-pf1-x442.google.com with SMTP id t11so2591786pfq.11 for ; Sun, 28 Jun 2020 23:18:46 -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=JYEfxa7OKW4v9GzIhRwTOUIFBqV9srsfVDhYF/BxOH4=; b=UGuj7q/WS0KExRsg2CLBONUZs7T3XsjCMG/yvyLhtdKaUxcYROcvoBOHpNAFhy3W6X hRSrOBP/yNeMA7/dIhR3oCJW8Q2Ny4KVxmm6Vjh8bZXH5/6i5EtAUXUY8d0+u7DSSe3D eLJOO3rK0lYMIO5dti5mWzX97ev2/r072VzHI= 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=JYEfxa7OKW4v9GzIhRwTOUIFBqV9srsfVDhYF/BxOH4=; b=NxTDnw5mcizPQy5pZV2MxpYvrYVlrA+EsyOzuPK1M8Zc1PO16Y9T3/+S8AwdfjcYwD 2rIuYy2TB/xmELFgcDXqh5uDLSqQW85vlkLzYar70rcI0qxIVDbiGEeOHnEMY7im9pdP r/jk5HomuhOVIBRYdDctWdz77tB6A8chNYb9UEK/yPSpmCVomTvOFrqmmBmtyO5JTzt4 P5cdVFADUHp+6cXLu1Ro0ijgqFrhho2gaVifMcfE/9HRk/K+a3+Ggy+vacmhSPXZ3hZR UmuPeTuIPnrGd29t/v4V72YeA2MFSQrUB+lib3SranD8suYlFh7q9PjgjZOMFzpApMDm fUMw== X-Gm-Message-State: AOAM530crrAlLGkLF/a7qIqzMueRGKTXVDhpae5FCj+neNoDLrL0SFxg gV3VV62DxzQxIWTOca3eEjx9WA== X-Google-Smtp-Source: ABdhPJw01U8lgdzVeHYlSAg3jRburoo7yEiQmP++SKqH4gvPoLztfxnPJpbsXaeAqVpc8BiwbFDEkg== X-Received: by 2002:a05:6a00:148c:: with SMTP id v12mr12987122pfu.171.1593411524779; Sun, 28 Jun 2020 23:18:44 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o207sm33243245pfd.56.2020.06.28.23.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:43 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 02/17] vmlinux.lds.h: Avoid KASAN and KCSAN's unwanted sections Date: Sun, 28 Jun 2020 23:18:25 -0700 Message-Id: <20200629061840.4065483-3-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 DISCARDS, except with CONFIG_CONSTRUCTORS, which wants to keep .init_array.* sections. [1] https://bugs.llvm.org/show_bug.cgi?id=46478 Signed-off-by: Kees Cook --- 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 1248a206be8d..e53a2d4f47f6 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -927,10 +927,30 @@ 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 KASAN_DISCARDS \ + *(.eh_frame) +# else +# define KASAN_DISCARDS \ + *(.init_array) *(.init_array.*) \ + *(.eh_frame) +# endif +#else +# define KASAN_DISCARDS +#endif + #define DISCARDS \ /DISCARD/ : { \ EXIT_DISCARDS \ EXIT_CALL \ + KASAN_DISCARDS \ *(.discard) \ *(.discard.*) \ *(.modinfo) \ From patchwork Mon Jun 29 06:18:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630477 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 2D58B618 for ; Mon, 29 Jun 2020 06:21:40 +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 C3FF623131 for ; Mon, 29 Jun 2020 06:21:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3CYrdija"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="g7mI0xRQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3FF623131 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=jqVUvQyKgcAqlcULVPvA6RtCVxDfo4Hurh1ckAvlA8g=; b=3CYrdija4y+4zL5NBqLki0kXf cvPEQJJYLcVdRTwPKC0VxpkTAkx49P5nZz+ejjmpQF1abXUyNjr3PyylYelSPInWa1xN6DUZT0F3X 1WIGFTk0214amAUL2kZMsPgbfr+LBwA1vcz4qGhRHYKp+mMucrAr+712sOFQjJjtEYzue8CnRwa9I Q3ImFyIksCENYNbd0bd0ugSSvSrkB+9EcM9L0XGj5y8F/VD0/WM4nn8dlPS71m8h1ndfpLZpE0bCT Z++2Jn8BObCmYk7XZOXEwSYtxEdAoT7SrK3sYHkwM5SxgFiTnZmElYCPAFz9Xx7ZaVJBvB/onuAqZ bqT8K1euQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8M-0005wv-Vk; Mon, 29 Jun 2020 06:19:15 +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 1jpn7x-0005pO-8B for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:55 +0000 Received: by mail-pj1-x1042.google.com with SMTP id b92so7565229pjc.4 for ; Sun, 28 Jun 2020 23:18:49 -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=6hZnstVfYoPOWJe22/uMPE3GyeVYaazSg9tzCfSWEM0=; b=g7mI0xRQzDC9tX/D2EXTMfRLSef8L0Y2sQz/4glsjoZ6Yj2AbQGPaF4thtUQ8/mWod vga4zH3CHMGXWR+3yabUgVfDV+o/W/uegg3rEYPkUquZyo2oihOokRRdS2JdBfO0z4ze SBzOKgs3B+l+APXQtOllt1mwPV0/1S7vr/9R4= 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=6hZnstVfYoPOWJe22/uMPE3GyeVYaazSg9tzCfSWEM0=; b=KE0Dr/SPErdajyi1XrzBROA/0V21qNIKRcduDQyMkjzK0CqFtCVJKN8lDgs34fXtQX TK7e6OEsynkFWSeflqiELTpETGcK73wgBqMAlegjUR+t55++36UMXw94qZYillo0FCqT 1TxqZtaUXCvYEALTCC3j7it2tlWJq5ZiIM6h4KNW3eZbqNOKrWpLllMjH8WoLvPamkrQ 8gdJoitusc1+NdgBKFLAJqa+8qf+RvnxQ5asHgCbX16AzcArHCktc6dHxMpKnxG7XXsS KNhWgOgHlXuOxk1LEHF1y/zdcGl6pNPe8awnWBGX15dHnKYukb7qRJr2Twiam4ostOqM dXeg== X-Gm-Message-State: AOAM530qBnks/ErdjbfGPIOvjh9Oy8/AL7DZvQVKPgkTP+4VxF8AawmN 9JQmzTpkIWTrAmkNmkEofmxnrw== X-Google-Smtp-Source: ABdhPJyceFu/euSgU0RFtNpZAq+i0oZxpc9IB6mMNzAJGXQZb1GRHNknkn66laen/hCrjyrGME0o9g== X-Received: by 2002:a17:902:8a95:: with SMTP id p21mr11636474plo.230.1593411527513; Sun, 28 Jun 2020 23:18:47 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f23sm17736216pja.8.2020.06.28.23.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:44 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 03/17] vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG Date: Sun, 28 Jun 2020 23:18:26 -0700 Message-Id: <20200629061840.4065483-4-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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/unicore32/kernel/vmlinux.lds.S | 1 + arch/x86/boot/compressed/vmlinux.lds.S | 2 ++ arch/x86/kernel/vmlinux.lds.S | 1 + include/asm-generic/vmlinux.lds.h | 8 ++++++-- 25 files changed, 31 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 6827da7f3aa5..55ae731b6368 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -245,6 +245,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 e6f8016b366a..00a325289a26 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/unicore32/kernel/vmlinux.lds.S b/arch/unicore32/kernel/vmlinux.lds.S index 6fb320b337ef..22eb642c7280 100644 --- a/arch/unicore32/kernel/vmlinux.lds.S +++ b/arch/unicore32/kernel/vmlinux.lds.S @@ -54,6 +54,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG + ELF_DETAILS DISCARDS /* Exit code and data */ } diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index 8f1025d1f681..d88612e3091f 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -75,5 +75,7 @@ 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 3bfc8dd8a43d..504d16968ed8 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -410,6 +410,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 e53a2d4f47f6..c5d10bc53996 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 * } @@ -784,14 +785,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 Mon Jun 29 06:18:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630467 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 6C25D913 for ; Mon, 29 Jun 2020 06:21: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 CA49623131 for ; Mon, 29 Jun 2020 06:20: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="sPX5IwX8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DI7brhSn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA49623131 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=y3kFoFIjDcAX9OtBXjPU3pZ4DpIjHYSJbuOO8guYWsg=; b=sPX5IwX8Bn16AJiYD7H4NWxk+ BUpehxU8+5ZDevRKmjB0fo46e/rr2YCO6nVfNNlogqSaL58xDqGGWvWCt/wsFzTyKh7T4OMAx8uwd taebNNN6CfknWvKZIKw0pUof9VWVzhPgfjB2OLUSOxnLsld8gGfmu/FoveVhnlJcYdvfmc/TV5QDG LxyvVP9eyTz25ZFDsxozll5GcXDM243uLeQ9tz5qRy/KtgwsMA3nRvRc4zM1opcK426Wu1YM4j8ec tYKkhB0CEp0lYT5UJu1sv0W/MjxEZ5Lhj3cMXFfMZTunzIWUw8uFVdsPOvhNB8yEY3wUigJe/UHaG WyWQSrSww==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn86-0005rq-Lw; Mon, 29 Jun 2020 06:18:58 +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 1jpn7w-0005pG-MM for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:51 +0000 Received: by mail-pf1-x444.google.com with SMTP id a127so7431233pfa.12 for ; Sun, 28 Jun 2020 23:18:48 -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=RpUogxOiAtRCZJbpj/Xg6f5qeGiNnaYs3fJRPX/karM=; b=DI7brhSnHEPnBP9EF9Z149tETyybTm/vRuuRi3kQWF9laFLVbRO/B6ZFFy2PkayzvX qgx3F8e8SkuKXWe2A3IX2ProSRkfDVOaK8mA4F+DyfAsVYLwYcBEByyEiOgr1O2AbpW0 znz0jgmgOzhpF8f9lW/RNJGa3YYwNNvYQnG4w= 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=RpUogxOiAtRCZJbpj/Xg6f5qeGiNnaYs3fJRPX/karM=; b=cMNA7uqv2SYiop0KZ07/BihJ7HpClAcD1fzovvYZocP2iGgdFgA9zfOHs+fUKCPH9/ eMsQudb0xgBJu7X3g2ctQNP/4aYHuJQ9VJX3Fvfh+rlCEdImJo7oqoxD6wY/fx7dPwbw 1yNu3gz6KGQ+wwRA5atZt5REKYnVEHJ25hQqzsoWQ1nQiIoucLCxfRnLs4ckZblDTGw9 QMKaTyPxnUF418XBRehSQLoGwg3erJNa0/8TVoYsnXT/HiUD4wLlknfL09maQrsIdj0y DObgqZOd1HHZeRAycgAc2VlI72zhke53qwycK/9v0EQr0o9pLhSLungkoy03S7b8UTet Mpzg== X-Gm-Message-State: AOAM531zwzivmMUSy8xFPZbzGk7SewcJZRIoBipniozo5C32i7/mq8Kp gui7+9w78rSJRnBwzJEZlqldbA== X-Google-Smtp-Source: ABdhPJyNl9M0hTPrxGqQML+GMiPdMMkdmcUuHH+RPVHgnToWI0RwZQKETihD6gi3OjkvTsW/Fi4SHQ== X-Received: by 2002:a63:fc1f:: with SMTP id j31mr9226331pgi.104.1593411526749; Sun, 28 Jun 2020 23:18:46 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id nv9sm19380828pjb.6.2020.06.28.23.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:44 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 04/17] vmlinux.lds.h: Add .symtab, .strtab, and .shstrtab to ELF_DETAILS Date: Sun, 28 Jun 2020 23:18:27 -0700 Message-Id: <20200629061840.4065483-5-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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 , Thomas Gleixner , linux-arch@vger.kernel.org, Fangrui Song , Masahiro Yamada , x86@kernel.org, Russell King , Ard Biesheuvel , clang-built-linux@googlegroups.com, Ingo Molnar , Borislav Petkov , Kees Cook , Arnd Bergmann , Nathan Chancellor , Peter Collingbourne , linux-arm-kernel@lists.infradead.org, Nick Desaulniers , linux-kernel@vger.kernel.org, James Morse 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 c5d10bc53996..9477359278a2 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -796,7 +796,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 Mon Jun 29 06:18:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630471 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 D611B618 for ; Mon, 29 Jun 2020 06:21: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 A9ECD23131 for ; Mon, 29 Jun 2020 06:21: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="W3jamqoc"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gkyZjcRb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9ECD23131 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=bFVNk6zJfiaPNW7LgICOcF0XsWUnyCsS/Gg04bEvivI=; b=W3jamqocb5WE3CAyTw7nxSLDJ F36tdHIcebgj29FVrdzHVxSZPtOSv+oD+zjH72tG6DhhvP0wpQtbh01dQXZ0l9c7sTXTU4zN8tk+k lSKny2l1rD+3FiYlupDCxYIycWSMl/knI34l977BnJDswiZSiqLNe6N4kGK7Hq1tG534uRGVn6xRV J5EI1K6f9bFbTxX1gNrIVKgJsRSPjhpXkP9ACVseNksy4dNvodzB3ML1KyCX6LNh+nUzdvrfB9f5F rx1ritCwSvZwNH4Z14avbNtd66+eU1OnUd841hiV2Sb5hKOueLe1656ZJ1+FCPAu1ylDqZ0NSjNRf ZOe3EKUiQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8Q-0005yJ-Sg; Mon, 29 Jun 2020 06:19:18 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn7z-0005pt-0m for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:56 +0000 Received: by mail-pg1-x544.google.com with SMTP id d4so7826172pgk.4 for ; Sun, 28 Jun 2020 23:18:50 -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=6elEkxiTC64v4srgfUTdZozPZdv37lYm4BTjSvBzmZk=; b=gkyZjcRb94k71tMgV+9TZXhAbV0rJLLGSga2JTiQ29d2jw/h/CmWsxzOrVYJYO18pb Rgwb6hMV5w9pjKWTXXBfcS3XfIYbnAKMBcHYDl5Yg6lCPR5OD9BbzveaWsROz9zqj2rC FsLqZQZBh83rrB7TDNLbJAZPzlxe+TFWfVRNo= 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=6elEkxiTC64v4srgfUTdZozPZdv37lYm4BTjSvBzmZk=; b=OW0KgmUoEkWsGOhQpjW1iU8NNgeqZBZe3Q0P6CT+dCO20nzVfBhIpC7H7yEbfHlFSJ OaMUyiChBWGLAwr97VCduWJ5DsnDdZ+a9APzIDdGYWhnAj7wvCDLjHGGcLFzhtu7Gtc+ fiehDK/mSX1rCi9IvNj6dROEsx2nu40dtv/QQ16a2Zqhp06TgVhIdLz0quSLQ41WsvNO BxY/qRfLyniJkQWdGEN6csM+cK/SMJT0+ae0b9FJPxvjQIDBjiGYShzzURGN25UIGKpA 1yHp4pNDCg6V9NzBWbEWLP+sC1+YcWpbkEl8JK1LIAcaZ5BuQdo9JBcBqB8fNDQQQv9z 3Lfw== X-Gm-Message-State: AOAM531dJ3qHfC5azaJ2bV77j+r34MqTjz9BLCuwMc0yNlQ/Asc3DDSh DONmR5F8nbHGacRNDpE3P79fMA== X-Google-Smtp-Source: ABdhPJxJXKXKGxIgf9KhhNRZoNxE/RymgaC1Wp90l3FioPTL2ggfsfaH6bGQODamxEof1p/UWIkdKA== X-Received: by 2002:a62:f24b:: with SMTP id y11mr12809730pfl.85.1593411528989; Sun, 28 Jun 2020 23:18:48 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f18sm15312315pgv.84.2020.06.28.23.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:47 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 05/17] ctype: Work around Clang -mbranch-protection=none bug Date: Sun, 28 Jun 2020 23:18:28 -0700 Message-Id: <20200629061840.4065483-6-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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:544 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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Thomas Gleixner , Catalin Marinas , Arvind Sankar , Ard Biesheuvel , linux-arch@vger.kernel.org, Masahiro Yamada , x86@kernel.org, Russell King , clang-built-linux@googlegroups.com, Ingo Molnar , Borislav Petkov , Dave Martin , Kees Cook , Arnd Bergmann , Nathan Chancellor , Peter Collingbourne , linux-arm-kernel@lists.infradead.org, Nick Desaulniers , linux-kernel@vger.kernel.org, James Morse Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for building efi/libstub with -mbranch-protection=none (EFI does not support branch protection features[1]), add no-op code to work around a Clang bug that emits an unwanted .note.gnu.property section for object files without code[2]. [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: Ard Biesheuvel Cc: Will Deacon Cc: Dave Martin Cc: clang-built-linux@googlegroups.com Signed-off-by: Kees Cook Acked-by: Ard Biesheuvel Reviewed-by: Nick Desaulniers --- lib/ctype.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ctype.c b/lib/ctype.c index c819fe269eb2..21245ed57d90 100644 --- a/lib/ctype.c +++ b/lib/ctype.c @@ -36,3 +36,13 @@ _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ EXPORT_SYMBOL(_ctype); + +/* + * Clang will generate .note.gnu.property sections for object files + * without code, even in the presence of -mbranch-protection=none. + * To work around this, define an unused static function. + * https://bugs.llvm.org/show_bug.cgi?id=46480 + */ +#ifdef CONFIG_CC_IS_CLANG +void __maybe_unused __clang_needs_code_here(void) { } +#endif From patchwork Mon Jun 29 06:18:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630481 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 2C8A1618 for ; Mon, 29 Jun 2020 06:21:51 +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 0254823131 for ; Mon, 29 Jun 2020 06:21:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u8gTdy42"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SPivvXbh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0254823131 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=UxVQ/q+DtvQegQi8liZG+elLH28lEjGF2Rm9ZbtFtX8=; b=u8gTdy42Weu/kWQwOo1vfPAeP sREqNhjhh4yC+gGFSkaXX3g1zKLVVWl+pB+qbh5gnsSQjzh0fohFQAc4F4IfrBzjsI2eKsAptgWsF ttMFwkAvhBY4YVpnB2ZRtDIWdQyDK6oSTCBAVxfkG33+DFRkZ4gjVe8rXRrwGchyKWL8ES/FK7rF4 MS8fa+KNxBXEkhiCvFSxAXEJj4ZT8M5zTehD8l4V+oJU7ArPtCPnuBrVj4UU2Pz76Z2Kp5tY1/G2A /xHGFpvKzeONbNdeX+YaHYGdNRZBbD8SXBKYT6wyQFsKPJYwot/DTAnLswXSDZrMbvBSklB32gEqy gydaIHuYA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8V-0005zh-Dw; Mon, 29 Jun 2020 06:19:24 +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 1jpn7z-0005py-Jo for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:58 +0000 Received: by mail-pl1-x643.google.com with SMTP id 35so6699338ple.0 for ; Sun, 28 Jun 2020 23:18:51 -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=Sx4qtxhnzkaAUuvKla0BBnxBLtInQMeed/tdFBRnaf0=; b=SPivvXbhkz1HNs4hv3hB3lAGf7mxY7QzuyuiHLUvE2NTzUDgKcMtvoCr5OvTnpEGNI BKEe727LLu354Czz0UrLwsb8Oq9z1awx0ZhcCb/nUDxWPW65pd8mBz8whR+nh3hBfift 6e7dxeB4Nqxb9mSsbs5XD4usOXZc+u6wbNETc= 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=Sx4qtxhnzkaAUuvKla0BBnxBLtInQMeed/tdFBRnaf0=; b=FFeworNSTmgyXzqKWSRkmBGrUScomqEx1yzPyVl8Tk+1fq9mYBSVvx2wkjfqBtHdix En8iSePT+4YOEPdPIT6bMfSjuyCFl8pwsZj2aBMXHIy303ZOuJ17M7ZjXvcuT2ZtTQD3 W1gdl7mcO9sEMQLNNj0Qn8W5MZpqUR7OVqUVtLXmPi64K537Sfg+sQB52UxeIw8qlSSZ DTTggt2oHbkNhFl0dkIs+15AgiaaUlTjSXse80Af3/D91MSMmgo0m0e0UZHSIr75HzIq wwmFqKXeD0GUFqh8FKiMq9kbcDxqdjFx2+n/cQsmVYjdCyiU9FrYfspd/7FluGeRqPBp v1LQ== X-Gm-Message-State: AOAM531iUpRQIxOFLAkkfw4Dpnx847hj9WOyiIccQM0thuWzbyWKqWFV 8yUoQyzprsTRYTgh7BJ/EiaJ5A== X-Google-Smtp-Source: ABdhPJwNi3xJzPNT7Gdq2Pw3b3VdTrLvNjNwn9RzBwTGL5D87SEILQ2r1+XLJOB0Z/PotUqW7oYIyg== X-Received: by 2002:a17:902:6945:: with SMTP id k5mr11956092plt.336.1593411529540; Sun, 28 Jun 2020 23:18:49 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n65sm32225037pfn.17.2020.06.28.23.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:47 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 06/17] efi/libstub: Disable -mbranch-protection Date: Sun, 28 Jun 2020 23:18:29 -0700 Message-Id: <20200629061840.4065483-7-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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 , Atish Patra , Arvind Sankar , Thomas Gleixner , linux-arch@vger.kernel.org, Masahiro Yamada , x86@kernel.org, Russell King , Ard Biesheuvel , clang-built-linux@googlegroups.com, Ingo Molnar , Borislav Petkov , Kees Cook , Arnd Bergmann , Nathan Chancellor , Peter Collingbourne , linux-arm-kernel@lists.infradead.org, Nick Desaulniers , linux-kernel@vger.kernel.org, James Morse 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, this disables -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). [1] https://lore.kernel.org/lkml/CAMj1kXHck12juGi=E=P4hWP_8vQhQ+-x3vBMc3TGeRWdQ-XkxQ@mail.gmail.com Cc: Ard Biesheuvel Cc: Arvind Sankar Cc: Atish Patra Cc: linux-efi@vger.kernel.org Signed-off-by: Kees Cook --- drivers/firmware/efi/libstub/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 75daaf20374e..10fa342ef40c 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) From patchwork Mon Jun 29 06:18:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630479 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 9E143618 for ; Mon, 29 Jun 2020 06:21:47 +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 7324723131 for ; Mon, 29 Jun 2020 06:21:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Dnw5qZ6x"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="M9ZSb4qo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7324723131 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=YHczW56rI3+R5LvgWh9CLLwAvdKi7rIVcCDrnzYFmvI=; b=Dnw5qZ6xqPhDtUQk18oIYQ7Bc ZisltQdN0Zjcb93PpcnMb6aqOB+P6nQ6wM92dwwCDQwKazExZoNO8aJECrK3AUdWqYTdIZYsbaaNQ iKOdz5cl7y/LFvD00WnqoEOyubM4etKg/PynhAADB/kIajXlXb4MWY7ORWVqePIu4v83HovR246cM k8qlY5h8WMAZl2xpa4yV9cGi2EQLlVM2NFG9bxD8uECwcR9SzjAIRzNkczhtwevvOJyolWsDwvoEg UBsBfFuLH0jOBexYW59w/tp7IN8U5k1TQYrm63Zwa74PlMn/v72GyqjU7GVimTV6R7dGo7VlU6Wa9 HdoRvVUpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8h-00063A-Ey; Mon, 29 Jun 2020 06:19:35 +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 1jpn80-0005q7-3f for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:58 +0000 Received: by mail-pf1-x443.google.com with SMTP id j1so7455441pfe.4 for ; Sun, 28 Jun 2020 23:18:51 -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=g0c7XOOnQF00ZfjeTQGIw9PaJthVip/aX3zS1dRtJoE=; b=M9ZSb4qoWIq549nkDC9nITi2Y+iOVB3dYWRDDV3WRmfzVjtQks65kDEF7l1+ij9SlB Ohi65fuChmNNYze5qrvJVk6IOjVJ/rxa8jvdv0qO+qmBCzMBaCbtUOo4//H/OjguzP5R T/UGeSUbVaM1bo/CG0rdGvwUKCmIM2bIikow4= 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=g0c7XOOnQF00ZfjeTQGIw9PaJthVip/aX3zS1dRtJoE=; b=DqBfcaxmi0TJ0Ed/jxWoAgppwQ/9cSeNdK/6nqv2akR/L+ErwhTdL5A7Ynk0LC6vK5 J+Dfx5lUeyX6k1nHBLYWJaRgoaHKalLYb1I1JRYVWUmpElNXTQxQnfJBD5OW4xDaws9t 9oEHDCsmUWYdiS/AXu7qwoSRjtdB32dW6geSQnyADwBEeZuvBsxrZhek0iC4w21rdV/E yqCpnn9WfCxEYoNR4ZUN9fOO/KH+L3ws9kk+Un5TZ/61kX2Eb/6usgO1X65AD3iwZfX8 65A59d9BWweYrX5nugbt5RsoxvD49x10Jl3acibFciDoc2ASq5/vocPLz62Jr+kF3+ue 7HhQ== X-Gm-Message-State: AOAM530bt5sMY8VTHPlp0IXJn44GmoV70aW+HPEqM2Stk2jqcVrp8xF+ qSKlBEX9NNZWo8KmIGfoZfM4tg== X-Google-Smtp-Source: ABdhPJw58QIF5f/Yv5c9CUFM9Nx42xHsS2ePKHv+mXeT2M6dXWhB9Q/p3SvpYavVwb4WSrkztjUiRQ== X-Received: by 2002:a63:4419:: with SMTP id r25mr2949678pga.198.1593411530134; Sun, 28 Jun 2020 23:18:50 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q10sm34391423pfk.86.2020.06.28.23.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:47 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 07/17] arm64/build: Use common DISCARDS in linker script Date: Sun, 28 Jun 2020 23:18:30 -0700 Message-Id: <20200629061840.4065483-8-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 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 55ae731b6368..b5a94ec1eada 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 @@ -89,10 +90,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) *(.eh_frame) From patchwork Mon Jun 29 06:18:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630483 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 B1C75161F for ; Mon, 29 Jun 2020 06:21:51 +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 8B3CF23131 for ; Mon, 29 Jun 2020 06:21:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="viHb/wIE"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="G5louE6U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B3CF23131 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=phe5LmyJ3MYGIEmwSwagYE3IX+tRoiXqYs/R0F0OZXw=; b=viHb/wIEpKisigA9upFImZAB7 dK5bn9bFlcgahy1eq8GIRl+XDK+7BznE81Q1rUesttXH4wHqhNzyeBMQA5ENXidqmq7/IvAwVBt2C UaSP4ePlUyUUsUTvXV83MS0ouktTZhQyc5BsE7xAQS80b2X+1Mu0FvtTYDSyGx3dIDwspBtjpiGaq LYvbJhxZw11QDZcFqEYQ5gxFHBmR+JGsS1DO++wNc09iVpcUF3E9cbpKc07rl0Q0Zk+AaZ8JcqeXF Yce0nFcvvGclZAqSWB90MipBQBroXBJaU1PoDMWOseJD3GOqHHgsuTyaySnDvvN8vLGtfhkmY6J0T LkX7KAJLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8k-00064x-Kt; Mon, 29 Jun 2020 06:19:38 +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 1jpn80-0005qN-RH for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:18:59 +0000 Received: by mail-pl1-x641.google.com with SMTP id x8so5792280plm.10 for ; Sun, 28 Jun 2020 23:18:52 -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=T0P/zigfbEYVemiv+chkLi1sxk82Ehd4Rswu0BvpDuE=; b=G5louE6Uyd2kc+xV2J1VjkFKPj4o3+7iuP5vPYPCWk+r8gutkK73zgcof6KUBrCFWp NA/YHDMZXOj7EKNzEtTGayNRzAljV3w+YWfaERiAi1wGVtDGv2A1+AtbnH1n8Rlsjznr ZVcm+cqp/UVyef3E1570F2Ni4TsttMaQCB9Os= 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=T0P/zigfbEYVemiv+chkLi1sxk82Ehd4Rswu0BvpDuE=; b=SPcVrIb4jdF5lIYIgIC41CNhx3tH5iZG2tssTJKjN0TNvpZzy/azLV6s26Mge+HQF5 E0+r2U2+vBHz0qLlTGmR/eQECsVj/6yaOOPqBH+3zzoQojUL8tnfXDmWnjLNbe1aOkWA USIMNTWHFIeA0fii+YdqIuKvbgzM3NxbUDk+uvGE07+4DfsUDr3rATA8i6B8yE3co9Ps tZzWIw5YbUnARVGsDZQJ+Q0u2MezBOuOND6D3Q7adAUkbcGG8b/ES7OY+4p8JFprB82o eut072iO4ZTy0PA+kwXtfm2j/0Qgaq2QtWfn++dcpWsVxctoZSoFtlQHFF/hQF6sVpIS LfTA== X-Gm-Message-State: AOAM5300hSMPJ5dC5upN7mA7sysIL13DLj6p95bg8KlFOhyGFE+KtKpA pnmIuEasz43xCz7yVyFu1iIgYQ== X-Google-Smtp-Source: ABdhPJxGErTr5qdj/h+EXAH5O68jFfE2tqj+62XVCx45BXGt9Nz2IQt9L7atafYyKCZkdIT/G4UB5A== X-Received: by 2002:a17:90a:8a8b:: with SMTP id x11mr10404879pjn.127.1593411530770; Sun, 28 Jun 2020 23:18:50 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id mp15sm17957978pjb.45.2020.06.28.23.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:47 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 08/17] arm64/mm: Remove needless section quotes Date: Sun, 28 Jun 2020 23:18:31 -0700 Message-Id: <20200629061840.4065483-9-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 Fix a case of needless quotes in __section(), which Clang doesn't like. Acked-by: Will Deacon Signed-off-by: Kees Cook Reviewed-by: Nick Desaulniers --- 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 1df25f26571d..dce024ea6084 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -42,7 +42,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 Mon Jun 29 06:18:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630487 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 1D762618 for ; Mon, 29 Jun 2020 06:22: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 C6F9523131 for ; Mon, 29 Jun 2020 06:22: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="CeQrIZTB"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EwIeltjG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6F9523131 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=QjECSnDP6YlIsuibQgNPizHVLILVYNsBPmSOMADLOeo=; b=CeQrIZTBHZL6GucsBTl7xC1rI yhxUvHj79UlJbAHZ0pFe5txv9u4bXo9I79GCXM861zlUquPQjgGQxE0T0GZLpHyyDyPsRrpMKkhJl +rTvz7dU5Qxj/o7Y1SJy0buqmj2VRm5DlqzYEuO3N7Q5lZpRE15KMbuhies7hUV75xp+OBiONp2n+ oJj8OThgpBfip6dbffsQ/TYUwATcGjOmNmGle1yn1nzs2w+DwL9Y4hEtL2chmYTMiU+bw/ZVgdPPF JyZAe6wSBqNdOnraU8DOQYum14CrlgbO//No1SIpvt54R42DrCildTax3rqezDOeV+IuXc8b3aWRs ucE5qD8Dw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8p-00067Q-SO; Mon, 29 Jun 2020 06:19:43 +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 1jpn81-0005qo-Q9 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:02 +0000 Received: by mail-pf1-x444.google.com with SMTP id q17so7445857pfu.8 for ; Sun, 28 Jun 2020 23:18:53 -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=l2gkWNX3d66L/hKh2STsGvUucTtZJRcz4r/ewyLA14w=; b=EwIeltjGnlLT7TimPFoW5tYhE4Etaftjgk0utIv1DERQIoaBLaCrzZdEMEbl2/ko2L EIAKTruY9wYrBxsUO8J20gzMkX43dcOFiRkqGRmfq8OMnlhw0L7j5pNYBiu1NorElQCk 0rG1LKDuU8dxAvdd7b1IG3oEzj54pXm3LMXCA= 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=l2gkWNX3d66L/hKh2STsGvUucTtZJRcz4r/ewyLA14w=; b=ivNDfmxmkuLZjNXCMa/rlaWtm4g4q4cEvJo0C/OCo20b79GRBnvoAPSTTsLq/A2ltI ZqFLU7jpn104eegrkl3m2EvEEEaoB+UZE3GCYnA3llnRm2PBQWs7ZgA60gaTxbxIb6bi Ln7GBgSv0anUI5amW73H5YaXxxrUSoys/WcIPp3TcidJwKJukEslk6//DoVyl4JAPOY/ vL6Lfqetcu7AznBelA1w/xuMv9ALMXR0OjUo/y8aKdHP5kWzY5Q0QKhQf58/ERbyQb9o 3E6lkx8CrlfkJZwIjEKH6sq5pNhbMG3Ct9YgpgjIYNddJG1sEUxWQ0NijQDugTR6DBmc 84Mg== X-Gm-Message-State: AOAM531lp0wbp1kJk03EBDItnWfcbkx7H9PAGFG4yFq89SDfF6Y6F2jd jCg0/N0QFgvsFEQ6hgHFad+s2Q== X-Google-Smtp-Source: ABdhPJzd+VgRMDjRj70nfxA/PtEMQQFRxNgIvA3+idrGBzG3XC8iwLb7Qy3efrxK+yKVlZZEtao0mA== X-Received: by 2002:a63:7802:: with SMTP id t2mr9139650pgc.421.1593411532102; Sun, 28 Jun 2020 23:18:52 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d25sm28162513pgn.2.2020.06.28.23.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:48 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 09/17] arm64/build: Remove .eh_frame* sections due to unwind tables Date: Sun, 28 Jun 2020 23:18:32 -0700 Message-Id: <20200629061840.4065483-10-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 Avoid .eh_frame* section generation by making sure both CFLAGS and AFLAGS contain -fno-asychronous-unwind-tables and -fno-unwind-tables. Suggested-by: Ard Biesheuvel Acked-by: Will Deacon Signed-off-by: Kees Cook --- arch/arm64/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index a0d94d063fa8..895486606f74 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 From patchwork Mon Jun 29 06:18:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630485 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 53E4F618 for ; Mon, 29 Jun 2020 06:22:01 +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 0147D23131 for ; Mon, 29 Jun 2020 06:22:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y7CZM12u"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iVT4bBfQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0147D23131 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=Y7CZM12uhBsBUC7iEaigHUSus EbY4Xy/wTEqmKkIfbHfySs2RkLHEaE612TcqJcR+QJ7SST9skmhX8znlqNzhJ5u8m689Dr8mT5SKT Jvlh0bv64BOQhtjYAVcO7DrYMEqT6cl4BiZ4WYx3/EXn17vjDCzk86A+gLJnCFzLE1h9E4ciri32g 1fj8vpN8k+EJkDEhXDhh4ChbQ0eVGlbg8nrv03ylXjMqPqNRr3LIcLZ0PCk/7W7ZzWOR0BpW8yTne Fl30/bCHAsTnBHBhfal2i+o/Z0h9UDgoGZizrrucKKC1PlmvMawWtnoY5Gi8Hqb+oyXUBl7YuHIvE TovRdpW/g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8n-000665-4h; Mon, 29 Jun 2020 06:19:41 +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 1jpn81-0005qb-Ax for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:01 +0000 Received: by mail-pj1-x1043.google.com with SMTP id k71so4105066pje.0 for ; Sun, 28 Jun 2020 23:18:52 -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=iVT4bBfQ6leUk5glF2pMl9eJljlvaaSp/YPWKEyom1eoXY38lZNBJs89R68n/TkQRK VemoTUlkPcEIj0X5LaHDBpYNb6JR+gzylEyj/6uGQ0zrcsVW6Z2e50vFcw4/LufZ0RlH Rr1I65xQHvasMD9B6f8+m9p7uXXbJGaZKEgRU= 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=tA4tyovaXabGegU9I2LcaO3lkYWQNluB2xzwhVi7qS9kRzAHpG7zskW+06IZ0ppw3O DKbO5jenH111gJvckyFtJNXZSvKvncF0L8yMHb3T05v3Qx/Q/JSn5NdHOtjYHkC46ZDY 63a9y4FLVFm6pdKcIawoaT5yhOtvf/0FCXtCknEIeq793ibtBcWyp6dUTXVme/oD1B0t OSCJjuY9iae1zIj0w3/kDrjbs7JXh3JIEz5aohYNmHcW2aX/T7jw3AqkWcGU0JqHKLz2 Mvl+jhGXuL1vAF0e/JqYg8obBrajtvOdikf7UOe91NDSQdFg2+MrakOANwhiGlEgdD7z Qt2w== X-Gm-Message-State: AOAM530y0tkT88HiugBcTUcd/8Xnc3D644TLSpGflQ5jBlrNEuexts6/ wkNgYaSyEiCMokNETiugXxuoRg== X-Google-Smtp-Source: ABdhPJyhkXUuny1/EwAfUvLAv2Ye21VG04The4ylXZoGinmuezptDR1f9Ju6NVe3PkYUF+OdvxyLJw== X-Received: by 2002:a17:90a:d585:: with SMTP id v5mr15976566pju.38.1593411531309; Sun, 28 Jun 2020 23:18:51 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 199sm23398281pgc.79.2020.06.28.23.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:48 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 10/17] arm64/kernel: Remove needless Call Frame Information annotations Date: Sun, 28 Jun 2020 23:18:33 -0700 Message-Id: <20200629061840.4065483-11-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 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 Mon Jun 29 06:18:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630489 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 A65F8913 for ; Mon, 29 Jun 2020 06:22:17 +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 7C9C923131 for ; Mon, 29 Jun 2020 06:22:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="wN/W+ouT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="eIyxYRft" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C9C923131 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=Ql2rsqTzBiS47uYk55h6KN5BdEv71OlHNyDgsIOdXh0=; b=wN/W+ouTHXIprfrDlYwEpBOU8 GXj5BUp/xS8AWmIIAOmXnii6iahoT4hmcPlxgh1yx4B4rZdb9otG5jma3zuRvhyHrL6hW9/4x6Xx7 XO20yW2GqGquzbhTt0bopSfYJke9Jc+y51Y2E0sgIg1LeWxEXkfH5qJiy1TviWPvlY0vWkcoU+kdS QY00WBPDAsPqSnHYhyOuAkCrtwd0lA+r1HOSO2blKGObDGjTCY5HVCcw3e0bsyBmrF+xE3eck/oqM EbgpwzWHqxitDlDempeZJEOywTNpZvhcI71yipTxJXXq8p9c2Y4+nUQDHtQTgJME42GanDAcoUyrv ZnHJnoKzg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8w-0006Aj-T5; Mon, 29 Jun 2020 06:19:50 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn82-0005qu-N7 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:02 +0000 Received: by mail-pj1-x1041.google.com with SMTP id h22so7569409pjf.1 for ; Sun, 28 Jun 2020 23:18:54 -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=UIGzgreIfTFOxxrVnfdOtVBSBIsQ6xr6g7mQ/APcJYs=; b=eIyxYRftnOui04V4XDgcCKRZPnSL1iLVTOLK21hciuVaKMrlO/me6I6zabNcmW51hm sEP0n59JEFsgLPSQ4aRAQ2lJpdfBlUFjFZ+BQZG9PBaB8aynL14Bhv8xALE7JNi7Dg0C QWW2xnjqIifsayeGW/Ay6Sbs+HR/6nZ4+JWWg= 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=UIGzgreIfTFOxxrVnfdOtVBSBIsQ6xr6g7mQ/APcJYs=; b=FmOeS1JJ2nVonRaJQOn4tJu0NZ7jb0WRvHA3q+KC6J0R6xzjKJ0GMl+Nf1HlADYngO 7baUl1mNm9u8IflyLSfDEGHJxKi/0GiK9IREJXLDG+jGk2WR8fsOfu9AlDAQiK7K35W2 7RUCPb1lgoxCKnPwo/Cs83pCINIo8f9H1v0qXwkrtOEDhAG7f1zwyLxaFMaSX2jInRLM rFpDQKFPip4Y7DjAr+pdEJcHSizc8qORjiLyIyNRMZptFUaE0ZaGppCmX94X+jFJrDFU romEtN3+ycSR4ox15h+CjvWLaDJFybfXdF3yiv5lgISG3k9h45Hk9yzAnawop0h0H11C D/Cw== X-Gm-Message-State: AOAM5301CED2xxV6jKEjNcAVgVwHPWl3S6Bft6V8UwrS/e+L0Vh1gl9r ulQymtVVZB5IlJPMQn9v1J+60Q== X-Google-Smtp-Source: ABdhPJzz69mu7O4q6VbFBjTvIO71CEyN6mZuFliZ3G3JlPVzh4yITRE6mx9hV24nwgpSONTnA4Ny3g== X-Received: by 2002:a17:90a:1781:: with SMTP id q1mr15164767pja.24.1593411532684; Sun, 28 Jun 2020 23:18:52 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d18sm7737172pjv.25.2020.06.28.23.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:48 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 11/17] arm64/build: Warn on orphan section placement Date: Sun, 28 Jun 2020 23:18:34 -0700 Message-Id: <20200629061840.4065483-12-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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:1041 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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 named in the linker script. Remove .eh_frame, since there are none left. Add .plt, .data.rel.ro, .igot.*, and .iplt to discards as they are not actually used. While .got.plt is also not used, it must be included otherwise ld.bfd will fail to link with the error: aarch64-linux-gnu-ld: discarded output section: `.got.plt' However, as it'd be better to validate that it stays effectively empty, add an assert, as suggested by Ard Biesheuvel. Explicitly include debug sections when they're present. Finally, enable orphan section warnings. Acked-by: Will Deacon Signed-off-by: Kees Cook --- arch/arm64/Makefile | 4 ++++ arch/arm64/kernel/vmlinux.lds.S | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 895486606f74..fb3aa2d7de4d 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) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index b5a94ec1eada..320ba5ec2adc 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -94,7 +94,8 @@ SECTIONS /DISCARD/ : { *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) - *(.eh_frame) + *(.plt) *(.data.rel.ro) + *(.igot.*) *(.iplt) } . = KIMAGE_VADDR + TEXT_OFFSET; @@ -244,9 +245,17 @@ SECTIONS _end = .; STABS_DEBUG + DWARF_DEBUG ELF_DETAILS HEAD_SYMBOLS + + /* + * 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 || SIZEOF(.got.plt) == 0x18, ".got.plt not empty") } #include "image-vars.h" From patchwork Mon Jun 29 06:18:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630491 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 5386E913 for ; Mon, 29 Jun 2020 06:22: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 DB2C023131 for ; Mon, 29 Jun 2020 06:22:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R7jCVAqH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XBLhEqs6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WAur6F+G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB2C023131 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=OQXzY7Wolz2HpDBNuILkXbvNrnyz6EZy5NZ6qyA7BgQ=; b=R7jCVAqHQJUGfCO+iTZ1/CCCu dtVzf57ZWLDzAXCoOEfxmZDBt7WKnQm1wHZG8ebavgX6nwKPx86waCB413HkgUgCJQ7Z3J7VhDOG4 cHRPRPQJu8ZQRjZ4yd98/tqp4fwvRuLClpALiZZ5P96OnNhsWyhrrZxkzPMQT/Zin6MTgg72kuDJq vw+TR93yLzul3LSmgh3FxwXmE0RYZh22CaOaYB66gEnqY/XNRGdPRxEAZwePzuK5lWX5IyYavuRXS DCt2xco4XtiDjejwp3EuZpceL+Yj3khFdmHbeb61ZASJ8EvDc7kU+rPbHqVLTu39UwvQQZ9IJst9a /FubSNzhA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8z-0006Co-Qb; Mon, 29 Jun 2020 06:19:53 +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 1jpn8B-0005tU-1s for linux-arm-kernel@merlin.infradead.org; Mon, 29 Jun 2020 06:19:03 +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=zbmvLfTE9L6uB1QeuLicstyHsAYPZqeThcBTspx8dsE=; b=XBLhEqs6QgdzuIplrJzdpGQ4pV UgHDDFmEv+TfTtEH9N9DH5ivX1k6KyIZoaSF7XybpaOZgoXmlqlRBi7vzl/FGjmt0+OrU+Z1jFpj/ E1zFl0LYPbzi0IpFpcTnFc2O0DgXYEN1JDMTN6EksN69ZGMbj919lCfC3nn+iOepcCo+hiJlOwBrA JX+7ivgVfFBd+xSBSZCH6nWf07Ghkd7qIUILN4XT/584MhYObXFNUZ4Hmp8NgldEwfW3UywWFEBe9 ABMKPHX7BOZGpOJ1P78vptVHLscPTczn++bhCH8U9d4yCVgXvyIC3b4QSPfg4k46cN7QoRO9btWHU KJ2XMjWA==; Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn86-0002kX-BR for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:01 +0000 Received: by mail-pf1-x443.google.com with SMTP id t11so2591921pfq.11 for ; Sun, 28 Jun 2020 23:18:55 -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=zbmvLfTE9L6uB1QeuLicstyHsAYPZqeThcBTspx8dsE=; b=WAur6F+GWFNqabvWetrOIjwqeCKciP5tB4yziNtRgHbUBWnFYsk+PWnQg0rPnI1y+g L9/2L8LDp87Z/M1SaT4HH8r+8tUNDRfoRgnG+GLIbasGQzjvCK70sg2txXh3pnKq7xZH dgJ/3navMjpE0lZYo7ggt1P0ejy+Ucz+w7giI= 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=zbmvLfTE9L6uB1QeuLicstyHsAYPZqeThcBTspx8dsE=; b=uCJsMEEVeZ/YkL8UkqX/7aFFuhbQK6pVeSujacPTuPKWGhiZkmHdImxU3c1ZmLqC8r +izBwrNmnihj3fvYS63gJEWKvQZKFCxz1b+8Bo0rMmiYrSJrSnHOmqmdIkOcQyVvrhSA kEI4LnfeYns9lUnNgFbz0FJb0sbd1/Icu1MNJM/tTy7Imul6n4D28027PjQybkfQJJbN ebiQoAdhg4CnW2g5WhTtiLba0/mapJSUqoOhTlDJvsn+ARd7ErTv/Dm3UGE3Yl6wDwF0 4sPdK5oMid4ECRzmwmtRh+jcaZdf4o94gyd+s5rmYpJjlEXQcDAE1FBMq6dt4zTJxZgk Rh0A== X-Gm-Message-State: AOAM533Qchb1tqHYFqqMt6gqPVwWAPUyvw/14voQXSBYUJbe6lmu7P1y cw5l9fkPl0kDffAQIjiEMcs09g== X-Google-Smtp-Source: ABdhPJzPkKoWIedag90LUswlw/9FOCURl1w95dlknpWPuvDM08OSsAriAcGrqOlQQRubrP3Iw59Dwg== X-Received: by 2002:a63:d208:: with SMTP id a8mr8881051pgg.351.1593411533472; Sun, 28 Jun 2020 23:18:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id hg13sm5486603pjb.21.2020.06.28.23.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:48 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 12/17] arm/build: Refactor linker script headers Date: Sun, 28 Jun 2020 23:18:35 -0700 Message-Id: <20200629061840.4065483-13-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200629_071859_177416_609B2276 X-CRM114-Status: GOOD ( 14.36 ) 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:443 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_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.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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. (The ARM_COMMON_DISCARD macro will be shared with the boot linker script in a future patch.) Signed-off-by: Kees Cook --- arch/arm/{kernel => include/asm}/vmlinux.lds.h | 17 ++++++++++++----- arch/arm/kernel/vmlinux-xip.lds.S | 4 +--- arch/arm/kernel/vmlinux.lds.S | 4 +--- 3 files changed, 14 insertions(+), 11 deletions(-) rename arch/arm/{kernel => include/asm}/vmlinux.lds.h (95%) diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h similarity index 95% rename from arch/arm/kernel/vmlinux.lds.h rename to arch/arm/include/asm/vmlinux.lds.h index 381a8e105fa5..142c038b2e97 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) @@ -37,6 +38,10 @@ *(.idmap.text) \ __idmap_text_end = .; \ +#define ARM_COMMON_DISCARD \ + *(.discard) \ + *(.discard.*) + #define ARM_DISCARD \ *(.ARM.exidx.exit.text) \ *(.ARM.extab.exit.text) \ @@ -49,8 +54,12 @@ EXIT_CALL \ ARM_MMU_DISCARD(*(.text.fixup)) \ ARM_MMU_DISCARD(*(__ex_table)) \ - *(.discard) \ - *(.discard.*) + ARM_COMMON_DISCARD + +#define ARM_STUBS_TEXT \ + *(.gnu.warning) \ + *(.glue_7) \ + *(.glue_7t) #define ARM_TEXT \ IDMAP_TEXT \ @@ -64,9 +73,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 Mon Jun 29 06:18:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630493 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 A66B8618 for ; Mon, 29 Jun 2020 06:22:30 +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 7F32223131 for ; Mon, 29 Jun 2020 06:22:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aDBsKpJV"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="OngKzCoB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F32223131 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=XdtgsqJ4hyy6V1S54oTwx3MtdZCenFc6tg34p0lIvlA=; b=aDBsKpJVdbLeIgdzo0t7KtFDk tMWW4/atdhSq9BF8FW3LYIE1hJLAWBMNzWHXFRpCpMdRW8tp13zhzgKJzEjMuIVL/qleC3U68l+te hFH8uXnYu1V2O9LV1KaFY8hyHHqAhVUwKcG6Sbr8+t2hOlIaOlWvR5Bk50mtkWaDycQNV/U7inuHk s42+3SyFsb4M1YM6iltUkV1S43H7AxzBzem1QSt8fvZF/hlisPOubQEJ1lnBiddIohgn37C+FDSM5 56mjiXwcdNL0SVXxU/M/l25Y5+2TFdhWY7zO5ejZ+SdnNtyjj8MMlgfYjxtOUU12daeLBuxaUSKIO W9KLANXbQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn9G-0006LS-Gh; Mon, 29 Jun 2020 06:20: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 1jpn84-0005rR-4K for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:04 +0000 Received: by mail-pj1-x1043.google.com with SMTP id q90so6809343pjh.3 for ; Sun, 28 Jun 2020 23:18:55 -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=BRDUZAq4KUcmg3RU1pc/3G6TWWMMmiH07CaNiCk63dA=; b=OngKzCoBXRqpXyn8tClMjtqQlL/nJZ8uCSAc2Uyi9PLl3HjxTANENeKwIhCN2JPXoz FqUJVg+Y//PmO6nzCQnijna217nrwyVXepnIQ7lbRcXB/8nfXPbQWgx0YonaDZwf2N3K MGQhaY3XJ3eFszdo735YBZhEWggFpEUOFM+H4= 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=BRDUZAq4KUcmg3RU1pc/3G6TWWMMmiH07CaNiCk63dA=; b=ik9ykXAUAynWM/QJafOT9+o2xCgZSr3/Uv3/kExBHquziZ6ST0GMBKzPQdKzzuQ1zo T65UuTyIKgaz/kP9whlQM1EFxmylxchvpTGfuxjs6vAb4WqAdWN1zVAuQmIE+bQ+y/sn P1IPL5PmKHgJJSA9lImBIvsn0LzS+EKXDxNNb7x6CP5GJ6aK9biGD8TlhkjzqYxcIxIV fOniBdBsMesabPOy8p+Xpp2ZiDbbVrm3xCa/KyRACDmj1N4O8ZAiEfleFT9w50yA+AUv cGHpJeTt58+kUr4LQOoA/uFvzI5oS3tdh+hlQEcQrc+j66sxwquFoEqT/BQLrlkkpefN PEkw== X-Gm-Message-State: AOAM531ZWEjuVE7IgFgMRYZk82yJ3iONPswproDjIioDj8wySSP1nNc2 khTN0aKcyminnw9Z6TyXr4WmIg== X-Google-Smtp-Source: ABdhPJyTzjKhJ/zzQcZEVxeXeWaUAlazIn3+rTaLERzJPA8cqWvdjUBBdLJDKJzE0WfVi/nz5T2VDw== X-Received: by 2002:a17:90a:d809:: with SMTP id a9mr676907pjv.74.1593411534348; Sun, 28 Jun 2020 23:18:54 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 9sm16588148pfh.160.2020.06.28.23.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:53 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 13/17] arm/build: Explicitly keep .ARM.attributes sections Date: Sun, 28 Jun 2020 23:18:36 -0700 Message-Id: <20200629061840.4065483-14-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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, explicitly keep the .ARM.attributes section by expanding the existing ELF_DETAILS macro into ARM_DETAILS. Suggested-by: Nick Desaulniers Link: https://lore.kernel.org/lkml/CAKwvOdk-racgq5pxsoGS6Vtifbtrk5fmkmnoLxrQMaOvV0nPWw@mail.gmail.com/ 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 142c038b2e97..c66b16cd8837 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -56,6 +56,10 @@ ARM_MMU_DISCARD(*(__ex_table)) \ ARM_COMMON_DISCARD +#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 Mon Jun 29 06:18:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630495 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 AFBD2913 for ; Mon, 29 Jun 2020 06:22: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 8970D23131 for ; Mon, 29 Jun 2020 06:22: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="JAeNmqsR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="T04fL7iR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8970D23131 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=H7wvAGH3RMzEsfE1u3cyV0xAvlLKljQNxnVDcEQOtnY=; b=JAeNmqsRAO1Cl1PtjlZKOiOVk lx4VotTcqvEGnEw128IMDUxZ6+xKDXME5cVfeViHD1Svc7ZfPvxWh1pI6HGe+TMM/+GyEnD1foLz0 Ahfcdi8snEapYOWqjsABDKYTzEvRN7FbQiBTXUpG5pi7fIU0pBwGf9WkKgLYAmmvg1HmXsgK+186n sXUO98PGL84r1eTviYuznAJ5wvF6csp5WDHfwnZl7mWw4l7hZdJb1cZgwN0ciMMhb+FX93Zki/MK9 5g4mcN4342uF36bVP4Dp6ZJIHRulNhkZm6S67GI2QBxru2k789b99qb09KjJPcKjf6N5UuCKlgT90 e928s1YLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn95-0006Gf-T1; Mon, 29 Jun 2020 06:19:59 +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 1jpn84-0005rb-JT for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:04 +0000 Received: by mail-pj1-x1042.google.com with SMTP id i4so7574612pjd.0 for ; Sun, 28 Jun 2020 23:18:56 -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=HLLAJpxJCKF6GpXYjiXBbb2388G9eZDwIJVZRHrbyec=; b=T04fL7iRnuJApQe2EOioew1j5Rlr2BMoJuzctdqWei6PMaoDnLB/LdaL5P+9eTJj3D hrhcKHRUxkUBOU51xp8O7g+QcmVnD4KGJx8EsFA75GwrbM5HkoASL8Vcva2ox1Rzzz8T u3NLRFeCUaao3XeiyLsPIVvzOAhdDEbGOuEs0= 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=HLLAJpxJCKF6GpXYjiXBbb2388G9eZDwIJVZRHrbyec=; b=U/N8AlaiXjRkyP3uF8kyJD5MFEgsPBPlEKMAfbYuYXhN8dWAMYS4XJ1+IXun2rwxEI 27iYJnbpkjdtf82zzRStUOI7JDaC8w8WL9BzSoejDjRMg1dYAE7r1lSDiCjov8pDzN4k F51ngOr4qeu78NMPm51xrydfF2s/oAbu/CAPtOVsdAkrHStwGKDVpcSdBwSPWYYlgQc6 /A6O5XGz+Ap5E2Ye8xGaiv9UCZawR5LZo/mgewtxJw0JXwSr90xM9QMbESV2FUBSYnPE 6uZbsjuUUT6oTa5BngZ3oZCSKTS94be81wWvQ+pK7F17r0tK2M9nmgA3oIRtkLqZjstQ 0nvg== X-Gm-Message-State: AOAM532iRs4+4mZ027nJdiJcnZ0Evqk07e7/M2XfLDShdda8Zc2UaZGP hsflWVRtmx/RFVuddE/+NvevuQ== X-Google-Smtp-Source: ABdhPJwNjvgfAOOh8VJ+onDG+dXJz2yzAp0DTMkKIotRBmI0ZoNMLyWXjjtPuqVD4FTZ8qL5j5J1DA== X-Received: by 2002:a17:90a:ed87:: with SMTP id k7mr5586555pjy.31.1593411534865; Sun, 28 Jun 2020 23:18:54 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g12sm4460965pfb.190.2020.06.28.23.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:53 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 14/17] arm/build: Warn on orphan section placement Date: Sun, 28 Jun 2020 23:18:37 -0700 Message-Id: <20200629061840.4065483-15-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 named 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' Discard unneeded sections .iplt, .rel.iplt, .igot.plt, and .modinfo. Add missing text stub sections .vfp11_veneer and .v4_bx. Add debug sections explicitly. Finally enable orphan section warning. Signed-off-by: Kees Cook Reviewed-by: Nick Desaulniers --- arch/arm/include/asm/vmlinux.lds.h | 6 +++++- arch/arm/kernel/vmlinux-xip.lds.S | 1 + arch/arm/kernel/vmlinux.lds.S | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h index c66b16cd8837..d44fae722e7a 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -39,6 +39,8 @@ __idmap_text_end = .; \ #define ARM_COMMON_DISCARD \ + *(.iplt) *(.rel.iplt) *(.igot.plt) \ + *(.modinfo) \ *(.discard) \ *(.discard.*) @@ -63,7 +65,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 Mon Jun 29 06:18:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630497 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 77E93913 for ; Mon, 29 Jun 2020 06:29: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 504F123132 for ; Mon, 29 Jun 2020 06:29: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="b/g+UtMp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Dr3LTyOc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 504F123132 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=oIHHrIwaQC/mWLX96/KXXmdM/ctmKeEQQ+jgzUW6CIM=; b=b/g+UtMpMTfNQ2LD9kJVnemEv QTJAI886TTfHcBVMsYgpHcxcqwzBBZK1tVmj5Z6EO2/e8naY/ufLlFjLns3w/Kp3VoH/IOrMj2l2X 8q/OD+gQzY9ijq+vT2YUqPRIhyqAAjXdM6CIvYATPyJSpQk02Rr6xbk6TQlQd0JsG6LLQ+XnRfamm l48GD1kwAVq4Jp9RPfXHhX8HQI0ZMM4Tz+eZnKKQEI6xIZZazJkUuG6T8mh+N+fkQKUxNin+mC28C JWZ43ef9P5xV4U5SqpJKg9iGMXa/d0uRoz7Nq9shsUcLBeev1FLc3/LgbgKBcx8lVEju6XKwCCxtx CEBOHtAhQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpnGS-0001SY-Hi; Mon, 29 Jun 2020 06:27:36 +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 1jpnGN-0001RQ-0S for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:27:34 +0000 Received: by mail-pf1-x444.google.com with SMTP id j12so7449282pfn.10 for ; Sun, 28 Jun 2020 23:27: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=sXG3FvFqQ5OV+ZXnRU9R+TEF3U1pZeLG1jvNfenb62s=; b=Dr3LTyOcepWrlYRx1KeZt7WsSGx24iQgQlE3vgItGgcuCz/Qqv46uWAW6jcWneSu/A 9yJ4dGHFVjLf2NoUg6xQd5a/3NE5S1FrFk5DcfZiZPXYfccXmblBSblmRC0P4wvwmqBH ftFfk372fYI5M6GZiMGy5dJeCBhJDzsm2KTgQ= 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=sXG3FvFqQ5OV+ZXnRU9R+TEF3U1pZeLG1jvNfenb62s=; b=CRqx43k23vHSdZtgpAPlY+sUXfyBPLPTSo6+kleAaLauWC4aDDI97FOyfpVOXJJaZo Cz9SOrihpbd0W5amUQ38TZw+U6gG29dhZiGkgDHtwL/IeYKPaspHJ9Gvsoi2eE2RHhQt VLw08AoMZtf8uh+8ezNW1SDSWZusccWcCLkS4KRGXt6zBL+t1NKU5OVpu+/0Uxe6FCVS KBVLLjxs8ul2sIp2Gs11IRdqkNfblBqrr+KYZ8m01rIBIxFVksSaL7srCAdL1L8dPzAs 3L5QCAVF9EfpFi2fNQKsqA2LhW3au428d6yLlBGWFqWDPL/IXggi2QyAb0sqs/tvXRpB B1wA== X-Gm-Message-State: AOAM5331mY4ELhu84o5OOMJ/NUUg7/HxKHm9TGHwiyBTCNuZpdkbQo2L fCkdr6XEuCD9NWpFI6iQgrW7Sg== X-Google-Smtp-Source: ABdhPJw033T79hmEnu5HLxCntZo9NI1/QGQweu55S6/mFEtAwjTX8shGo4HSRGOPCLPo2/+Sc0ET+Q== X-Received: by 2002:a65:410b:: with SMTP id w11mr6271531pgp.65.1593412049107; Sun, 28 Jun 2020 23:27:29 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s9sm28713610pgo.22.2020.06.28.23.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:27:28 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 15/17] arm/boot: Warn on orphan section placement Date: Sun, 28 Jun 2020 23:18:38 -0700 Message-Id: <20200629061840.4065483-16-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 named in the linker script. Use common macros for debug sections, discards, and text stubs. Add discards for unwanted .note, and .rel sections. Finally, enable orphan section warning. Signed-off-by: Kees Cook --- arch/arm/boot/compressed/Makefile | 2 ++ arch/arm/boot/compressed/vmlinux.lds.S | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 00602a6fba04..b8a97d81662d 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -128,6 +128,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 diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 09ac33f52814..636e9ceb79ec 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/ : { + ARM_COMMON_DISCARD *(.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,8 @@ 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 } ASSERT(_edata_real == _edata, "error: zImage file size is incorrect"); From patchwork Mon Jun 29 06:18:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630501 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 24936913 for ; Mon, 29 Jun 2020 06:29: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 F17A823132 for ; Mon, 29 Jun 2020 06:29:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oLcEq2PP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jRyLPLKJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F17A823132 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=tBZrMEke6t8qegnnLZO2D6HQ5xppTn4DQDsKbyjl4AQ=; b=oLcEq2PP4868RzPbi6YZrFydQ Hot323AZjUmoILzqufMPEAkpASy8QgCACuFB9n3qwRL2eWNM9f5J0MlQqjhu6p3xTnEbBTeyoZSrq LbKmJ+kP2mCj5QOGKy4EgK1+zuMACK4+Ob9/9o3L22LCK3jjllCS8B2Xr2lgZB5U9ZttfrK5K/8rI 6JtNXdlQlCSXgkNw9iA+GvT41Jgenf6p6EZIIVcX8Kbh2j90wvikwl7C+73ZQpAQNTknDOUTEKidZ At6IKmxGYP14tQEuhVe6Z6RO3fIVNZCrUSz0rtRl+q5ajHES90uSLy3GLuGGx55JFethaorubu5vu 2xIXzfm0A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpnGW-0001Ta-SG; Mon, 29 Jun 2020 06:27:40 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpnGN-0001RS-Ds for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:27:34 +0000 Received: by mail-pg1-x544.google.com with SMTP id f3so7846746pgr.2 for ; Sun, 28 Jun 2020 23:27: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=OcuGTfSUXtPYMFfpENNYu5S2NR6isuQ9uC03+go4k80=; b=jRyLPLKJ/wflGnWNIhsw1/xtdO++qU/4G4jZjo+lnOqYVWgtIzMYOnTwQtGOp4VTv+ b8zRHjoyL25oKD4tWfpH43lrpeGB8egY2xI+HOcY319Hsy/yzaeePZ8YwW/uqTnkDoS9 fbCN5nnFFpuj2qqzr47ls2rlOBAuxjOrocN5I= 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=OcuGTfSUXtPYMFfpENNYu5S2NR6isuQ9uC03+go4k80=; b=sn4HQ28x/xHnaCd8SwgcXlKPYYxzqB6jeIHMpQAS/0Gv/1KzmsXopScG6rJ0yysQd1 tr61vsCuQkvhduJKjebfiidlXrtD4k9gQum2u5crsgTp0X78tl4H7Qws3X03zxIKOXum 9Hk6+69aq5cBLus5IBDjHTLXB19M8Uos89AroCGq1e7XQXHFNc3ye+onLZjMWmMpR/i6 WYsfeE58YRc7prTCSu26BMXq+Gmxfngg1nrw9HTFlXZkHHODtjMSMAtlQiLA5ocbb7FP HClJLRXhkcEvLjK2q3uPjxLc4wzfCISyYKAeq7YkJxuroW39q4HixM2yEYd+MneXEo/3 iOhA== X-Gm-Message-State: AOAM530TB/x42Z9QPZ510bqVOHViPJk1oWyr5y/yTLmQ9Xx5d2y7rufZ C8wFh/bN3rYvVTwUWEqXPUNaNQ== X-Google-Smtp-Source: ABdhPJyp58Bg9f7GuaQUlT4KpenbA1Jul+PfAUND8VkiaE+umM/0tCY0B+FCqda7VoHqscVan5uu+w== X-Received: by 2002:a62:1646:: with SMTP id 67mr13176339pfw.281.1593412049613; Sun, 28 Jun 2020 23:27:29 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 27sm18066808pjg.19.2020.06.28.23.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:27:28 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 16/17] x86/build: Warn on orphan section placement Date: Sun, 28 Jun 2020 23:18:39 -0700 Message-Id: <20200629061840.4065483-17-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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:544 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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 named in the linker script. Discards the unused rela, plt, and got sections that are not needed in the final vmlinux, stop emitting kprobe sections without kprobes, and enable orphan section warnings. Signed-off-by: Kees Cook --- arch/x86/Makefile | 4 ++++ arch/x86/include/asm/asm.h | 6 +++++- arch/x86/kernel/vmlinux.lds.S | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 00e378de8bc0..f8a5b2333729 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -51,6 +51,10 @@ ifdef CONFIG_X86_NEED_RELOCS LDFLAGS_vmlinux := --emit-relocs --discard-none 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 + # # Prevent GCC from generating any FP code by mistake. # diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 0f63585edf5f..92feec0f0a12 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 # define _EXPAND_EXTABLE_HANDLE(x) #x diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 504d16968ed8..52e2b4952a0b 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -413,6 +413,12 @@ SECTIONS ELF_DETAILS DISCARDS + /DISCARD/ : { + *(.rela.*) *(.rela_*) + *(.rel.*) *(.rel_*) + *(.got) *(.got.*) + *(.igot.*) *(.iplt) + } } From patchwork Mon Jun 29 06:18:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630499 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 CEEF3618 for ; Mon, 29 Jun 2020 06:29: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 A6CD923132 for ; Mon, 29 Jun 2020 06:29: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="QtZi9Iux"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KCQ5YzkO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6CD923132 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=5+DmG4MNBZQcFM6nUl908mbEPPNEa9rvsp/dbndijQU=; b=QtZi9IuxJr+oJ6wPJli9P8kJ2 C7ggWGgckH0W69uMHdaon/85zNfBqklZaGdhYefgplU2hsxIZJtJSz2jbJvC3f1euEMCoqoCwdzJ/ EvintdtFEqhRbFygXlN3DU/KopZB26ZOf6/yj8MT5Ari1gWQ7qKH3cSzYVLGjK+ffzEMO9pB5tiVi zWjB5ss5cw1fKvPV1Ut8Ql7uV78GHq/7qF3fubZ0BqbbD+op26C39CYudzMQ5ahGyrQTR7ZWZZl/m J6HPPTqeps5RSjp+7012xmszyrL9oSH84DB1TeaL1DsERJQI7zx1/3HnzF4g6yHfiRQgYxHifHLnG y9pUhArTA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpnGd-0001Uf-Kg; Mon, 29 Jun 2020 06:27:47 +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 1jpnGO-0001Re-Ij for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:27:37 +0000 Received: by mail-pl1-x642.google.com with SMTP id u9so3086619pls.13 for ; Sun, 28 Jun 2020 23:27: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=EO3sRskvzqVrSi/8WlTJ+nKIw1S19eoepjwOuVzqC+k=; b=KCQ5YzkONWOo65CEsckxdgEZDidmsxzkUPEN/UJBCW/qObWNXMfEoB9r0/E7rvaRmO xlnRluaPTdkLMjWOJpH+yUIspSAOF0HgZkzvSgs47FWa+/kG7rzViG86wdee3s9jODiH uu4zTKxTboSZHSRTNaUsgRAj4+LH6Z0yJ6Lok= 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=EO3sRskvzqVrSi/8WlTJ+nKIw1S19eoepjwOuVzqC+k=; b=GqtC8Et+do4RUU5LUmHVUM3tkY61SIQpV4AhlA647ByLvDzyLQEj7sPXNxS4HOFBhM zXJx0BHtXbfTJMrMebW7uYvZHCdk8Ba3jsWRHhFqmsBFcobSakQZHH6eJeq7sxs6GJBI p6MQ1dCEswb1EXKuZBoG2afSmB6fhmWGqhpmj2jHTlDu6K2IlQehYxZ/mwVnf+hz5oLc A/1cyWut577RzBwt+xPUToUthwhjBj/8zBc+Zq8GJIpYL4TuBi+SQwwO8s7hdUn97Xla eUq+j3/C+TiismhNCGKIjbEJWutNUvwyezOjGkKKfNrfsVqBB7D1zOEB8HWhuJXH/aLT TkzA== X-Gm-Message-State: AOAM530/hZty5Q4jK3xkg8/a/Hio1y5ci5gThnJAr6AQZCkv1HDrsDdB AIV2F6S3R/tqjUyFl4JtMwnDLA== X-Google-Smtp-Source: ABdhPJxsnK2AsNvKawVoNrn3+ksDPrZ4SCYduO82/RDQuADusHJqjvhs/5ikZAbuEc8CjzSaMNuCrA== X-Received: by 2002:a17:90b:4d10:: with SMTP id mw16mr15789032pjb.143.1593412050567; Sun, 28 Jun 2020 23:27:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h3sm19838700pje.28.2020.06.28.23.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:27:28 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 17/17] x86/boot: Warn on orphan section placement Date: Sun, 28 Jun 2020 23:18:40 -0700 Message-Id: <20200629061840.4065483-18-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , 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 named in the linker script. Add the common debugging sections. Discard the unused note, rel, plt, dyn, and hash sections that are not needed in the compressed vmlinux. Disable .eh_frame generation in the linker and enable orphan section warnings. Signed-off-by: Kees Cook --- arch/x86/boot/compressed/Makefile | 3 ++- arch/x86/boot/compressed/vmlinux.lds.S | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 7619742f91c9..646720a05f89 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -48,6 +48,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. ifeq ($(CONFIG_X86_32),y) @@ -59,7 +60,7 @@ else KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif -LDFLAGS_vmlinux := -T +LDFLAGS_vmlinux := --orphan-handling=warn -T hostprogs := mkpiggy HOST_EXTRACFLAGS += -I$(srctree)/tools/include diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index d88612e3091f..9afb8737896f 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -75,7 +75,17 @@ SECTIONS . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ _end = .; + STABS_DEBUG + DWARF_DEBUG ELF_DETAILS DISCARDS + /DISCARD/ : { + *(.note.*) + *(.rela.*) *(.rela_*) + *(.rel.*) *(.rel_*) + *(.plt) *(.plt.*) + *(.dyn*) + *(.hash) *(.gnu.hash) + } }