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=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 8ADD2C433DF for ; Wed, 24 Jun 2020 07:57:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69C512088E for ; Wed, 24 Jun 2020 07:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592985441; bh=l3Q0LyzeB2AgJKEMBDOo81ibmsUKTKJ9tglIeoVn5pI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=JP0/dvPAaNldOSgRdVtjtc4t3hP56SrHtDdt1R8sJN8fw3WjgfMU3Ks0dpfX64xkf hVNd838+VP7oD7NhLsvuIMmp/DQvSc0X5GlKEZYvw1QfiEMhTkZt+Z1DHhaybMa0G4 deeYgZUVVObLG+5U/kRG37ZWU4hffUN1rwUbAZGk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390193AbgFXH5U (ORCPT ); Wed, 24 Jun 2020 03:57:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:55170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389965AbgFXH5T (ORCPT ); Wed, 24 Jun 2020 03:57:19 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B4AC72085B; Wed, 24 Jun 2020 07:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592985438; bh=l3Q0LyzeB2AgJKEMBDOo81ibmsUKTKJ9tglIeoVn5pI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hwS5MOXOPRnpdHOI74XHFaf2FIoxBL8vat/VMF/rsK7OudnwwsqyaUMDA1AwNDq5I 5MFpl+o0l6bMIGSTBS4TLc5oi5hGBQK8kQGQwgMIkCdavlfrFxZaZtDRJVxoOiu8zg tP7o7yRWzq2oR+WUQFOZXEJQrECP14c31Q5KiLQk= Date: Wed, 24 Jun 2020 08:57:12 +0100 From: Will Deacon To: Kees Cook Cc: Catalin Marinas , Mark Rutland , Ard Biesheuvel , Peter Collingbourne , James Morse , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Russell King , Masahiro Yamada , Arvind Sankar , Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , x86@kernel.org, clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 9/9] arm64/build: Warn on orphan section placement Message-ID: <20200624075712.GB5853@willie-the-truck> References: <20200624014940.1204448-1-keescook@chromium.org> <20200624014940.1204448-10-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624014940.1204448-10-keescook@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 06:49:40PM -0700, Kees Cook wrote: > 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. > > Avoid .eh_frame* by making sure both -fno-asychronous-unwind-tables and > -fno-unwind-tables are present in both CFLAGS and AFLAGS. Remove one > last instance of .eh_frame by removing the needless Call Frame Information > annotations from arch/arm64/kernel/smccc-call.S. > > 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. > > Explicitly include debug sections when they're present. > > Fix a case of needless quotes in __section(), which Clang doesn't like. > > Finally, enable orphan section warnings. > > Thanks to Ard Biesheuvel for many hints on correct ways to handle > mysterious sections. :) Sorry to be a pain, but this patch is doing 3 or 4 independent things at once. Please could you split it up a bit? e.g. - Removal of cfi directives from smccc macro - Removal of quotes around section name for clang - Avoid generating .eh_frame - Ensure all sections are accounted for in linker script and warn on orphans That way it's a bit easier to manage, we can revert/backport bits later if necessary and you get more patches in the kernel ;) You can also add my Ack on all the patches: Acked-by: Will Deacon Will