Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp594283pxx; Mon, 26 Oct 2020 16:17:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeFIrFQyzWKHFgvSWX1X4voXCs3zSjQ0Qp7fQOEEmtTMU/IHaLRlwTDy2vsNZW/SnhgMkJ X-Received: by 2002:a17:906:240d:: with SMTP id z13mr18215771eja.267.1603754237063; Mon, 26 Oct 2020 16:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603754237; cv=none; d=google.com; s=arc-20160816; b=D/WmF040kDDzt4KO6YS5pE9Th8AppTazNMmKnb57SAAwdprresdb+KBDUzyhpIImCI SEk1lsbg3Rrr0bY/xRZMSlZ5kiTqwYmhyi4/s5ENyRVO2Wi0JvgLSNV920UYFRYBfxfB 6giUdX7oMZZUn9NCQKzJPFmiRNTCFQL48F1JHeFV9kc4C11waone3+Z+hsFJEnpv+IJM Em0q0guyFI/lomn/AL3jb9EPcz5hbNnNiQBjXte1cVnGzPIdMaBjV8mEMVv0/oO8Ct9e D2Jl8ydyIeU1JvuDrYHztSrN1vjT90hzx3z+P9dv8PMT5jrhFPiYPVnxIJ/egb5ik1F/ 6E3A== 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:dkim-signature; bh=3Lau4JP94GTEBhDar3G9maH10AJVPlUYR1+GooIwz4Q=; b=gYbIx1FzJzDdK8l5/hMjF/ypTxC8/XUA0Q6C8ppQ0L83HI+3kbCIwxVAf4QQHXn/0S lNIPDiJ0ezPzBtiDU+qaqP/6w8JvmfAeBl6Gx9lk1NHsxBrizFEvZ/W5NlFKdUr4XR+G NX0hD13l7VX1a1CvNHjQk1O9cUoH4azKH1gSVUYVH+SGPyQdp5IPzM37S6jxtUx+icYi alRfzMnKvwbAjF5b1DiwogKxNih6sr1+E8eQDSNFYRIit2eqlMSoBnOVYO1SfNgV3sam m6a27BIlKMdgzIHioPeHsDqswZNzku3CkC+cJO5KJVgnALu4Lic23uYVYDzh5DQ/2PMN BjXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ki915xzF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si7807142edx.204.2020.10.26.16.16.55; Mon, 26 Oct 2020 16:17:17 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Ki915xzF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1788057AbgJZRi7 (ORCPT + 99 others); Mon, 26 Oct 2020 13:38:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1788049AbgJZRi6 (ORCPT ); Mon, 26 Oct 2020 13:38:58 -0400 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B55F722242; Mon, 26 Oct 2020 17:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603733937; bh=4hsLrGtQdAKvGeJzi/vIk47xvKfHSh+S6XD3mbba3qk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ki915xzFGnRs6mbfsJxyz6VrVipsqoFJfxPyFxN9QyX5SW+ozpyDKZx/5NHQAJVbo 5bS3+tK0zctHNpZ+vQ/2VCGSj1wSWwMbehU3KGahed2dzr++z2eeAZw7gNhvmsPDHV 9vjJ8VJb2Ae7N7VWu1JyBj5srwfzQhCXsZLlZUNs= Received: by mail-oi1-f182.google.com with SMTP id k27so11267406oij.11; Mon, 26 Oct 2020 10:38:57 -0700 (PDT) X-Gm-Message-State: AOAM530Zbfg6Ejawhe+gHMtf6rJWgxTc4zcZMP24olWv6cjd0fRz2Lfs Pvs7vFYnsdGSQdAU7fvoQikI+VWEgXp4R4Sexb8= X-Received: by 2002:aca:d64f:: with SMTP id n76mr15186195oig.174.1603733937001; Mon, 26 Oct 2020 10:38:57 -0700 (PDT) MIME-Version: 1.0 References: <20200821194310.3089815-1-keescook@chromium.org> <20200821194310.3089815-14-keescook@chromium.org> In-Reply-To: From: Ard Biesheuvel Date: Mon, 26 Oct 2020 18:38:46 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections To: Geert Uytterhoeven 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 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 command line and/or adding -z norelro to the linker command line make any difference?