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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 A39D8C1975A for ; Tue, 17 Mar 2020 23:01:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F0F920738 for ; Tue, 17 Mar 2020 23:01:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="nHn8XPpj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbgCQXBW (ORCPT ); Tue, 17 Mar 2020 19:01:22 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33790 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgCQXBV (ORCPT ); Tue, 17 Mar 2020 19:01:21 -0400 Received: by mail-pf1-f196.google.com with SMTP id n7so12792053pfn.0 for ; Tue, 17 Mar 2020 16:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CLAXJR/m1S5mvbxDH/gOJKQ31fTpJSMrQ/dm5IseVLo=; b=nHn8XPpjogArRYq/pgvsanPOK+4o4O576oiPZS+njOPe1Iyb2CbZK5pOPlCvHz+Erq ycjuE3lMYgppqAWBDcD1CzbbzRU1NJ+lLGqwcVY1M/ynuQLTbpDg/KVTErnY8WshjnKQ dLlK6CXABUAwVSNrHVBjY4SoDTh8u6qiXtVM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CLAXJR/m1S5mvbxDH/gOJKQ31fTpJSMrQ/dm5IseVLo=; b=WXh5Qd8HJyrhz/q+LhTPbDtd1R7dkfBhaG/U99aq5OzB62Yei++HVeKI89Gk8LbRd6 5gj9+DDXWDcnDNzrfb5YWyxTzfRhupBfAKu2bzKiYqMrPGL6iZrIwxd1lKtaeUBUJjEw /X27pOkbJAkSvzDSODm4IvVoy3NHUFUOL27pSHSG9oQOwPu/6ifT2E6zduEWG3cUvt+u pj2rlBqFoUkppTOr4y7aqLWbsFoV7yk4xIl/KhnJMFLh5wVF4QF3znfbrWG7OpJa6ojR edq5vWfIUOYgoiD56aYzdTkm5HIvcApM16YNYadvQdhIYIacybacJ7EXenmvp5GY8S/U u7Uw== X-Gm-Message-State: ANhLgQ24fiozGMv9xwnCRvnUiolIDFhG7yEeOgLvHvnwcxszFiN/rveD h0agnpQwQtwRuwdh9nU4xd+nKQ== X-Google-Smtp-Source: ADFU+vvg0MZXI74SVi2HiksDnjxAGYalVyFBX2Irz0ufLm1PbI7PXP1Iee6C/syJdSKNKPaBtFiibQ== X-Received: by 2002:a63:1245:: with SMTP id 5mr1481307pgs.55.1584486078671; Tue, 17 Mar 2020 16:01:18 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w15sm1772273pfj.28.2020.03.17.16.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 16:01:17 -0700 (PDT) Date: Tue, 17 Mar 2020 16:01:16 -0700 From: Kees Cook To: Will Deacon Cc: Borislav Petkov , "H.J. Lu" , Russell King , Catalin Marinas , Mark Rutland , Peter Collingbourne , James Morse , Arnd Bergmann , Masahiro Yamada , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 7/9] arm64/build: Warn on orphan section placement Message-ID: <202003171558.7E1D46AED6@keescook> References: <20200228002244.15240-1-keescook@chromium.org> <20200228002244.15240-8-keescook@chromium.org> <20200317215614.GB20788@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200317215614.GB20788@willie-the-truck> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 17, 2020 at 09:56:14PM +0000, Will Deacon wrote: > On Thu, Feb 27, 2020 at 04:22:42PM -0800, 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. > > > > Explicitly include debug sections when they're present. Add .eh_frame* > > to discard as it seems that these are still generated even though > > -fno-asynchronous-unwind-tables is being specified. Add .plt and > > .data.rel.ro to discards as they are not actually used. Add .got.plt > > to the image as it does appear to be mapped near .data. Finally enable > > orphan section warnings. > > Hmm, I don't understand what .got.plt is doing here. Please can you > elaborate? I didn't track it down, but it seems to have been present (and merged into the kernel .data) for a while now. I can try to track this down if you want? -- Kees Cook 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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 97756C1975A for ; Tue, 17 Mar 2020 23:01:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 61A12206EC for ; Tue, 17 Mar 2020 23:01:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="q+6l2+wg"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="nHn8XPpj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61A12206EC 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+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wM24Wc1YdaXdE1wmhuzUN+hsy/NQbXuxywbUalLUddQ=; b=q+6l2+wgaqOliP r1mne7AhPdIcpGjH5osHjDk7GqzZmXvDI5xiWTSq7cLTAfgaW+xoZkWD9e2g8mnfD3SVO696JHs4U ZE5zfa/DlFL642arMWW6QjB5e4gXgCWpknvLJKpUNxqKGpvp6Ry5q/5Y31PIP03H7cusTNlSO8z7J XGYOM8RDZBfVDG6iXSFV+NMrHNtB69lbWk5pdzEuTUbjRCCRLePAnjdfQoZuANAEYM7uAbudhVbpZ Okii+tHh2QzIbnefM2wvXgLzQ5BWtHFqlT8W3AzG2bXnZbYAks0Ek8HtLkuSsFcMwWHsjEZNVRBY/ 3OH95gUIYm4n9/CCLSxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jELD8-0001x9-P6; Tue, 17 Mar 2020 23:01:22 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jELD6-0001wX-Cl for linux-arm-kernel@lists.infradead.org; Tue, 17 Mar 2020 23:01:21 +0000 Received: by mail-pf1-x443.google.com with SMTP id 2so12759305pfg.12 for ; Tue, 17 Mar 2020 16:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CLAXJR/m1S5mvbxDH/gOJKQ31fTpJSMrQ/dm5IseVLo=; b=nHn8XPpjogArRYq/pgvsanPOK+4o4O576oiPZS+njOPe1Iyb2CbZK5pOPlCvHz+Erq ycjuE3lMYgppqAWBDcD1CzbbzRU1NJ+lLGqwcVY1M/ynuQLTbpDg/KVTErnY8WshjnKQ dLlK6CXABUAwVSNrHVBjY4SoDTh8u6qiXtVM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CLAXJR/m1S5mvbxDH/gOJKQ31fTpJSMrQ/dm5IseVLo=; b=FlVbaLKCOFDkgvyH0wc8Euxgqu44K54KN9APoN7roc2bDV2uFjrMMScn7OusZVxGc4 MHASX2MRdfVNM/AbzA3uGsBpfq0Gf/Y9dsMqcovnD396lCWcYGGNTmdPLSwB3jbHtTze tLOx7+0JFuxSGRgHMCHWE9QwXVsSybN56FCDCGM/16rtMxI8QbhOEiMoVcBsEu2ejYfF 3Fbc89SEAAvN81QLiC11pGp2Y+48Rj4fh+euct04oWXdSRtNzjyM0+M1vAUyprTYPAil DVthh7/EIy8VDw0PFjno/NtNO+EAF8BdiriU61qe8A+2ib8NHzBpR+SIPmNAEV5BBgUO QNKQ== X-Gm-Message-State: ANhLgQ0TtkIW+33fmBvUXjQ5Jj8GSYvBLxpqbUk1MpIsvjO9cGhYJR2z VLofqQmTX0ditKMFcFz/qkoXpg== X-Google-Smtp-Source: ADFU+vvg0MZXI74SVi2HiksDnjxAGYalVyFBX2Irz0ufLm1PbI7PXP1Iee6C/syJdSKNKPaBtFiibQ== X-Received: by 2002:a63:1245:: with SMTP id 5mr1481307pgs.55.1584486078671; Tue, 17 Mar 2020 16:01:18 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w15sm1772273pfj.28.2020.03.17.16.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 16:01:17 -0700 (PDT) Date: Tue, 17 Mar 2020 16:01:16 -0700 From: Kees Cook To: Will Deacon Subject: Re: [PATCH 7/9] arm64/build: Warn on orphan section placement Message-ID: <202003171558.7E1D46AED6@keescook> References: <20200228002244.15240-1-keescook@chromium.org> <20200228002244.15240-8-keescook@chromium.org> <20200317215614.GB20788@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200317215614.GB20788@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200317_160120_455141_0EB1BEDE X-CRM114-Status: GOOD ( 14.18 ) 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 , "H.J. Lu" , Arnd Bergmann , linux-kbuild@vger.kernel.org, Catalin Marinas , Masahiro Yamada , x86@kernel.org, Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, James Morse , linux-arch@vger.kernel.org, Borislav Petkov , Peter Collingbourne , 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+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 17, 2020 at 09:56:14PM +0000, Will Deacon wrote: > On Thu, Feb 27, 2020 at 04:22:42PM -0800, 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. > > > > Explicitly include debug sections when they're present. Add .eh_frame* > > to discard as it seems that these are still generated even though > > -fno-asynchronous-unwind-tables is being specified. Add .plt and > > .data.rel.ro to discards as they are not actually used. Add .got.plt > > to the image as it does appear to be mapped near .data. Finally enable > > orphan section warnings. > > Hmm, I don't understand what .got.plt is doing here. Please can you > elaborate? I didn't track it down, but it seems to have been present (and merged into the kernel .data) for a while now. I can try to track this down if you want? -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel