Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp123101pxx; Tue, 27 Oct 2020 23:42:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO3DI1jNuJhLMzmabAfQ3XuDvpYzzyXa8qdpx7rRZ5C1XLhy7gqgaWZKSPAclvQsW3P+ei X-Received: by 2002:aa7:cf93:: with SMTP id z19mr6173260edx.26.1603867340517; Tue, 27 Oct 2020 23:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603867340; cv=none; d=google.com; s=arc-20160816; b=I/Cag8GR0mw1vq6KwcpkNIWqyAhe1cmHPc/HiDiCDw579hetadVjezKa0ce0AepKrB iOHagVh1qP2n+XHSui/5R6e1j7mWb1Q6jZHp0zzRlvpV7SmeasZlITQxfdDYwIcXHhTm +hnSNOyL5PEzi/Jcm9jUQrQNH/fYfcvEF4iApJjejSNBXP851oELMz6v+rYJZmOz9OMV j3OUaHZ3J/ItXk0jiGceykpy82ynuIF/AV26Z6rYjDUpPsC2zEVF3HC7EymLhn7cveV4 QWNqPjBa8asUTYrEUL1bxjy3udmMtXooHK0taJAEZmFlh9ffjHKYstl1E55W+Q1qYg8c yylQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=30KXF4Pr/aWkmgz9WeJeWxLByh2Hd/+V/34/539xHp8=; b=T4gU6cbB8Ei9/jTowjKWeanbsIDhwIEOw7bjxnxbwtQ0QE2GdIOTKBWl4FKJX/nrzn redfpz1qnURIRNyWD1lIyJhcPXrDYrgt6iRRD9NLQLzdHgqFqN7AxwS+XQfAuyOVmy7O tz5I1IgQMHbCWca0tnLyMP8KOBlWWPHuhZXdaV4UDqx4qKs/wOCSRpGkKnULgq+0F/yL bdzNLTegr1G8FuV8VYY6ZKUanXfmnQV4j+xBwmUfoEucrpycBy9LQZK+nB8njeeTYsTa 0Y+Wr1HgpPmL70kkU4ze7CFXpL294XDiJOWkzRBY0py1wQ9Nvw5GCfeaDwCBkTWtUKi3 wSgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vwJDc1uS; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si2597330edw.131.2020.10.27.23.41.58; Tue, 27 Oct 2020 23:42:20 -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=@linaro.org header.s=google header.b=vwJDc1uS; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2897404AbgJ0KJI (ORCPT + 99 others); Tue, 27 Oct 2020 06:09:08 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:44143 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2897399AbgJ0KJH (ORCPT ); Tue, 27 Oct 2020 06:09:07 -0400 Received: by mail-ed1-f65.google.com with SMTP id t20so782880edr.11 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=bnpMiYjuaFUaSDV6GRu5OH/OtXd4nK5kTvOGB6Y5ZuippI6nurlwDf5JtoKlggzHoW Ua8qw7tY1sjNx+N3TFEQfJbvCA4QoLQgyulZdEps14goIBX2MhyBqNTLmn9zFWmO6nWE hLYTAY1sbvQUh1UkYjxoiX+UwlcCRh0qFhx0/BXk0rc0O+CckIS4XScU+Ltc5zH8Eb9/ fn/KEBfcgYgFDTP7cr+g0HZ+K6Q1thkvGX9S3X3wGD0gPJ5GH+05Dn2izORQo4teKVVQ v7eKzc1u422SAJ9xj4Dug6qz1trc9e9In+ppHQMZVEjEPaoklmWQlIP3KovKkTSwtDon laEQ== X-Gm-Message-State: AOAM532GBb5shyj8qCbdQJiv1PyO8mBfeYplRGYhKnOKGCKD2MB5MqOz iWUQAcHME8TknwI2C31L08xBNA== 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 Cc: Geert Uytterhoeven , Mark Rutland , Linux-Arch , linux-efi , Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , the arch/x86 maintainers , Nick Desaulniers , Russell King , Linux Kernel Mailing List , Linux-Renesas , clang-built-linux , Arvind Sankar , Ingo Molnar , James Morse , Nathan Chancellor , Borislav Petkov , Peter Collingbourne , Ingo Molnar , Linux ARM 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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