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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 05DE3C4363A for ; Tue, 27 Oct 2020 10:10:34 +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 6DD2721D24 for ; Tue, 27 Oct 2020 10:10:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WXhk23jv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vwJDc1uS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DD2721D24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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: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=6X+geaXhhDZt86O5v3RDg7XDtXbeErfjKpLrfqrQObY=; b=WXhk23jvrb7FS/1ZwFV0e2gcW NcuBEEpnIViQOuJ2H3jwmD4PoUq0gNO6AjYo4aGEjAaA9LY26XTY2vsA3tyZAu7ATTeXgctn/wsNO uRUis9h8Qa5te3asTJEV72uJ4LzMRe+grLfMhpFVLoTPNs+6TbvIVA0+hoR3Xyv/U4q0azy581Shm 3zZ6+lJi0szeUYLS0YkWH7vUiWBydmLS1Wi8QBC+8m4QcgvIZi+Z9BU0aZZko0Zp8xAMQNOL80YPF 40Zg9xzArCg6D6XQMUpnwPl7FpN8rgp4Rdl5qj8W/pwrGzxXst2cwi7Mj0bCWgcnhLGJf7HW5hmxN cUk2Z9Kwg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXLuf-0001p1-BO; Tue, 27 Oct 2020 10:09:09 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXLuc-0001ne-3q for linux-arm-kernel@lists.infradead.org; Tue, 27 Oct 2020 10:09:07 +0000 Received: by mail-ed1-x541.google.com with SMTP id dg9so784199edb.12 for ; Tue, 27 Oct 2020 03:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=30KXF4Pr/aWkmgz9WeJeWxLByh2Hd/+V/34/539xHp8=; b=vwJDc1uSSMz/gQXsJKLCES3zXyk/SNTJ4WwUVvlvekJyjicFrDjQlC3bBhSYUE8C7C QXhE1wGMo/FmAVJT9dA6jm6WJfJ/mXDZPoAr9w0dRRiELb0i7Y3cdHjrpOoHJZeVClrc nfhGctq5M+yOyps0eCO1+JLVvs5y6U/tl0xDU28zo3vIN63bj0p37VMs6L65AKGcxnqd /tXlPSedQbU9SoBnOjF4PGejR8Az2/YDpn9YQenKYA6CUvt8tQm+xOZYGhcc0yz7zk+w aG/U2fvPyyEcSbJkQiBZsAhmn1yIJ84HDtkvg4vL9IdruqiiI8k0YdWk/p2hEouqYHgC ulcA== 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=30KXF4Pr/aWkmgz9WeJeWxLByh2Hd/+V/34/539xHp8=; b=n0WSmwxJfbcWj1IQXAi6QyLzz0kLInbXURmBkL8u7Mv1wHIj8LeYNOCqDJC5+KgypM WAegNrPnXACSl5TQ/odBIqmXt6c4x1XLanBPJW/KwRCFyTSXti0AM5MhskPXphfVGmLF zkx3g7Hi6l8YZ3GA9VGMGrT37G77/sEABPV3Iy5qkGXr6VsX87wfG8AqIKMARiASUtKG 5jJ/1l6hJlG3fj1zKYaIhaq6OvfpOxps3MNskaurtSERXcDVUehEnt1hD3rzMl4ESB3T eh8+WeO+jLWj8Nk5QEOELyyb9AkCIGt7PCqrxIx2lVFxmBI2Meb9+o233sQ4YZdOpCXo 9ITQ== X-Gm-Message-State: AOAM532TXy33RlDZI9ev73E+VRufoQ+DQVeL0h4tJG6FNwph3n69qbhG ET0/AdRSQwoykjT0nziYqLFy/A== X-Google-Smtp-Source: ABdhPJySr5YXJAYGtUDoWBkyIPhpP8tlUc9V26+2Gotx0C0ZFPYz4VypfmyAIEC3+1ZHXV7GOVXb/Q== X-Received: by 2002:aa7:dada:: with SMTP id x26mr1379080eds.167.1603793344917; Tue, 27 Oct 2020 03:09:04 -0700 (PDT) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id t5sm644137edw.45.2020.10.27.03.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 03:09:04 -0700 (PDT) Date: Tue, 27 Oct 2020 11:08:44 +0100 From: Jean-Philippe Brucker To: Ard Biesheuvel Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections Message-ID: <20201027100844.GA1514990@myrica> References: <20200821194310.3089815-1-keescook@chromium.org> <20200821194310.3089815-14-keescook@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201027_060906_178351_CCC3FE74 X-CRM114-Status: GOOD ( 22.77 ) 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-efi , Catalin Marinas , Arvind Sankar , Ingo Molnar , Linux-Arch , Masahiro Yamada , the arch/x86 maintainers , Russell King , clang-built-linux , Ingo Molnar , Geert Uytterhoeven , Borislav Petkov , Kees Cook , Arnd Bergmann , Nathan Chancellor , Peter Collingbourne , Linux ARM , Nick Desaulniers , Linux Kernel Mailing List , Linux-Renesas , James Morse 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, On Mon, Oct 26, 2020 at 06:38:46PM +0100, Ard Biesheuvel wrote: > > > > 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) I have the same problem with one of my debug configs and Linux v5.10-rc1, and can reproduce with the Debian 8.3.0 toolchain, by using the arm64 defconfig and disabling CONFIG_MODULES: ld -EL -maarch64elf --no-undefined -X -z norelro -shared -Bsymbolic -z notext --no-apply-dynamic-relocs --fix-cortex-a53-843419 --orphan-handling=warn --build-id=sha1 --strip-debug -o .tmp_vmlinux.kallsyms1 -T ./arch/arm64/kernel/vmlinux.lds --whole-archive arch/arm64/kernel/head.o init/built-in.a usr/built-in.a arch/arm64/built-in.a kernel/built-in.a certs/built-in.a mm/built-in.a fs/built-in.a ipc/built-in.a security/built-in.a crypto/built-in.a block/built-in.a arch/arm64/lib/built-in.a lib/built-in.a drivers/built-in.a sound/built-in.a net/built-in.a virt/built-in.a --no-whole-archive --start-group arch/arm64/lib/lib.a lib/lib.a ./drivers/firmware/efi/libstub/lib.a --end-group ld: Unexpected GOT/PLT entries detected! ld: Unexpected run-time procedure linkages detected! Adding -fno-pie to this command doesn't fix the problem. Note that when cross-building with a GCC 10.2 and binutils 2.35.1 I also get several "aarch64-linux-gnu-ld: warning: -z norelro ignored" in addition to the error, but I don't get that warning with the 8.3.0 toolchain. Thanks, Jean > > 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? > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel