From patchwork Mon Jun 22 20:58:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11619109 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 3C27E92A for ; Mon, 22 Jun 2020 21:00: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 14C342073E for ; Mon, 22 Jun 2020 21:00:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Nnk6hALK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WmM8TNdW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14C342073E 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: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:In-Reply-To:References:List-Owner; bh=DvzjWBvQ61e1fsP1e0rasa1qHUSJudx4NV9cPKI2bTc=; b=Nnk6hALK/XOUYpi/ji+tWmW9ST r7pAx803aPR8luK6+QejLwtkmDn1hupxt0kqpmcqg58v0MLLdRGKKRTDQxFOiiafd/dGM8rMwNZjr pP522U8GP7FrxysugnS+pVpIRef7hRlXmn0Io2wWVd2P70y/cBlD3CEiHggizx6TdycYi6R4ootVb 9f36xDuAiJk5fmJXj5hAEpbZl+7xhyIsd8+tb4uuhoEnwZ2Xu1a/wXU4aAgbYyRRzkhfF+0kq1Brw 6RkexLPzLEC3zM1yU3oXl/DRH0dGyJuOoVv33+upi6jhro50eNjWsvvAcTJdRYNVpBD1ep59GIVFM QGmrRcKQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnTWL-00081v-KJ; Mon, 22 Jun 2020 20:58:25 +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 1jnTWH-00080e-4L for linux-arm-kernel@lists.infradead.org; Mon, 22 Jun 2020 20:58:21 +0000 Received: by mail-pf1-x444.google.com with SMTP id f9so128161pfn.0 for ; Mon, 22 Jun 2020 13:58:20 -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:mime-version :content-transfer-encoding; bh=sr/y4QHqS3xWZ21Wk9dmfyjZQ6LCrqk5iTqq4P6aiwo=; b=WmM8TNdWG84hPEFWUDsKw34SbwMoHJGCkVUzXg3ZdgN8UD/bP+6rBTWVdCr5Wsp15J 6AlfmTpIQhIMClVDzD8TwSa8yS2rDMux5VFEp8jrbqJuUaaJ39FhfqqQTFV/X17VWWAr K2XYiZnqvq6p6KDoguyzLJH2rGdaXwGqh+hHw= 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:mime-version :content-transfer-encoding; bh=sr/y4QHqS3xWZ21Wk9dmfyjZQ6LCrqk5iTqq4P6aiwo=; b=BNPrpJTn0rDSHmBpuQg50ITLXQPnMT5Anb3OuB/Bx3DisXMX6VfbxshjcQVAYXJjqk 0cV6JLGewp9NJhqHHhz5ZylUIn45nYFescYpcLFLCdK6LI6ENs4ujJXGUDXG/6I7s4eY NiQgL9lVYj/SelotJKhkYd9a5rWhIwCkjapbYuwK8CadNSo+TRguQyn9HsltpCz2Prsf zWPKyl2EEN66Nbp2JPFNILeeiZwBx2hM51ML/3O35YOfZ7elfK1a9StL0fppzx7XZvlo Flx7pwXVNS9x5reF9ZJnx7vAJpUz3aWVD73A+apmUMrQyVabyNavNVlSjJ9QpNqEwQLI +/kQ== X-Gm-Message-State: AOAM5328GJxZg1mG3TDynNaiSQVdMazEE7XMoeoeHSarZ2u1YmbmX39P bNJmiPcSPdNI+CBUQpwAnN/1YA== X-Google-Smtp-Source: ABdhPJx/lBXKAYI7OT5DdVExc1fQfkJQ4YxcA7LRSDhA9xjX0BHqXWPN7q+irCe1VtLaI9esWOsLKA== X-Received: by 2002:a05:6a00:1342:: with SMTP id k2mr21694841pfu.32.1592859499131; Mon, 22 Jun 2020 13:58:19 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u25sm14560176pfm.115.2020.06.22.13.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 13:58:17 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v2 0/2] arm64: Warn on orphan section placement Date: Mon, 22 Jun 2020 13:58:13 -0700 Message-Id: <20200622205815.2988115-1-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_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 , Kees Cook , Arnd Bergmann , Catalin Marinas , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, James Morse , Nathan Chancellor , 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 v2: - split by architecture, rebase to v5.8-rc2 v1: https://lore.kernel.org/lkml/20200228002244.15240-1-keescook@chromium.org/ A recent bug[1] was solved for builds linked with ld.lld, and tracking it down took way longer than it needed to (a year). Ultimately, it boiled down to differences between ld.bfd and ld.lld's handling of orphan sections. Similarly, the recent FGKASLR series brough up orphan section handling too[2]. In both cases, it would have been nice if the linker was running with --orphan-handling=warn so that surprise sections wouldn't silently get mapped into the kernel image at locations up to the whim of the linker's orphan handling logic. Instead, all desired sections should be explicitly identified in the linker script (to be either kept or discarded) with any orphans throwing a warning. The powerpc architecture actually already does this, so this series extends coverage to arm64. This series needs one additional commit that is not yet in any tree, but I hope to have it landed via x86 -tip shortly: https://lore.kernel.org/lkml/20200622205341.2987797-2-keescook@chromium.org Thanks! -Kees [1] https://github.com/ClangBuiltLinux/linux/issues/282 [2] https://lore.kernel.org/lkml/202002242122.AA4D1B8@keescook/ Kees Cook (2): arm64/build: Use common DISCARDS in linker script arm64/build: Warn on orphan section placement arch/arm64/Makefile | 4 ++++ arch/arm64/kernel/vmlinux.lds.S | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-)