From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E7DFC433DF for ; Fri, 31 Jul 2020 23:15:32 +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 CC0D520672 for ; Fri, 31 Jul 2020 23:15: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="av3D6qdL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="LqmTDvOW"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JOAqMVCW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC0D520672 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+linux-arm-kernel=archiver.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=or4zVA+GFHdfblcIgHVIWssC6XBh5veakQngM4JPyTs=; b=av3D6qdLHBdV+/rmuIW8EqHpQ XM0Nmr6yVHo/P5sbDh+iMGrZbPZZouvoVvZBbBus4y3KVaWT6/7+a/jpgXytOL1p7TjhynDor+vxO As7tT4lRdL61MdkT0uw1u/hRWYpW+uGcZka61ACd/5OavityIf9FGQOMQagAfak21szaJ/4c3sbGB Z4Y0rMkn92SG9M4Lm1SPtYUBegrFPYA+e7LaZiusinKAIJBDyiAlJnrezMBUEPbOaVjr3ScqjphW2 1Gf1QmseJ1wNHvdHDF1NatYuM6yEfr3S8rB8xmNyo0hIiJtcmEYDA69mHvPWK/lMIJHtZFP6tX22X IP520pucw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1eCa-0001NB-AD; Fri, 31 Jul 2020 23:12:36 +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 1k1e98-0008Hd-Fa for linux-arm-kernel@merlin.infradead.org; Fri, 31 Jul 2020 23:09:02 +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=nwDvJc+EBCTytPh4qqWJPqBQ1Pj/7rvDlMkI2+6l3fI=; b=LqmTDvOWCukpMofm2DoQdRID/3 eCx+ZjbedbCC1AGuNvNoRxxEXWUhuFlbtAn30tn7JDucyl/P7eefgyFrAKoNl/rHEPHn90+dV4CUL SvFfreOX8GAo04ILDw+FLabiyPsWSLh4IF4kHdTJnhwgwQL+KVj01kqpdtpnepBPQV9a4k41eEdAD EkapvBgZjzq2PWezL755c+I+mjUeBXARkgEeFTISHrlx4sYuq15alfL4r+6iM9qoGR8WmJkYjnwKI vHGpaD+fmNAYC8zJRMD4hI6wQzDx9C4r0/sB2JHymCNa0pR1hyztMwXD/IcIkPj4ZA6zNopH/Mlb6 hdBNq/mg==; Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1e8u-0000ZO-Ls for linux-arm-kernel@lists.infradead.org; Fri, 31 Jul 2020 23:09:01 +0000 Received: by mail-pl1-x643.google.com with SMTP id m16so18096520pls.5 for ; Fri, 31 Jul 2020 16:08: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=nwDvJc+EBCTytPh4qqWJPqBQ1Pj/7rvDlMkI2+6l3fI=; b=JOAqMVCWrPdajqN1Taychqd0iPhCdsc/6VYR99HVk3JsgeEiGpgjg2Z9E7W4gFUUmF ee4C8x8jOufyDVX5njp8VPjBuIasRahkVmjaxpNMFWb6v49ohzPS9pBDXECueYvkiEJ/ W9bbijKixILXX2dC5o0Yg3bGNPJac4Scw7dkk= 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=nwDvJc+EBCTytPh4qqWJPqBQ1Pj/7rvDlMkI2+6l3fI=; b=Axha4ozN2iu7fjaXvxTxY9KjHmNzUxBD8aewrc1SUfXkb+oXL69tTbpIjdPgF5jeqK 8+rIv5JRKvpgT0RgigkVL1rHopG7dfWSI57rJ5F2NwhzAzIIXixqrjnJqcHVb+Kahrys 5EW+ewCQoCvyVnjv0SyFx/c7TdibcUpd0V3z+C0MbnVCD2uBXPdlIS3UBfPlDKxtNbV0 aA5+LOgioZ8RVLJG1TYoxhZdubuGb4DubhcbSqUDgMM/Ahr/EMJojgEl3QqcIpgE8lUY /w8HiJ/2oxJOjiAg4WqLf4Dn1ApOj8iiEgL0tavht23c1Z7qKZHUBe+YRSwJpYarL4yJ aZZQ== X-Gm-Message-State: AOAM5302vdLIeSX99eQ+vOJwkaBDfn6c14H2V4EV+M2zkouvIf3tcApt 1lsiesZfVPZjoIsGqUtyQGmY5A== X-Google-Smtp-Source: ABdhPJyd3PIVImTfcm8vqmhCuvx32RaOUUUS9YkPvP10EV/gwv2je3TLyVou0UCk4tW9MggDonnqiA== X-Received: by 2002:a17:90b:514:: with SMTP id r20mr6354230pjz.82.1596236926030; Fri, 31 Jul 2020 16:08:46 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h12sm7292673pfr.143.2020.07.31.16.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 16:08:44 -0700 (PDT) From: Kees Cook To: Thomas Gleixner , Will Deacon Subject: [PATCH v5 30/36] x86/build: Assert for unwanted sections Date: Fri, 31 Jul 2020 16:08:14 -0700 Message-Id: <20200731230820.1742553-31-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200731230820.1742553-1-keescook@chromium.org> References: <20200731230820.1742553-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200801_000851_717550_B4E0B74A X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation for warning on orphan sections, enforce other expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Signed-off-by: Kees Cook --- arch/x86/kernel/vmlinux.lds.S | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 7faffe7414d6..d8792f9c536f 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -415,6 +415,15 @@ SECTIONS DISCARDS + /* + * Sections that should stay zero sized, which is safer to + * explicitly check instead of blindly discarding. + */ + .got (NOLOAD) : { + *(.got) *(.igot.*) + } + ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + /* * Make sure that the .got.plt is either completely empty or it * contains only the lazy dispatch entries. @@ -427,6 +436,21 @@ SECTIONS SIZEOF(.got.plt) == 0xc, #endif "Unexpected GOT/PLT entries detected!") + + .plt (NOLOAD) : { + *(.plt) *(.plt.*) *(.iplt) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + + /* ld.lld does not like .rel* sections being made "NOLOAD". */ + .rel.dyn : { + *(.rel.*) *(.rel_*) + } + ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") + .rela.dyn : { + *(.rela.*) *(.rela_*) + } + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") } #ifdef CONFIG_X86_32 -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel