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=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 4212FC4363A for ; Mon, 26 Oct 2020 12:31:15 +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 E356E2222C for ; Mon, 26 Oct 2020 12:31:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BAuno3fH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E356E2222C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rSZRFaihazGbxJBBiBrm7cmNcBBN5yWTQUIJAdMllg4=; b=BAuno3fHxvIDPsgrFkIn0bLQT AZhHWt7bY2iWU/1dl46fIRxOtRGbnFSuZDFTkt/CEbgpX0e4oYzxioGv4Qo0GrZrmxARMXDke+qYN PWhX3zbyoNBxUA71A3pgn6mKoWejcKw24mW0MCawg8aDKqFiy6HsPnMMVYYxzeg6+jbtSXufRpnFp S/3Tfsfm3ej2lJj76RvUBYBIETiexFmJc+0BUdOKjDXi/5OiTTjQF9iiMbva+NeqJEl64SuS2lwpf vUEoeoO+f4V2SAsdrTF8Wpt+6RzY8732EoiGotHYJXNlQ/CkyhbolkjinQFFYMnP9gzR+by4QiWTf DBptIfUWA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX1d3-0006t9-HF; Mon, 26 Oct 2020 12:29:37 +0000 Received: from mail-ot1-f68.google.com ([209.85.210.68]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX1d1-0006sS-7E for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 12:29:36 +0000 Received: by mail-ot1-f68.google.com with SMTP id h62so7776485oth.9 for ; Mon, 26 Oct 2020 05:29:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0trfHgi8OBfd5iB69j5LL8jeOJ1Nb/421IvjhePhaus=; b=qWnqe1oIW9vgmu0JfHfqYRTQXYiXmfneo3AffDNhyOlZYMOKCfKLtCyt3UuxF7nS/7 9YKp5DAy8nCNnVzoV1w/C6LnRWSvCBTicpuYGg/gCBYLg2YeFtjOoj+Bg3xpkHtKUqIc chslPPnCCJtXUtcAU/otcaL2bnLR5zpgq6Rn+xlJ/XBXNvpEYWB9iH+3a/x4lhcecggs AB96Up9c5Gk+mOJUNXLxciB3KKGQCuArvhJVRxrXQKJ9glE6KOqw4Gep4Tr78rfwICGR /CZJfcTeIYYmZ1/NCQmKbhv3Mv3L0sigiN7w8tDIXkbmDvMaKshd4IQs+HPZdcmF3/Hy ls+Q== X-Gm-Message-State: AOAM5337zj28+hm2pyueiLm55Bb50NtF1BZ6nU8kYrRhLJX0/IG+/nhO OPAMTDIXh6FSc1RmRiLAwDqYb28rCVruVy3sF7k= X-Google-Smtp-Source: ABdhPJyBweNoUQCltnRnsquxLRWEfPnJGEis2BPFL9CWHQhByaLq9YhLr+yqM3AxsL8UQGje3+jKX3bZuCidiISTg8s= X-Received: by 2002:a05:6830:210a:: with SMTP id i10mr13055312otc.145.1603715374142; Mon, 26 Oct 2020 05:29:34 -0700 (PDT) MIME-Version: 1.0 References: <20200821194310.3089815-1-keescook@chromium.org> <20200821194310.3089815-14-keescook@chromium.org> In-Reply-To: <20200821194310.3089815-14-keescook@chromium.org> From: Geert Uytterhoeven Date: Mon, 26 Oct 2020 13:29:22 +0100 Message-ID: Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections To: Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_082935_322917_389E161F X-CRM114-Status: GOOD ( 21.75 ) 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 , linux-efi , Linux Kernel Mailing List , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , the arch/x86 maintainers , Nick Desaulniers , Russell King , Ard Biesheuvel , Linux-Renesas , clang-built-linux , Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ingo Molnar , Linux ARM 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 Hi Kees, On Fri, Aug 21, 2020 at 9:56 PM Kees Cook wrote: > In preparation for warning on orphan sections, discard > unwanted non-zero-sized generated sections, and enforce other > expected-to-be-zero-sized sections (since discarding them might hide > problems with them suddenly gaining unexpected entries). > > Suggested-by: Ard Biesheuvel > Signed-off-by: Kees Cook This is now commit be2881824ae9eb92 ("arm64/build: Assert for unwanted sections") in v5.10-rc1, and is causing the following error with renesas_defconfig[1]: aarch64-linux-gnu-ld: warning: orphan section `.eh_frame' from `kernel/bpf/core.o' being placed in section `.eh_frame' aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected! aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected! I cannot reproduce this with the standard arm64 defconfig. I bisected the error to the aforementioned commit, but understand this is not the real reason. If I revert this commit, I still get: aarch64-linux-gnu-ld: warning: orphan section `.got.plt' from `arch/arm64/kernel/head.o' being placed in section `.got.plt' aarch64-linux-gnu-ld: warning: orphan section `.plt' from `arch/arm64/kernel/head.o' being placed in section `.plt' aarch64-linux-gnu-ld: warning: orphan section `.data.rel.ro' from `arch/arm64/kernel/head.o' being placed in section `.data.rel.ro' aarch64-linux-gnu-ld: warning: orphan section `.eh_frame' from `kernel/bpf/core.o' being placed in section `.eh_frame' I.e. including the ".eh_frame" warning. I have tried bisecting that warning (i.e. with be2881824ae9eb92 reverted), but that leads me to commit b3e5d80d0c48c0cc ("arm64/build: Warn on orphan section placement"), which is another red herring. Note that even on plain be2881824ae9eb92, I get: aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected! aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected! The parent commit obviously doesn't show that (but probably still has the problem). Do you have a clue! Thanks! > --- a/arch/arm64/kernel/vmlinux.lds.S > +++ b/arch/arm64/kernel/vmlinux.lds.S > @@ -121,6 +121,14 @@ SECTIONS > *(.got) /* Global offset table */ > } > > + /* > + * Make sure that the .got.plt is either completely empty or it > + * contains only the lazy dispatch entries. > + */ > + .got.plt : { *(.got.plt) } > + ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, > + "Unexpected GOT/PLT entries detected!") > + > . = ALIGN(SEGMENT_ALIGN); > _etext = .; /* End of text section */ > > @@ -243,6 +251,18 @@ SECTIONS > ELF_DETAILS > > HEAD_SYMBOLS > + > + /* > + * Sections that should stay zero sized, which is safer to > + * explicitly check instead of blindly discarding. > + */ > + .plt : { > + *(.plt) *(.plt.*) *(.iplt) *(.igot) > + } > + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") > + > + .data.rel.ro : { *(.data.rel.ro) } > + ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!") > } > > #include "image-vars.h" [1] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git/log/?h=topic/renesas-defconfig Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel