From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>
Subject: [PATCH] ld: Require GCC 8.0 for p_align-1.c tests
Date: Mon, 17 Jan 2022 05:44:27 -0800 [thread overview]
Message-ID: <CAMe9rOpSivPoaz+jwPdGxkES_DV_RefaE7ZbsMuJv8v9Z13O8A@mail.gmail.com> (raw)
In-Reply-To: <1d8309a8-434c-f4e5-1c48-b16229b16489@suse.com>
[-- Attachment #1: Type: text/plain, Size: 3278 bytes --]
On Mon, Jan 17, 2022 at 2:38 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 14.01.2022 15:14, H.J. Lu wrote:
> > On Fri, Jan 14, 2022 at 6:08 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> On 14.01.2022 15:02, H.J. Lu wrote:
> >>> On Fri, Jan 14, 2022 at 5:40 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>>>
> >>>> On 14.01.2022 14:03, H.J. Lu wrote:
> >>>>> On Fri, Jan 14, 2022 at 12:27 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>>>>>
> >>>>>> On 29.12.2021 20:39, H.J. Lu via Binutils wrote:
> >>>>>>> --- a/ld/testsuite/ld-elf/linux-x86.exp
> >>>>>>> +++ b/ld/testsuite/ld-elf/linux-x86.exp
> >>>>>>> @@ -185,6 +185,42 @@ run_ld_link_exec_tests [list \
> >>>>>>> "" \
> >>>>>>> "tmpdir/indirect-extern-access-2.so" \
> >>>>>>> ] \
> >>>>>>> + [list \
> >>>>>>> + "Run p_align-1a without PIE" \
> >>>>>>> + "$NOPIE_LDFLAGS" \
> >>>>>>> + "" \
> >>>>>>> + { p_align-1.c } \
> >>>>>>> + "p_align-1a" \
> >>>>>>> + "pass.out" \
> >>>>>>> + "$NOPIE_CFLAGS" \
> >>>>>>> + ] \
> >>>>>>> + [list \
> >>>>>>> + "Run p_align-1b with PIE" \
> >>>>>>> + "-pie" \
> >>>>>>> + "" \
> >>>>>>> + { p_align-1.c } \
> >>>>>>> + "p_align-1b" \
> >>>>>>> + "pass.out" \
> >>>>>>> + "-fpie" \
> >>>>>>> + ] \
> >>>>>>> + [list \
> >>>>>>> + "Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \
> >>>>>>> + "$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \
> >>>>>>> + "" \
> >>>>>>> + { p_align-1.c } \
> >>>>>>> + "p_align-1c" \
> >>>>>>> + "pass.out" \
> >>>>>>> + "$NOPIE_CFLAGS" \
> >>>>>>> + ] \
> >>>>>>> + [list \
> >>>>>>> + "Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \
> >>>>>>> + "-pie -Wl,-z,max-page-size=0x1000" \
> >>>>>>> + "" \
> >>>>>>> + { p_align-1.c } \
> >>>>>>> + "p_align-1d" \
> >>>>>>> + "pass.out" \
> >>>>>>> + "-fpie" \
> >>>>>>> + ] \
> >>>>>>> ]
> >>>>>>
> >>>>>> The two PIE variants of this also fail for me on glibc 2.26. Looks
> >>>>>> like LOAD segments' alignment isn't being honored there, at least
> >>>>>> not if it's as big as it is here.
> >>>>>>
> >>>>>
> >>>>> The PIE alignment needs the kernel fix:
> >>>>>
> >>>>> commit ce81bb256a224259ab686742a6284930cbe4f1fa
> >>>>> Author: Chris Kennelly <ckennelly@google.com>
> >>>>> Date: Thu Oct 15 20:12:32 2020 -0700
> >>>>>
> >>>>> fs/binfmt_elf: use PT_LOAD p_align values for suitable start address
> >>>>
> >>>> Well, then the test needs to be skipped if that fix is not in place.
> >>>> After all you're testing binutils behavior here, not kernel or libc one.
> >>>> I'm running a variety of (largely up-to-date) kernels on all of my
> >>>> systems. But it looks like our kernel folks decided against backporting
> >>>> this particular change. And I don't think you expect people to remember
> >>>> to run the testsuite only on top of "certain" kernels?
> >>>
> >>> Care to submit a patch?
> >>
> >> I have no idea what to check for. I would really expect you to fix such
> >> an issue (or really two of them, considering the other problem) recently
> >> introduced by you.
> >
> > What compiler are you using on the broken kernel?
>
> gcc 7.4.1
>
> No idea how that matters, though.
Try this.
--
H.J.
[-- Attachment #2: 0001-ld-Require-GCC-8.0-for-p_align-1.c-tests.patch --]
[-- Type: text/x-patch, Size: 2616 bytes --]
From 0120bae52ccdb050203bd90b310cdca9995e6e42 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 17 Jan 2022 05:33:10 -0800
Subject: [PATCH] ld: Require GCC 8.0 for p_align-1.c tests
Require GCC 8.0 for p_align-1.c tests to avoid GCC and Linux kernel
which ignore aligned in p_align-1.c.
PR ld/28689
PR ld/28695
* ld-elf/linux-x86.exp: Require GCC 8.0 for p_align-1.c tests.
---
ld/testsuite/ld-elf/linux-x86.exp | 79 +++++++++++++++++--------------
1 file changed, 43 insertions(+), 36 deletions(-)
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
index 2e0cbd37f17..6bc280f3cdd 100644
--- a/ld/testsuite/ld-elf/linux-x86.exp
+++ b/ld/testsuite/ld-elf/linux-x86.exp
@@ -185,44 +185,51 @@ run_ld_link_exec_tests [list \
"" \
"tmpdir/indirect-extern-access-2.so" \
] \
- [list \
- "Run p_align-1a without PIE" \
- "$NOPIE_LDFLAGS" \
- "" \
- { p_align-1.c } \
- "p_align-1a" \
- "pass.out" \
- "$NOPIE_CFLAGS" \
- ] \
- [list \
- "Run p_align-1b with PIE" \
- "-pie" \
- "" \
- { p_align-1.c } \
- "p_align-1b" \
- "pass.out" \
- "-fpie" \
- ] \
- [list \
- "Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \
- "$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \
- "" \
- { p_align-1.c } \
- "p_align-1c" \
- "pass.out" \
- "$NOPIE_CFLAGS" \
- ] \
- [list \
- "Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \
- "-pie -Wl,-z,max-page-size=0x1000" \
- "" \
- { p_align-1.c } \
- "p_align-1d" \
- "pass.out" \
- "-fpie" \
- ] \
]
+# Require GCC 8.0 to avoid GCC and Linux kernel which ignore aligned
+# attribute in p_align-1.c.
+if { [at_least_gcc_version 8 0] } {
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run p_align-1a without PIE" \
+ "$NOPIE_LDFLAGS" \
+ "" \
+ { p_align-1.c } \
+ "p_align-1a" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run p_align-1b with PIE" \
+ "-pie" \
+ "" \
+ { p_align-1.c } \
+ "p_align-1b" \
+ "pass.out" \
+ "-fpie" \
+ ] \
+ [list \
+ "Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \
+ "$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \
+ "" \
+ { p_align-1.c } \
+ "p_align-1c" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \
+ "-pie -Wl,-z,max-page-size=0x1000" \
+ "" \
+ { p_align-1.c } \
+ "p_align-1d" \
+ "pass.out" \
+ "-fpie" \
+ ] \
+ ]
+}
+
proc elfedit_test { options test output } {
global ELFEDIT
global READELF
--
2.34.1
next prev parent reply other threads:[~2022-01-17 13:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 19:39 [PATCH v3] elf: Set p_align to the minimum page size if possible H.J. Lu
2022-01-14 8:12 ` Jan Beulich
2022-02-10 12:44 ` Jan Beulich
2022-01-14 8:27 ` Jan Beulich
2022-01-14 13:03 ` H.J. Lu
2022-01-14 13:40 ` Jan Beulich
2022-01-14 14:02 ` H.J. Lu
2022-01-14 14:07 ` Jan Beulich
2022-01-14 14:14 ` H.J. Lu
2022-01-17 10:38 ` Jan Beulich
2022-01-17 13:44 ` H.J. Lu [this message]
2022-01-17 13:51 ` [PATCH] ld: Require GCC 8.0 for p_align-1.c tests Jan Beulich
2022-01-17 13:54 ` H.J. Lu
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=CAMe9rOpSivPoaz+jwPdGxkES_DV_RefaE7ZbsMuJv8v9Z13O8A@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=jbeulich@suse.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 read-only IMAP folder(s) and NNTP newsgroup(s).