public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Michael Jeanson <mjeanson@efficios.com>
To: libc-alpha@sourceware.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH v2] nptl: fix potential merge of __rseq_* relro symbols
Date: Mon, 22 Jan 2024 17:13:48 -0500	[thread overview]
Message-ID: <13f9afab-627b-4859-be6a-d91da6411ff8@efficios.com> (raw)
In-Reply-To: <20240122221129.88104-1-mjeanson@efficios.com>

On 2024-01-22 17:11, Michael Jeanson wrote:
> 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.
> 
> Move the definitions of these variables into an assembler file and add
> hidden writable aliases for internal use. This has the added bonus of
> removing the asm workaround to set the values on rseq registration.
> 
> Tested on Debian 12 with GCC 12.2.

Hi Florian,

I took a crack at it, hopefully it's close to what you had in mind.

Michael


      reply	other threads:[~2024-01-22 22:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 21:09 [PATCH] " 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
2024-01-16 15:28   ` Michael Jeanson
2024-01-22 22:11   ` [PATCH v2] " Michael Jeanson
2024-01-22 22:13     ` Michael Jeanson [this message]

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=13f9afab-627b-4859-be6a-d91da6411ff8@efficios.com \
    --to=mjeanson@efficios.com \
    --cc=fweimer@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).