From: John Hubbard <jhubbard@nvidia.com>
To: Muhammad Usama Anjum <Usama.Anjum@collabora.com>,
Kees Cook <keescook@chromium.org>
Cc: "H . J . Lu" <hjl.tools@gmail.com>,
Chris Kennelly <ckennelly@google.com>,
Eric Biederman <ebiederm@xmission.com>,
Shuah Khan <shuah@kernel.org>, Fangrui Song <maskray@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Yang Yingliang <yangyingliang@huawei.com>, <linux-mm@kvack.org>,
<linux-kselftest@vger.kernel.org>,
Mike Rapoport <rppt@kernel.org>,
"Rui Salvaterra" <rsalvaterra@gmail.com>,
Victor Stinner <vstinner@redhat.com>,
"Jan Palus" <jpalus@fastmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
<linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH 1/3] selftests/exec: Build both static and non-static load_address tests
Date: Mon, 19 Aug 2024 12:52:40 -0700 [thread overview]
Message-ID: <6b98f32c-5ce6-44cb-9288-1348c7e50909@nvidia.com> (raw)
In-Reply-To: <0c6ff7bb-8a22-403d-b015-aa20c907df8f@nvidia.com>
On 8/19/24 12:41 PM, John Hubbard wrote:
> On 8/18/24 8:55 PM, Muhammad Usama Anjum wrote:
>> On 8/7/24 3:22 PM, Muhammad Usama Anjum wrote:
>>> On 5/9/24 11:16 AM, Kees Cook wrote:
...
>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
>>> arm-linux-gnueabihf-gcc -Wall -Wno-nonnull -D_GNU_SOURCE=
>>> -Wl,-z,max-page-size=0x1000 \
>>> -fPIE -static-pie load_address.c -o
>>> /home/usama/repos/kernel/linux_mainline/tools/testing/selftests/exec/load_address.static.0x1000
>>> /usr/lib/gcc-cross/arm-linux-gnueabihf/12/../../../../arm-linux-gnueabihf/bin/ld:
>>> cannot find rcrt1.o: No such file or directory
>>> collect2: error: ld returned 1 exit status
>>> make: *** [Makefile:39:
>>> /home/usama/repos/kernel/linux_mainline/tools/testing/selftests/exec/load_address.static.0x1000]
>>> Error 1
>
> This appears to be because that particular cross compiler setup
> (the libc part of the installation) fails to include rcrt1.o. I was
> able to reproduce this on Ubuntu 23.04, using their standard arm
> cross compilation packages for gcc and libc.
>
> Also, -static-pie is what is causing the linker to look for rcrt1.o.
> If you change the invocation from "-static-pie" to "-static -pie",
> then linking succeeds.
>
> Putting all of this together, I think we were are seeing is that
> even though "-static-pie" was added to gcc 8.1+, and even though
> the cross-compiler installation here shows gcc 12.3.0, the libc
> support for that feature is lagging. In other words, the cross
> installation of libc is effectively at something earlier than
> gcc 8.1's needs.
>
> So I think this means that we need to fix up the distros'packages,
> and meanwhile, fall back to something like "-static-pie" for
> selftests.
>
Or, another way of handling this would be to say, "gcc 8.1 is
sufficiently old, and cross-compiling of kselftests is sufficiently
rare, that we can wait for the cross compilers to catch up.
Until then, only native builds of kselftests are supported".
Shuah, you would know whether or not that's a reasonable thing
to claim--what do you think? I'm just trying to list all of the
options so that people can decide which way to go here.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2024-08-19 19:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 17:31 [PATCH 0/3] binfmt_elf: Honor PT_LOAD alignment for static PIE Kees Cook
2024-05-08 17:31 ` [PATCH 1/3] selftests/exec: Build both static and non-static load_address tests Kees Cook
2024-05-09 2:54 ` John Hubbard
2024-05-09 6:16 ` Kees Cook
2024-08-07 10:22 ` Muhammad Usama Anjum
2024-08-19 3:55 ` Muhammad Usama Anjum
2024-08-19 19:41 ` John Hubbard
2024-08-19 19:52 ` John Hubbard [this message]
2024-05-08 17:31 ` [PATCH 2/3] binfmt_elf: Calculate total_size earlier Kees Cook
2024-05-08 17:31 ` [PATCH 3/3] binfmt_elf: Honor PT_LOAD alignment for static PIE Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b98f32c-5ce6-44cb-9288-1348c7e50909@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=Usama.Anjum@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=ckennelly@google.com \
--cc=ebiederm@xmission.com \
--cc=hjl.tools@gmail.com \
--cc=jack@suse.cz \
--cc=jpalus@fastmail.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maskray@google.com \
--cc=rppt@kernel.org \
--cc=rsalvaterra@gmail.com \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=vstinner@redhat.com \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).