Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp601587pxx; Mon, 26 Oct 2020 16:31:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLgJ/R0PamawwEto0FSje1uNyj1EyLhi9VQjFNyCMi/DtUNITJUWHEXrgR2xS1aftW3FSg X-Received: by 2002:a50:8a88:: with SMTP id j8mr10830886edj.179.1603755071444; Mon, 26 Oct 2020 16:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603755071; cv=none; d=google.com; s=arc-20160816; b=b+d17LCrksO+ucf5DcA80EdOVpfTtt7VnAqzHfEH2+8bqLL1iBvliALa6KOgZ/CBDt ZzzcNYpTEamn4Fxuj56ANo9iISkUmov025hFUL1iqyRZ47huVUNjye7dYGJ+nuUk5MUv qln821krHqy+zTLgr+bLbkuQYvTxkZ+u1DLXzZa2VSCh3kkH4zx/0uyQOtza8Y4WCliJ L+8BKdvOW1Rb9r7bU6AHX1CB5OL3OJJwpP02MFV2li5WR4Urwpc9YeuHlVQBvY25+zQG lxoeD+vw7zXny4biq8ICp7IsenPHbmqBKh3wBan7wse05FbWq5zxd7z+XFjr27rk14ds FVUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=aJz+oRM1+RYdgp0O1S9wfW6IBH+e5jFShHd2j276EOc=; b=ZdUlQ6tFQOmfe1doW/c5gOzC63CkHqrqXFGyS9G8g/NYF0A9sLDNksZ3qIxzUulznB SuWKKmnwvWazloqrgSsqxREUrruk0AZzW/Yz5Ll8W/U/V+xCPTzbTylBFGuU2BmduBXV DVbIRElFSYU4PU/flYF2m9BseLcVJgQbnEvTsjZxWY5NpudIkkvV2hAJZ2qeC9O2//Fy 2VdnnEaV5ZtMCeQGzmelYQpGZ+XuDbTu6oa1lHsSXRdCizbEVtA0/I1uIXwL9/7OrqY8 W9oFhR2uS0gLJzBj7LPDouTByRy9OQKjEXr5by0PItrFx8NZJhU/rVwUo+B33z5UJH+0 sjFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr8si5250063ejc.505.2020.10.26.16.30.49; Mon, 26 Oct 2020 16:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1788118AbgJZRoB (ORCPT + 99 others); Mon, 26 Oct 2020 13:44:01 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:38624 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1788189AbgJZRoA (ORCPT ); Mon, 26 Oct 2020 13:44:00 -0400 Received: by mail-ot1-f67.google.com with SMTP id b2so8194718ots.5; Mon, 26 Oct 2020 10:43:59 -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=aJz+oRM1+RYdgp0O1S9wfW6IBH+e5jFShHd2j276EOc=; b=hWVMc8CIsqHPM9yTVMxHv7QgTqqViJybzcf2RTq94XgYcu88mLiHbukSekCNMizQCx OjTmfaNdDBo+2es0IO4B2i9Vxy2ZtyUwnI6DlGzPMWT+mWyBO3HJAxm01N1wZqSl2WoR ah2kTm/s0Q31Up/tAWfZKhUI2Qsusvk8KyQWOOZs5w5NmqTxAhULcxhkPlxmo6Yw2cNz sI8IVaEJAXOh5bGR0vkG2hzvc3hXGmlVelFQ1nDBxgh8RmkjHoCe7A10ozAgJAZWV/E+ HL1wJKqhuK4Wjixn2JYCTMgjNq1iNRb9B/2Y8mZ+XiScG/4payrPo/MdM3w6fKVYHgkp YvGA== X-Gm-Message-State: AOAM533zuTP7fHyMG90fKJcj4zSKXAa+S+fARzHEqK7/H5ft6WUhWgtW KTHG5U0ikttkrFJhuY5RZYJ+ispzKvhAfkAwzm0= X-Received: by 2002:a9d:5e14:: with SMTP id d20mr11681972oti.107.1603734239191; Mon, 26 Oct 2020 10:43:59 -0700 (PDT) MIME-Version: 1.0 References: <20200821194310.3089815-1-keescook@chromium.org> <20200821194310.3089815-14-keescook@chromium.org> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 26 Oct 2020 18:43:48 +0100 Message-ID: Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections To: Ard Biesheuvel Cc: Kees Cook , Ingo Molnar , Catalin Marinas , Mark Rutland , Peter Collingbourne , James Morse , Borislav Petkov , Ingo Molnar , Russell King , Masahiro Yamada , Arvind Sankar , Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , "the arch/x86 maintainers" , clang-built-linux , Linux-Arch , linux-efi , Linux ARM , Linux Kernel Mailing List , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ard, On Mon, Oct 26, 2020 at 6:39 PM Ard Biesheuvel wrote: > On Mon, 26 Oct 2020 at 17:01, Geert Uytterhoeven wrote: > > On Mon, Oct 26, 2020 at 2:29 PM Geert Uytterhoeven wrote: > > > On Mon, Oct 26, 2020 at 1:29 PM Geert Uytterhoeven wrote: > > > > 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. > > > > > > kernel/bpf/core.o is the only file containing an eh_frame section, > > > causing the warning. > > > If I compile core.c with "-g" added, like arm64 defconfig does, the > > > eh_frame section is no longer emitted. > > > > > > Hence setting CONFIG_DEBUG_INFO=y, cfr. arm64 defconfig, the warning > > > is gone, but I'm back to the the "Unexpected GOT/PLT entries" below... > > > > > > > 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). > > > > Reverting both > > b3e5d80d0c48c0cc ("arm64/build: Warn on orphan section placement") > > be2881824ae9eb92 ("arm64/build: Assert for unwanted sections") > > seems to solve my problems, without any ill effects? > > > > I cannot reproduce the issue here with my distro GCC+binutils (Debian 8.3.0) > > The presence of .data.rel.ro and .got.plt sections suggests that the > toolchain is using -fpie and/or -z relro to build shared objects > rather than a fully linked bare metal binary. > > Which toolchain are you using? Does adding -fno-pie to the compiler gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) from Ubuntu 20.04LTS. > command line and/or adding -z norelro to the linker command line make > any difference? I'll give that a try later... 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