public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Sunil Pandey <skpgkp2@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	 Libc-stable Mailing List <libc-stable@sourceware.org>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] elf: Disable some subtests of ifuncmain1, ifuncmain5 for !PIE
Date: Thu, 9 May 2024 14:27:14 -0700	[thread overview]
Message-ID: <CAMe9rOqAhK4rWLKOa-6YMT=NQTc1KV1Wk-bXoitqHot6SqcvBg@mail.gmail.com> (raw)
In-Reply-To: <CAMAf5_cQZd71MJkf6bbkJZZyOO0RaQ-gX8XMhvTBxHnRbhdY9g@mail.gmail.com>

On Thu, May 9, 2024 at 2:25 PM Sunil Pandey <skpgkp2@gmail.com> wrote:
>
> I would like to backport this patch to release branches(from 2.33 to 2.28)
> Any comments or objections?

Sounds good to me.

Thanks.

> --Sunil
>
>
> On Fri, Nov 4, 2022 at 11:27 AM Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote:
>>
>> Tested on i686-linux-gnu, x86_64-linux-gnu (with glibc defaults on a
>> toolchain which is not PIE-by-default).  Built with build-many-glibcs.py
>> defaults (so GCC 12 and binutils 2.39).  The x86 failures are gone.
>>
>> ---
>>  elf/ifuncmain1.c | 13 +++++++++++++
>>  elf/ifuncmain5.c |  9 +++++++++
>>  2 files changed, 22 insertions(+)
>>
>> diff --git a/elf/ifuncmain1.c b/elf/ifuncmain1.c
>> index 747fc02648..6effce3d77 100644
>> --- a/elf/ifuncmain1.c
>> +++ b/elf/ifuncmain1.c
>> @@ -19,7 +19,14 @@ typedef int (*foo_p) (void);
>>  #endif
>>
>>  foo_p foo_ptr = foo;
>> +
>> +/* Address-significant access to protected symbols is not supported in
>> +   position-dependent mode on several architectures because GCC
>> +   generates relocations that assume that the address is local to the
>> +   main program.  */
>> +#ifdef __PIE__
>>  foo_p foo_procted_ptr = foo_protected;
>> +#endif
>>
>>  extern foo_p get_foo_p (void);
>>  extern foo_p get_foo_hidden_p (void);
>> @@ -37,12 +44,16 @@ main (void)
>>    if ((*foo_ptr) () != -1)
>>      abort ();
>>
>> +#ifdef __PIE__
>>    if (foo_procted_ptr != foo_protected)
>>      abort ();
>> +#endif
>>    if (foo_protected () != 0)
>>      abort ();
>> +#ifdef __PIE__
>>    if ((*foo_procted_ptr) () != 0)
>>      abort ();
>> +#endif
>>
>>    p = get_foo_p ();
>>    if (p != foo)
>> @@ -55,8 +66,10 @@ main (void)
>>      abort ();
>>
>>    p = get_foo_protected_p ();
>> +#ifdef __PIE__
>>    if (p != foo_protected)
>>      abort ();
>> +#endif
>>    if (ret_foo_protected != 0 || (*p) () != ret_foo_protected)
>>      abort ();
>>
>> diff --git a/elf/ifuncmain5.c b/elf/ifuncmain5.c
>> index f398085cb4..6fda768fb6 100644
>> --- a/elf/ifuncmain5.c
>> +++ b/elf/ifuncmain5.c
>> @@ -14,12 +14,19 @@ get_foo (void)
>>    return foo;
>>  }
>>
>> +
>> +/* Address-significant access to protected symbols is not supported in
>> +   position-dependent mode on several architectures because GCC
>> +   generates relocations that assume that the address is local to the
>> +   main program.  */
>> +#ifdef __PIE__
>>  foo_p
>>  __attribute__ ((noinline))
>>  get_foo_protected (void)
>>  {
>>    return foo_protected;
>>  }
>> +#endif
>>
>>  int
>>  main (void)
>> @@ -30,9 +37,11 @@ main (void)
>>    if ((*p) () != -1)
>>      abort ();
>>
>> +#ifdef __PIE__
>>    p = get_foo_protected ();
>>    if ((*p) () != 0)
>>      abort ();
>> +#endif
>>
>>    return 0;
>>  }
>>
>> base-commit: 2ff48a4025515e93d722947a9eabb114f4a65b22
>>
>
>



-- 
H.J.

  reply	other threads:[~2024-05-09 21:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fseyy3s7.fsf@oldenburg.str.redhat.com>
2024-05-09 21:24 ` Sunil Pandey
2024-05-09 21:27   ` H.J. Lu [this message]
2024-05-09 21:30   ` Florian Weimer
2024-05-10  1:25     ` Robbe Loes

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='CAMe9rOqAhK4rWLKOa-6YMT=NQTc1KV1Wk-bXoitqHot6SqcvBg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-stable@sourceware.org \
    --cc=skpgkp2@gmail.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).