public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Michael Jeanson <mjeanson@efficios.com>
Cc: libc-alpha@sourceware.org,
	 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] nptl: fix potential merge of __rseq_* relro symbols
Date: Tue, 16 Jan 2024 12:25:25 +0100	[thread overview]
Message-ID: <87o7dl34gq.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20240115210931.1267987-1-mjeanson@efficios.com> (Michael Jeanson's message of "Mon, 15 Jan 2024 16:09:31 -0500")

* Michael Jeanson:

> While working on a patch to add support for the extensible rseq ABI, we
> came across an issue where a new 'const' variable would be merged with
> the existing '__rseq_size' variable. We tracked this to the use of
> '-fmerge-all-constants' which allows the compiler to merge identical
> constant variables. This means that all 'const' variables in a compile
> unit that are of the same size and are initialized to the same value can
> be merged.
>
> In this specific case, on 32 bit systems 'unsigned int' and 'ptrdiff_t'
> are both 4 bytes and initialized to 0 which should trigger the merge.
> However for reasons we haven't delved into when the attribute 'section
> (".data.rel.ro")' is added to the mix, only variables of the same exact
> types are merged. As far as we know this behavior is not specified
> anywhere and could change with a new compiler version, hence this patch.
>
> Declare both variables as regular static variables and add 'extern
> const' aliases for the ABI. This has the added bonus of removing the asm
> workaround to set the values on rseq registration.

I think we should move the definition of these variables into an
assembler file, like elf/dl-debug-symbols.S.  This way, we can also
create the desired hidden aliases more easily, too.

I can come up with a patch or review yours, please tell me what you
prefer.

Thanks,
Florian


  parent reply	other threads:[~2024-01-16 11:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 21:09 Michael Jeanson
2024-01-15 21:20 ` H.J. Lu
2024-01-15 21:34   ` Michael Jeanson
2024-01-15 21:44     ` Michael Jeanson
2024-01-16 11:25 ` Florian Weimer [this message]
2024-01-16 15:28   ` Michael Jeanson
2024-01-22 22:11   ` [PATCH v2] " Michael Jeanson
2024-01-22 22:13     ` 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=87o7dl34gq.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mjeanson@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).