about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
authorMichael Jeanson <mjeanson@efficios.com>2024-07-03 12:35:34 -0400
committerFlorian Weimer <fweimer@redhat.com>2024-07-16 16:33:53 +0200
commit1062ebbd1911ec9efe909765ca3ee3809ec3fd67 (patch)
tree1802417672ae44d534bddb990908a2e5fa6e2a24 /login
parent5c46e6b66636be0010e9a732d5ba1e65ebd54687 (diff)
downloadglibc-1062ebbd1911ec9efe909765ca3ee3809ec3fd67.tar.gz
glibc-1062ebbd1911ec9efe909765ca3ee3809ec3fd67.tar.xz
glibc-1062ebbd1911ec9efe909765ca3ee3809ec3fd67.zip
nptl: fix potential merge of __rseq_* relro symbols
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.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 2b92982e2369d292560793bee8e730f695f48ff3)
Diffstat (limited to 'login')
0 files changed, 0 insertions, 0 deletions