public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Michael Jeanson <mjeanson@efficios.com>
To: DJ Delorie <dj@redhat.com>
Cc: libc-alpha@sourceware.org, mathieu.desnoyers@efficios.com
Subject: Re: [PATCH v8 1/8] nptl: fix potential merge of __rseq_* relro symbols
Date: Fri, 16 Feb 2024 15:18:38 -0500	[thread overview]
Message-ID: <4dabc394-f373-4d05-af4a-22d1d301da10@efficios.com> (raw)
In-Reply-To: <xnfrxtgo8f.fsf@greed.delorie.com>

On 2024-02-15 21 h 02, DJ Delorie wrote:
> 
> Michael Jeanson <mjeanson@efficios.com> writes:
>> We tracked this to the use of '-fmerge-all-constants' which allows the
>> compiler to merge identical constant variables.
> 
> I assume the linker's constant (string?) merging won't affect this
> because the section is marked as writable to the linker?

I checked and the .data.rel.ro section does indeed have the SHF_WRITE 
flag set. My understanding is that the section would need to be 
read-only and the SHF_MERGE flag would need to be set for the linker to 
try merging things.


>> diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
>> index 092c274f36..80eb0107b5 100644
>> --- a/sysdeps/nptl/dl-tls_init_tp.c
>> +++ b/sysdeps/nptl/dl-tls_init_tp.c
>> @@ -45,8 +45,10 @@ rtld_mutex_dummy (pthread_mutex_t *lock)
>>   #endif
>>   
>>   const unsigned int __rseq_flags;
>> -const unsigned int __rseq_size attribute_relro;
>> -const ptrdiff_t __rseq_offset attribute_relro;
>> +
>> +/* The variables are in .data.relro but are not yet write-protected.  */
>> +extern unsigned int _rseq_size attribute_relro attribute_hidden;
>> +extern ptrdiff_t _rseq_offset attribute_relro attribute_hidden;
> 
> er, extern *and* hidden?  And relro?
> 
> In theory the relro one is harmless but meaningless, as externs don't
> have sections in the local compilation unit.
> 
> The hidden one will mark the symbol hidden, but does that really matter
> as long as it's marked hidden where it's defined?

Both attributes can be removed, the definition in the assembly file is 
what matters. I'll clean this in the next patch series.


  reply	other threads:[~2024-02-16 20:18 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 16:27 [PATCH v8 0/8] Extend rseq support Michael Jeanson
2024-02-06 16:27 ` [PATCH v8 1/8] nptl: fix potential merge of __rseq_* relro symbols Michael Jeanson
2024-02-06 16:41   ` Mathieu Desnoyers
2024-02-16  2:02   ` DJ Delorie
2024-02-16 20:18     ` Michael Jeanson [this message]
2024-02-16 20:29       ` DJ Delorie
2024-02-06 16:27 ` [PATCH v8 2/8] Add rseq extensible ABI support Michael Jeanson
2024-02-16  4:42   ` DJ Delorie
2024-02-16 20:19     ` Michael Jeanson
2024-02-16 20:37       ` DJ Delorie
2024-02-16 21:10         ` Michael Jeanson
2024-02-16 21:17           ` DJ Delorie
2024-02-16 21:24             ` Michael Jeanson
2024-02-06 16:27 ` [PATCH v8 3/8] nptl: Add public __rseq_feature_size symbol Michael Jeanson
2024-02-16 22:07   ` DJ Delorie
2024-02-19 19:25     ` Michael Jeanson
2024-02-19 19:43       ` DJ Delorie
2024-02-19 20:15         ` Michael Jeanson
2024-02-19 20:24           ` DJ Delorie
2024-02-19 22:06             ` Michael Jeanson
2024-02-19 22:08               ` DJ Delorie
2024-02-19 22:18                 ` Michael Jeanson
2024-02-19 22:21                   ` DJ Delorie
2024-02-06 16:27 ` [PATCH v8 4/8] nptl: Add features to internal 'struct rseq_area' Michael Jeanson
2024-02-17  2:04   ` DJ Delorie
2024-02-06 16:27 ` [PATCH v8 5/8] nptl: Add rseq internal utils Michael Jeanson
2024-02-17  2:33   ` DJ Delorie
2024-02-19 20:25     ` Michael Jeanson
2024-02-06 16:27 ` [PATCH v8 6/8] x86-64: Add rseq_load32_load32_relaxed Michael Jeanson
2024-02-17  3:08   ` DJ Delorie
2024-02-19 20:27     ` Michael Jeanson
2024-02-06 16:28 ` [PATCH v8 7/8] aarch64: " Michael Jeanson
2024-02-17  3:53   ` DJ Delorie
2024-02-19 20:29     ` Michael Jeanson
2024-02-20 15:07     ` Mathieu Desnoyers
2024-02-20 17:55       ` DJ Delorie
2024-02-06 16:28 ` [PATCH v8 8/8] Linux: Use rseq to accelerate getcpu Michael Jeanson
2024-02-17  3:57   ` DJ Delorie
2024-02-19 22:14     ` Michael Jeanson

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=4dabc394-f373-4d05-af4a-22d1d301da10@efficios.com \
    --to=mjeanson@efficios.com \
    --cc=dj@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mathieu.desnoyers@efficios.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).