import UBI glibc-2.39-46.el10_0.4
This commit is contained in:
parent
2724a0cbd4
commit
9169b83e01
193
glibc-RHEL-104853-1.patch
Normal file
193
glibc-RHEL-104853-1.patch
Normal file
@ -0,0 +1,193 @@
|
||||
commit fbade65338cff0a3a1699a8627a8180e9a01a627
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Feb 22 10:42:55 2024 -0300
|
||||
|
||||
arm: Use _dl_find_object on __gnu_Unwind_Find_exidx (BZ 31405)
|
||||
|
||||
Instead of __dl_iterate_phdr. On ARM dlfo_eh_frame/dlfo_eh_count
|
||||
maps to PT_ARM_EXIDX vaddr start / length.
|
||||
|
||||
On a Neoverse N1 machine with 160 cores, the following program:
|
||||
|
||||
$ cat test.c
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
|
||||
enum {
|
||||
niter = 1024,
|
||||
ntimes = 128,
|
||||
};
|
||||
|
||||
static void *
|
||||
tf (void *arg)
|
||||
{
|
||||
int a = (int) arg;
|
||||
|
||||
for (int i = 0; i < niter; i++)
|
||||
{
|
||||
void *p[ntimes];
|
||||
for (int j = 0; j < ntimes; j++)
|
||||
p[j] = malloc (a * 128);
|
||||
for (int j = 0; j < ntimes; j++)
|
||||
free (p[j]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
enum { nthreads = 16 };
|
||||
pthread_t t[nthreads];
|
||||
|
||||
for (int i = 0; i < nthreads; i ++)
|
||||
assert (pthread_create (&t[i], NULL, tf, (void *) i) == 0);
|
||||
|
||||
for (int i = 0; i < nthreads; i++)
|
||||
{
|
||||
void *r;
|
||||
assert (pthread_join (t[i], &r) == 0);
|
||||
assert (r == NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
$ arm-linux-gnueabihf-gcc -fsanitize=address test.c -o test
|
||||
|
||||
Improves from ~15s to 0.5s.
|
||||
|
||||
Checked on arm-linux-gnueabihf.
|
||||
|
||||
(cherry picked from commit f4c142bb9fe6b02c0af8cfca8a920091e2dba44b)
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 0d34de3b2c99e5bd..a8193a0d0b5b64a6 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -34,6 +34,7 @@ routines = \
|
||||
dl-addr \
|
||||
dl-addr-obj \
|
||||
dl-early_allocate \
|
||||
+ dl-find_object \
|
||||
dl-iteratephdr \
|
||||
dl-libc \
|
||||
dl-origin \
|
||||
@@ -60,7 +61,6 @@ dl-routines = \
|
||||
dl-deps \
|
||||
dl-exception \
|
||||
dl-execstack \
|
||||
- dl-find_object \
|
||||
dl-fini \
|
||||
dl-init \
|
||||
dl-load \
|
||||
diff --git a/elf/dl-find_object.c b/elf/dl-find_object.c
|
||||
index 940fa5c2236af666..449302eda35ce96f 100644
|
||||
--- a/elf/dl-find_object.c
|
||||
+++ b/elf/dl-find_object.c
|
||||
@@ -356,7 +356,7 @@ _dlfo_lookup (uintptr_t pc, struct dl_find_object_internal *first1, size_t size)
|
||||
}
|
||||
|
||||
int
|
||||
-_dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
+__dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
{
|
||||
uintptr_t pc = (uintptr_t) pc1;
|
||||
|
||||
@@ -463,7 +463,8 @@ _dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
return -1;
|
||||
} /* Transaction retry loop. */
|
||||
}
|
||||
-rtld_hidden_def (_dl_find_object)
|
||||
+hidden_def (__dl_find_object)
|
||||
+weak_alias (__dl_find_object, _dl_find_object)
|
||||
|
||||
/* _dlfo_process_initial is called twice. First to compute the array
|
||||
sizes from the initial loaded mappings. Second to fill in the
|
||||
diff --git a/include/dlfcn.h b/include/dlfcn.h
|
||||
index a44420fa37439a85..f49ee1b0c9958d38 100644
|
||||
--- a/include/dlfcn.h
|
||||
+++ b/include/dlfcn.h
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <link.h> /* For ElfW. */
|
||||
#include <stdbool.h>
|
||||
|
||||
-rtld_hidden_proto (_dl_find_object)
|
||||
+extern __typeof (_dl_find_object) __dl_find_object;
|
||||
+hidden_proto (__dl_find_object)
|
||||
|
||||
/* Internally used flag. */
|
||||
#define __RTLD_DLOPEN 0x80000000
|
||||
diff --git a/sysdeps/arm/find_exidx.c b/sysdeps/arm/find_exidx.c
|
||||
index d647865e5a098cd5..a924d59b9f75d7b2 100644
|
||||
--- a/sysdeps/arm/find_exidx.c
|
||||
+++ b/sysdeps/arm/find_exidx.c
|
||||
@@ -16,64 +16,15 @@
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <link.h>
|
||||
-#include <unwind.h>
|
||||
-
|
||||
-struct unw_eh_callback_data
|
||||
-{
|
||||
- _Unwind_Ptr pc;
|
||||
- _Unwind_Ptr exidx_start;
|
||||
- int exidx_len;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/* Callback to determines if the PC lies within an object, and remember the
|
||||
- location of the exception index table if it does. */
|
||||
-
|
||||
-static int
|
||||
-find_exidx_callback (struct dl_phdr_info * info, size_t size, void * ptr)
|
||||
-{
|
||||
- struct unw_eh_callback_data * data;
|
||||
- const ElfW(Phdr) *phdr;
|
||||
- int i;
|
||||
- int match;
|
||||
- _Unwind_Ptr load_base;
|
||||
-
|
||||
- data = (struct unw_eh_callback_data *) ptr;
|
||||
- load_base = info->dlpi_addr;
|
||||
- phdr = info->dlpi_phdr;
|
||||
-
|
||||
- match = 0;
|
||||
- for (i = info->dlpi_phnum; i > 0; i--, phdr++)
|
||||
- {
|
||||
- if (phdr->p_type == PT_LOAD)
|
||||
- {
|
||||
- _Unwind_Ptr vaddr = phdr->p_vaddr + load_base;
|
||||
- if (data->pc >= vaddr && data->pc < vaddr + phdr->p_memsz)
|
||||
- match = 1;
|
||||
- }
|
||||
- else if (phdr->p_type == PT_ARM_EXIDX)
|
||||
- {
|
||||
- data->exidx_start = (_Unwind_Ptr) (phdr->p_vaddr + load_base);
|
||||
- data->exidx_len = phdr->p_memsz;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return match;
|
||||
-}
|
||||
-
|
||||
|
||||
/* Find the exception index table containing PC. */
|
||||
|
||||
_Unwind_Ptr
|
||||
__gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
|
||||
{
|
||||
- struct unw_eh_callback_data data;
|
||||
-
|
||||
- data.pc = pc;
|
||||
- data.exidx_start = 0;
|
||||
- if (__dl_iterate_phdr (find_exidx_callback, &data) <= 0)
|
||||
+ struct dl_find_object data;
|
||||
+ if (__dl_find_object ((void *) pc, &data) < 0)
|
||||
return 0;
|
||||
-
|
||||
- *pcount = data.exidx_len / 8;
|
||||
- return data.exidx_start;
|
||||
+ *pcount = data.dlfo_eh_count;
|
||||
+ return (_Unwind_Ptr) data.dlfo_eh_frame;
|
||||
}
|
||||
93
glibc-RHEL-104853-2.patch
Normal file
93
glibc-RHEL-104853-2.patch
Normal file
@ -0,0 +1,93 @@
|
||||
commit 9833fcf7ce7a7ac7ec5b7694fd4c2bc705282842
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Sat Feb 1 12:37:58 2025 +0100
|
||||
|
||||
elf: Do not add a copy of _dl_find_object to libc.so
|
||||
|
||||
This reduces code size and dependencies on ld.so internals from
|
||||
libc.so.
|
||||
|
||||
Fixes commit f4c142bb9fe6b02c0af8cfca8a920091e2dba44b
|
||||
("arm: Use _dl_find_object on __gnu_Unwind_Find_exidx (BZ 31405)").
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 96429bcc91a14f71b177ddc5e716de3069060f2c)
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index a8193a0d0b5b64a6..0d34de3b2c99e5bd 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -34,7 +34,6 @@ routines = \
|
||||
dl-addr \
|
||||
dl-addr-obj \
|
||||
dl-early_allocate \
|
||||
- dl-find_object \
|
||||
dl-iteratephdr \
|
||||
dl-libc \
|
||||
dl-origin \
|
||||
@@ -61,6 +60,7 @@ dl-routines = \
|
||||
dl-deps \
|
||||
dl-exception \
|
||||
dl-execstack \
|
||||
+ dl-find_object \
|
||||
dl-fini \
|
||||
dl-init \
|
||||
dl-load \
|
||||
diff --git a/elf/dl-find_object.c b/elf/dl-find_object.c
|
||||
index 449302eda35ce96f..940fa5c2236af666 100644
|
||||
--- a/elf/dl-find_object.c
|
||||
+++ b/elf/dl-find_object.c
|
||||
@@ -356,7 +356,7 @@ _dlfo_lookup (uintptr_t pc, struct dl_find_object_internal *first1, size_t size)
|
||||
}
|
||||
|
||||
int
|
||||
-__dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
+_dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
{
|
||||
uintptr_t pc = (uintptr_t) pc1;
|
||||
|
||||
@@ -463,8 +463,7 @@ __dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
return -1;
|
||||
} /* Transaction retry loop. */
|
||||
}
|
||||
-hidden_def (__dl_find_object)
|
||||
-weak_alias (__dl_find_object, _dl_find_object)
|
||||
+rtld_hidden_def (_dl_find_object)
|
||||
|
||||
/* _dlfo_process_initial is called twice. First to compute the array
|
||||
sizes from the initial loaded mappings. Second to fill in the
|
||||
diff --git a/include/dlfcn.h b/include/dlfcn.h
|
||||
index f49ee1b0c9958d38..a44420fa37439a85 100644
|
||||
--- a/include/dlfcn.h
|
||||
+++ b/include/dlfcn.h
|
||||
@@ -4,8 +4,7 @@
|
||||
#include <link.h> /* For ElfW. */
|
||||
#include <stdbool.h>
|
||||
|
||||
-extern __typeof (_dl_find_object) __dl_find_object;
|
||||
-hidden_proto (__dl_find_object)
|
||||
+rtld_hidden_proto (_dl_find_object)
|
||||
|
||||
/* Internally used flag. */
|
||||
#define __RTLD_DLOPEN 0x80000000
|
||||
diff --git a/sysdeps/arm/find_exidx.c b/sysdeps/arm/find_exidx.c
|
||||
index a924d59b9f75d7b2..4257c268381df540 100644
|
||||
--- a/sysdeps/arm/find_exidx.c
|
||||
+++ b/sysdeps/arm/find_exidx.c
|
||||
@@ -15,6 +15,7 @@
|
||||
License along with the GNU C Library. If not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
+#include <ldsodefs.h>
|
||||
#include <link.h>
|
||||
|
||||
/* Find the exception index table containing PC. */
|
||||
@@ -23,7 +24,7 @@ _Unwind_Ptr
|
||||
__gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
|
||||
{
|
||||
struct dl_find_object data;
|
||||
- if (__dl_find_object ((void *) pc, &data) < 0)
|
||||
+ if (GLRO(dl_find_object) ((void *) pc, &data) < 0)
|
||||
return 0;
|
||||
*pcount = data.dlfo_eh_count;
|
||||
return (_Unwind_Ptr) data.dlfo_eh_frame;
|
||||
89
glibc-RHEL-104853-3.patch
Normal file
89
glibc-RHEL-104853-3.patch
Normal file
@ -0,0 +1,89 @@
|
||||
commit 64488b4b31d63b59b06b42ad93a092053364801b
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Aug 1 10:20:23 2025 +0200
|
||||
|
||||
elf: Extract rtld_setup_phdr function from dl_main
|
||||
|
||||
Remove historic binutils reference from comment and update
|
||||
how this data is used by applications.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 2cac9559e06044ba520e785c151fbbd25011865f)
|
||||
|
||||
diff --git a/elf/rtld.c b/elf/rtld.c
|
||||
index 3ca9a11009a74626..3bf9707e0007bc83 100644
|
||||
--- a/elf/rtld.c
|
||||
+++ b/elf/rtld.c
|
||||
@@ -1284,6 +1284,37 @@ rtld_setup_main_map (struct link_map *main_map)
|
||||
return has_interp;
|
||||
}
|
||||
|
||||
+/* Set up the program header information for the dynamic linker
|
||||
+ itself. It can be accessed via _r_debug and dl_iterate_phdr
|
||||
+ callbacks. */
|
||||
+static void
|
||||
+rtld_setup_phdr (void)
|
||||
+{
|
||||
+ /* Starting from binutils-2.23, the linker will define the magic
|
||||
+ symbol __ehdr_start to point to our own ELF header if it is
|
||||
+ visible in a segment that also includes the phdrs. */
|
||||
+
|
||||
+ const ElfW(Ehdr) *rtld_ehdr = &__ehdr_start;
|
||||
+ assert (rtld_ehdr->e_ehsize == sizeof *rtld_ehdr);
|
||||
+ assert (rtld_ehdr->e_phentsize == sizeof (ElfW(Phdr)));
|
||||
+
|
||||
+ const ElfW(Phdr) *rtld_phdr = (const void *) rtld_ehdr + rtld_ehdr->e_phoff;
|
||||
+
|
||||
+ GL(dl_rtld_map).l_phdr = rtld_phdr;
|
||||
+ GL(dl_rtld_map).l_phnum = rtld_ehdr->e_phnum;
|
||||
+
|
||||
+
|
||||
+ /* PT_GNU_RELRO is usually the last phdr. */
|
||||
+ size_t cnt = rtld_ehdr->e_phnum;
|
||||
+ while (cnt-- > 0)
|
||||
+ if (rtld_phdr[cnt].p_type == PT_GNU_RELRO)
|
||||
+ {
|
||||
+ GL(dl_rtld_map).l_relro_addr = rtld_phdr[cnt].p_vaddr;
|
||||
+ GL(dl_rtld_map).l_relro_size = rtld_phdr[cnt].p_memsz;
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Adjusts the contents of the stack and related globals for the user
|
||||
entry point. The ld.so processed skip_args arguments and bumped
|
||||
_dl_argv and _dl_argc accordingly. Those arguments are removed from
|
||||
@@ -1749,33 +1780,7 @@ dl_main (const ElfW(Phdr) *phdr,
|
||||
++GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
|
||||
++GL(dl_load_adds);
|
||||
|
||||
- /* Starting from binutils-2.23, the linker will define the magic symbol
|
||||
- __ehdr_start to point to our own ELF header if it is visible in a
|
||||
- segment that also includes the phdrs. If that's not available, we use
|
||||
- the old method that assumes the beginning of the file is part of the
|
||||
- lowest-addressed PT_LOAD segment. */
|
||||
-
|
||||
- /* Set up the program header information for the dynamic linker
|
||||
- itself. It is needed in the dl_iterate_phdr callbacks. */
|
||||
- const ElfW(Ehdr) *rtld_ehdr = &__ehdr_start;
|
||||
- assert (rtld_ehdr->e_ehsize == sizeof *rtld_ehdr);
|
||||
- assert (rtld_ehdr->e_phentsize == sizeof (ElfW(Phdr)));
|
||||
-
|
||||
- const ElfW(Phdr) *rtld_phdr = (const void *) rtld_ehdr + rtld_ehdr->e_phoff;
|
||||
-
|
||||
- GL(dl_rtld_map).l_phdr = rtld_phdr;
|
||||
- GL(dl_rtld_map).l_phnum = rtld_ehdr->e_phnum;
|
||||
-
|
||||
-
|
||||
- /* PT_GNU_RELRO is usually the last phdr. */
|
||||
- size_t cnt = rtld_ehdr->e_phnum;
|
||||
- while (cnt-- > 0)
|
||||
- if (rtld_phdr[cnt].p_type == PT_GNU_RELRO)
|
||||
- {
|
||||
- GL(dl_rtld_map).l_relro_addr = rtld_phdr[cnt].p_vaddr;
|
||||
- GL(dl_rtld_map).l_relro_size = rtld_phdr[cnt].p_memsz;
|
||||
- break;
|
||||
- }
|
||||
+ rtld_setup_phdr ();
|
||||
|
||||
/* Add the dynamic linker to the TLS list if it also uses TLS. */
|
||||
if (GL(dl_rtld_map).l_tls_blocksize != 0)
|
||||
448
glibc-RHEL-104853-4.patch
Normal file
448
glibc-RHEL-104853-4.patch
Normal file
@ -0,0 +1,448 @@
|
||||
commit 49f0e73fa3279465f4c9d86a286c3812cc377061
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Aug 1 12:19:49 2025 +0200
|
||||
|
||||
elf: Handle ld.so with LOAD segment gaps in _dl_find_object (bug 31943)
|
||||
|
||||
Detect if ld.so not contiguous and handle that case in _dl_find_object.
|
||||
Set l_find_object_processed even for initially loaded link maps,
|
||||
otherwise dlopen of an initially loaded object adds it to
|
||||
_dlfo_loaded_mappings (where maps are expected to be contiguous),
|
||||
in addition to _dlfo_nodelete_mappings.
|
||||
|
||||
Test elf/tst-link-map-contiguous-ldso iterates over the loader
|
||||
image, reading every word to make sure memory is actually mapped.
|
||||
It only does that if the l_contiguous flag is set for the link map.
|
||||
Otherwise, it finds gaps with mmap and checks that _dl_find_object
|
||||
does not return the ld.so mapping for them.
|
||||
|
||||
The test elf/tst-link-map-contiguous-main does the same thing for
|
||||
the libc.so shared object. This only works if the kernel loaded
|
||||
the main program because the glibc dynamic loader may fill
|
||||
the gaps with PROT_NONE mappings in some cases, making it contiguous,
|
||||
but accesses to individual words may still fault.
|
||||
|
||||
Test elf/tst-link-map-contiguous-libc is again slightly different
|
||||
because the dynamic loader always fills the gaps with PROT_NONE
|
||||
mappings, so a different form of probing has to be used.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 20681be149b9eb1b6c1f4246bf4bd801221c86cd)
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 0d34de3b2c99e5bd..39aabe04a85f26f4 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -513,6 +513,8 @@ tests-internal += \
|
||||
tst-dl_find_object \
|
||||
tst-dl_find_object-threads \
|
||||
tst-dlmopen2 \
|
||||
+ tst-link-map-contiguous-ldso \
|
||||
+ tst-link-map-contiguous-libc \
|
||||
tst-ptrguard1 \
|
||||
tst-stackguard1 \
|
||||
tst-tls-surplus \
|
||||
@@ -524,6 +526,10 @@ tests-internal += \
|
||||
unload2 \
|
||||
# tests-internal
|
||||
|
||||
+ifeq ($(build-hardcoded-path-in-tests),yes)
|
||||
+tests-internal += tst-link-map-contiguous-main
|
||||
+endif
|
||||
+
|
||||
tests-container += \
|
||||
tst-dlopen-self-container \
|
||||
tst-dlopen-tlsmodid-container \
|
||||
diff --git a/elf/dl-find_object.c b/elf/dl-find_object.c
|
||||
index 940fa5c2236af666..0e45f0af32c9e6b4 100644
|
||||
--- a/elf/dl-find_object.c
|
||||
+++ b/elf/dl-find_object.c
|
||||
@@ -465,6 +465,37 @@ _dl_find_object (void *pc1, struct dl_find_object *result)
|
||||
}
|
||||
rtld_hidden_def (_dl_find_object)
|
||||
|
||||
+/* Subroutine of _dlfo_process_initial to split out noncontigous link
|
||||
+ maps. NODELETE is the number of used _dlfo_nodelete_mappings
|
||||
+ elements. It is incremented as needed, and the new NODELETE value
|
||||
+ is returned. */
|
||||
+static size_t
|
||||
+_dlfo_process_initial_noncontiguous_map (struct link_map *map,
|
||||
+ size_t nodelete)
|
||||
+{
|
||||
+ struct dl_find_object_internal dlfo;
|
||||
+ _dl_find_object_from_map (map, &dlfo);
|
||||
+
|
||||
+ /* PT_LOAD segments for a non-contiguous link map are added to the
|
||||
+ non-closeable mappings. */
|
||||
+ const ElfW(Phdr) *ph = map->l_phdr;
|
||||
+ const ElfW(Phdr) *ph_end = map->l_phdr + map->l_phnum;
|
||||
+ for (; ph < ph_end; ++ph)
|
||||
+ if (ph->p_type == PT_LOAD)
|
||||
+ {
|
||||
+ if (_dlfo_nodelete_mappings != NULL)
|
||||
+ {
|
||||
+ /* Second pass only. */
|
||||
+ _dlfo_nodelete_mappings[nodelete] = dlfo;
|
||||
+ ElfW(Addr) start = ph->p_vaddr + map->l_addr;
|
||||
+ _dlfo_nodelete_mappings[nodelete].map_start = start;
|
||||
+ _dlfo_nodelete_mappings[nodelete].map_end = start + ph->p_memsz;
|
||||
+ }
|
||||
+ ++nodelete;
|
||||
+ }
|
||||
+ return nodelete;
|
||||
+}
|
||||
+
|
||||
/* _dlfo_process_initial is called twice. First to compute the array
|
||||
sizes from the initial loaded mappings. Second to fill in the
|
||||
bases and infos arrays with the (still unsorted) data. Returns the
|
||||
@@ -476,29 +507,8 @@ _dlfo_process_initial (void)
|
||||
|
||||
size_t nodelete = 0;
|
||||
if (!main_map->l_contiguous)
|
||||
- {
|
||||
- struct dl_find_object_internal dlfo;
|
||||
- _dl_find_object_from_map (main_map, &dlfo);
|
||||
-
|
||||
- /* PT_LOAD segments for a non-contiguous are added to the
|
||||
- non-closeable mappings. */
|
||||
- for (const ElfW(Phdr) *ph = main_map->l_phdr,
|
||||
- *ph_end = main_map->l_phdr + main_map->l_phnum;
|
||||
- ph < ph_end; ++ph)
|
||||
- if (ph->p_type == PT_LOAD)
|
||||
- {
|
||||
- if (_dlfo_nodelete_mappings != NULL)
|
||||
- {
|
||||
- /* Second pass only. */
|
||||
- _dlfo_nodelete_mappings[nodelete] = dlfo;
|
||||
- _dlfo_nodelete_mappings[nodelete].map_start
|
||||
- = ph->p_vaddr + main_map->l_addr;
|
||||
- _dlfo_nodelete_mappings[nodelete].map_end
|
||||
- = _dlfo_nodelete_mappings[nodelete].map_start + ph->p_memsz;
|
||||
- }
|
||||
- ++nodelete;
|
||||
- }
|
||||
- }
|
||||
+ /* Contiguous case already handled in _dl_find_object_init. */
|
||||
+ nodelete = _dlfo_process_initial_noncontiguous_map (main_map, nodelete);
|
||||
|
||||
size_t loaded = 0;
|
||||
for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
|
||||
@@ -510,11 +520,22 @@ _dlfo_process_initial (void)
|
||||
/* lt_library link maps are implicitly NODELETE. */
|
||||
if (l->l_type == lt_library || l->l_nodelete_active)
|
||||
{
|
||||
- if (_dlfo_nodelete_mappings != NULL)
|
||||
- /* Second pass only. */
|
||||
- _dl_find_object_from_map
|
||||
- (l, _dlfo_nodelete_mappings + nodelete);
|
||||
- ++nodelete;
|
||||
+ /* The kernel may have loaded ld.so with gaps. */
|
||||
+ if (!l->l_contiguous
|
||||
+#ifdef SHARED
|
||||
+ && l == &GL(dl_rtld_map)
|
||||
+#endif
|
||||
+ )
|
||||
+ nodelete
|
||||
+ = _dlfo_process_initial_noncontiguous_map (l, nodelete);
|
||||
+ else
|
||||
+ {
|
||||
+ if (_dlfo_nodelete_mappings != NULL)
|
||||
+ /* Second pass only. */
|
||||
+ _dl_find_object_from_map
|
||||
+ (l, _dlfo_nodelete_mappings + nodelete);
|
||||
+ ++nodelete;
|
||||
+ }
|
||||
}
|
||||
else if (l->l_type == lt_loaded)
|
||||
{
|
||||
@@ -756,7 +777,6 @@ _dl_find_object_update_1 (struct link_map **loaded, size_t count)
|
||||
/* Prefer newly loaded link map. */
|
||||
assert (loaded_index1 > 0);
|
||||
_dl_find_object_from_map (loaded[loaded_index1 - 1], dlfo);
|
||||
- loaded[loaded_index1 - 1]->l_find_object_processed = 1;
|
||||
--loaded_index1;
|
||||
}
|
||||
|
||||
diff --git a/elf/dl-find_object.h b/elf/dl-find_object.h
|
||||
index 0915065be065504d..8894c6657c9dc309 100644
|
||||
--- a/elf/dl-find_object.h
|
||||
+++ b/elf/dl-find_object.h
|
||||
@@ -87,7 +87,7 @@ _dl_find_object_to_external (struct dl_find_object_internal *internal,
|
||||
}
|
||||
|
||||
/* Extract the object location data from a link map and writes it to
|
||||
- *RESULT using relaxed MO stores. */
|
||||
+ *RESULT using relaxed MO stores. Set L->l_find_object_processed. */
|
||||
static void __attribute__ ((unused))
|
||||
_dl_find_object_from_map (struct link_map *l,
|
||||
struct dl_find_object_internal *result)
|
||||
@@ -100,6 +100,8 @@ _dl_find_object_from_map (struct link_map *l,
|
||||
atomic_store_relaxed (&result->eh_dbase, (void *) l->l_info[DT_PLTGOT]);
|
||||
#endif
|
||||
|
||||
+ l->l_find_object_processed = 1;
|
||||
+
|
||||
for (const ElfW(Phdr) *ph = l->l_phdr, *ph_end = l->l_phdr + l->l_phnum;
|
||||
ph < ph_end; ++ph)
|
||||
if (ph->p_type == DLFO_EH_SEGMENT_TYPE)
|
||||
diff --git a/elf/rtld.c b/elf/rtld.c
|
||||
index 3bf9707e0007bc83..4760633866cf9159 100644
|
||||
--- a/elf/rtld.c
|
||||
+++ b/elf/rtld.c
|
||||
@@ -1286,7 +1286,7 @@ rtld_setup_main_map (struct link_map *main_map)
|
||||
|
||||
/* Set up the program header information for the dynamic linker
|
||||
itself. It can be accessed via _r_debug and dl_iterate_phdr
|
||||
- callbacks. */
|
||||
+ callbacks, and it is used by _dl_find_object. */
|
||||
static void
|
||||
rtld_setup_phdr (void)
|
||||
{
|
||||
@@ -1304,6 +1304,29 @@ rtld_setup_phdr (void)
|
||||
GL(dl_rtld_map).l_phnum = rtld_ehdr->e_phnum;
|
||||
|
||||
|
||||
+ GL(dl_rtld_map).l_contiguous = 1;
|
||||
+ /* The linker may not have produced a contiguous object. The kernel
|
||||
+ will load the object with actual gaps (unlike the glibc loader
|
||||
+ for shared objects, which always produces a contiguous mapping).
|
||||
+ See similar logic in rtld_setup_main_map above. */
|
||||
+ {
|
||||
+ ElfW(Addr) expected_load_address = 0;
|
||||
+ for (const ElfW(Phdr) *ph = rtld_phdr; ph < &rtld_phdr[rtld_ehdr->e_phnum];
|
||||
+ ++ph)
|
||||
+ if (ph->p_type == PT_LOAD)
|
||||
+ {
|
||||
+ ElfW(Addr) mapstart = ph->p_vaddr & ~(GLRO(dl_pagesize) - 1);
|
||||
+ if (GL(dl_rtld_map).l_contiguous && expected_load_address != 0
|
||||
+ && expected_load_address != mapstart)
|
||||
+ GL(dl_rtld_map).l_contiguous = 0;
|
||||
+ ElfW(Addr) allocend = ph->p_vaddr + ph->p_memsz;
|
||||
+ /* The next expected address is the page following this load
|
||||
+ segment. */
|
||||
+ expected_load_address = ((allocend + GLRO(dl_pagesize) - 1)
|
||||
+ & ~(GLRO(dl_pagesize) - 1));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* PT_GNU_RELRO is usually the last phdr. */
|
||||
size_t cnt = rtld_ehdr->e_phnum;
|
||||
while (cnt-- > 0)
|
||||
diff --git a/elf/tst-link-map-contiguous-ldso.c b/elf/tst-link-map-contiguous-ldso.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..04de808bb234fe38
|
||||
--- /dev/null
|
||||
+++ b/elf/tst-link-map-contiguous-ldso.c
|
||||
@@ -0,0 +1,98 @@
|
||||
+/* Check that _dl_find_object behavior matches up with gaps.
|
||||
+ Copyright (C) 2025 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <dlfcn.h>
|
||||
+#include <gnu/lib-names.h>
|
||||
+#include <link.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <stdio.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xdlfcn.h>
|
||||
+#include <support/xunistd.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ struct link_map *l = xdlopen (LD_SO, RTLD_NOW);
|
||||
+ if (!l->l_contiguous)
|
||||
+ {
|
||||
+ puts ("info: ld.so link map is not contiguous");
|
||||
+
|
||||
+ /* Try to find holes by probing with mmap. */
|
||||
+ int pagesize = getpagesize ();
|
||||
+ bool gap_found = false;
|
||||
+ ElfW(Addr) addr = l->l_map_start;
|
||||
+ TEST_COMPARE (addr % pagesize, 0);
|
||||
+ while (addr < l->l_map_end)
|
||||
+ {
|
||||
+ void *expected = (void *) addr;
|
||||
+ void *ptr = xmmap (expected, 1, PROT_READ | PROT_WRITE,
|
||||
+ MAP_PRIVATE | MAP_ANONYMOUS, -1);
|
||||
+ struct dl_find_object dlfo;
|
||||
+ int dlfo_ret = _dl_find_object (expected, &dlfo);
|
||||
+ if (ptr == expected)
|
||||
+ {
|
||||
+ if (dlfo_ret < 0)
|
||||
+ {
|
||||
+ TEST_COMPARE (dlfo_ret, -1);
|
||||
+ printf ("info: hole without mapping data found at %p\n", ptr);
|
||||
+ }
|
||||
+ else
|
||||
+ FAIL ("object \"%s\" found in gap at %p",
|
||||
+ dlfo.dlfo_link_map->l_name, ptr);
|
||||
+ gap_found = true;
|
||||
+ }
|
||||
+ else if (dlfo_ret == 0)
|
||||
+ {
|
||||
+ if ((void *) dlfo.dlfo_link_map != (void *) l)
|
||||
+ {
|
||||
+ printf ("info: object \"%s\" found at %p\n",
|
||||
+ dlfo.dlfo_link_map->l_name, ptr);
|
||||
+ gap_found = true;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ TEST_COMPARE (dlfo_ret, -1);
|
||||
+ xmunmap (ptr, 1);
|
||||
+ addr += pagesize;
|
||||
+ }
|
||||
+ if (!gap_found)
|
||||
+ FAIL ("no ld.so gap found");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ puts ("info: ld.so link map is contiguous");
|
||||
+
|
||||
+ /* Assert that ld.so is truly contiguous in memory. */
|
||||
+ volatile long int *p = (volatile long int *) l->l_map_start;
|
||||
+ volatile long int *end = (volatile long int *) l->l_map_end;
|
||||
+ while (p < end)
|
||||
+ {
|
||||
+ *p;
|
||||
+ ++p;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ xdlclose (l);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/elf/tst-link-map-contiguous-libc.c b/elf/tst-link-map-contiguous-libc.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..eb5728c765ac3cfb
|
||||
--- /dev/null
|
||||
+++ b/elf/tst-link-map-contiguous-libc.c
|
||||
@@ -0,0 +1,57 @@
|
||||
+/* Check that the entire libc.so program image is readable if contiguous.
|
||||
+ Copyright (C) 2025 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <gnu/lib-names.h>
|
||||
+#include <link.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xdlfcn.h>
|
||||
+#include <support/xunistd.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ struct link_map *l = xdlopen (LIBC_SO, RTLD_NOW);
|
||||
+
|
||||
+ /* The dynamic loader fills holes with PROT_NONE mappings. */
|
||||
+ if (!l->l_contiguous)
|
||||
+ FAIL_EXIT1 ("libc.so link map is not contiguous");
|
||||
+
|
||||
+ /* Direct probing does not work because not everything is readable
|
||||
+ due to PROT_NONE mappings. */
|
||||
+ int pagesize = getpagesize ();
|
||||
+ ElfW(Addr) addr = l->l_map_start;
|
||||
+ TEST_COMPARE (addr % pagesize, 0);
|
||||
+ while (addr < l->l_map_end)
|
||||
+ {
|
||||
+ void *expected = (void *) addr;
|
||||
+ void *ptr = xmmap (expected, 1, PROT_READ | PROT_WRITE,
|
||||
+ MAP_PRIVATE | MAP_ANONYMOUS, -1);
|
||||
+ if (ptr == expected)
|
||||
+ FAIL ("hole in libc.so memory image after %lu bytes",
|
||||
+ (unsigned long int) (addr - l->l_map_start));
|
||||
+ xmunmap (ptr, 1);
|
||||
+ addr += pagesize;
|
||||
+ }
|
||||
+
|
||||
+ xdlclose (l);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/elf/tst-link-map-contiguous-main.c b/elf/tst-link-map-contiguous-main.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..2d1a054f0fbb0855
|
||||
--- /dev/null
|
||||
+++ b/elf/tst-link-map-contiguous-main.c
|
||||
@@ -0,0 +1,45 @@
|
||||
+/* Check that the entire main program image is readable if contiguous.
|
||||
+ Copyright (C) 2025 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <link.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xdlfcn.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ struct link_map *l = xdlopen ("", RTLD_NOW);
|
||||
+ if (!l->l_contiguous)
|
||||
+ FAIL_UNSUPPORTED ("main link map is not contiguous");
|
||||
+
|
||||
+ /* This check only works if the kernel loaded the main program. The
|
||||
+ dynamic loader replaces gaps with PROT_NONE mappings, resulting
|
||||
+ in faults. */
|
||||
+ volatile long int *p = (volatile long int *) l->l_map_start;
|
||||
+ volatile long int *end = (volatile long int *) l->l_map_end;
|
||||
+ while (p < end)
|
||||
+ {
|
||||
+ *p;
|
||||
+ ++p;
|
||||
+ }
|
||||
+
|
||||
+ xdlclose (l);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#include <support/test-driver.c>
|
||||
64
glibc-RHEL-110535-1.patch
Normal file
64
glibc-RHEL-110535-1.patch
Normal file
@ -0,0 +1,64 @@
|
||||
commit 62ff85fd09ff648183af4265f07dace2879e6d42
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Jul 28 12:18:22 2025 -0700
|
||||
|
||||
x86-64: Add GLIBC_ABI_GNU2_TLS version [BZ #33129]
|
||||
|
||||
Programs and shared libraries compiled with -mtls-dialect=gnu2 may fail
|
||||
silently at run-time against glibc without the GNU2 TLS run-time fix
|
||||
for:
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=31372
|
||||
|
||||
Add GLIBC_ABI_GNU2_TLS version to indicate that glibc has the working
|
||||
GNU2 TLS run-time. Linker can add the GLIBC_ABI_GNU2_TLS version to
|
||||
binaries which depend on the working GNU2 TLS run-time:
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=33130
|
||||
|
||||
so that such programs and shared libraries will fail to load and run at
|
||||
run-time against libc.so without the GLIBC_ABI_GNU2_TLS version, instead
|
||||
of fail silently at random.
|
||||
|
||||
This fixes BZ #33129.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
(cherry picked from commit 9df8fa397d515dc86ff5565f6c45625e672d539e)
|
||||
|
||||
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
|
||||
index 08ec882159990e97..af978601657c2129 100644
|
||||
--- a/sysdeps/x86_64/Makefile
|
||||
+++ b/sysdeps/x86_64/Makefile
|
||||
@@ -209,6 +209,15 @@ LDFLAGS-tst-plt-rewrite2 = -Wl,-z,now
|
||||
LDFLAGS-tst-plt-rewritemod2.so = -Wl,-z,now,-z,undefs
|
||||
tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
|
||||
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
|
||||
+
|
||||
+tests-special += $(objpfx)check-gnu2-tls.out
|
||||
+
|
||||
+$(objpfx)check-gnu2-tls.out: $(common-objpfx)libc.so
|
||||
+ LC_ALL=C $(READELF) -V -W $< \
|
||||
+ | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
|
||||
+ | grep GLIBC_ABI_GNU2_TLS > $@; \
|
||||
+ $(evaluate-test)
|
||||
+generated += check-gnu2-tls.out
|
||||
endif
|
||||
|
||||
test-internal-extras += tst-gnu2-tls2mod1
|
||||
diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions
|
||||
index e94758b23643a905..a63c11bcb25adf48 100644
|
||||
--- a/sysdeps/x86_64/Versions
|
||||
+++ b/sysdeps/x86_64/Versions
|
||||
@@ -5,6 +5,11 @@ libc {
|
||||
GLIBC_2.13 {
|
||||
__fentry__;
|
||||
}
|
||||
+ GLIBC_ABI_GNU2_TLS {
|
||||
+ # This symbol is used only for empty version map and will be removed
|
||||
+ # by scripts/versions.awk.
|
||||
+ __placeholder_only_for_empty_version_map;
|
||||
+ }
|
||||
}
|
||||
libm {
|
||||
GLIBC_2.1 {
|
||||
95
glibc-RHEL-110535-2.patch
Normal file
95
glibc-RHEL-110535-2.patch
Normal file
@ -0,0 +1,95 @@
|
||||
commit 5541edb1bd57414556c8dfe08493ae4b8694e4b4
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Aug 18 09:06:48 2025 -0700
|
||||
|
||||
i386: Also add GLIBC_ABI_GNU2_TLS version [BZ #33129]
|
||||
|
||||
Since the GNU2 TLS run-time bug:
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=31372
|
||||
|
||||
affects both i386 and x86-64, also add GLIBC_ABI_GNU2_TLS version to i386
|
||||
to indicate the working GNU2 TLS run-time. For x86-64, the additional
|
||||
GNU2 TLS run-time bug fix is needed for
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=31501
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
(cherry picked from commit bd4628f3f18ac312408782eea450429c6f044860)
|
||||
|
||||
|
||||
Conflicts:
|
||||
sysdeps/x86/Makefile
|
||||
(adjust for context differences)
|
||||
|
||||
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
|
||||
index 01b0192ddf5e23ca..73bfaaf393775dda 100644
|
||||
--- a/sysdeps/x86/Makefile
|
||||
+++ b/sysdeps/x86/Makefile
|
||||
@@ -113,6 +113,15 @@ $(objpfx)tst-gnu2-tls2-x86-noxsavexsavec.out: \
|
||||
$(objpfx)tst-gnu2-tls2mod0.so \
|
||||
$(objpfx)tst-gnu2-tls2mod1.so \
|
||||
$(objpfx)tst-gnu2-tls2mod2.so
|
||||
+
|
||||
+tests-special += $(objpfx)check-gnu2-tls.out
|
||||
+
|
||||
+$(objpfx)check-gnu2-tls.out: $(common-objpfx)libc.so
|
||||
+ LC_ALL=C $(READELF) -V -W $< \
|
||||
+ | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
|
||||
+ | grep GLIBC_ABI_GNU2_TLS > $@; \
|
||||
+ $(evaluate-test)
|
||||
+generated += check-gnu2-tls.out
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),math)
|
||||
diff --git a/sysdeps/x86/Versions b/sysdeps/x86/Versions
|
||||
index 33dbd67b64c3ab5e..06f414bc148340bd 100644
|
||||
--- a/sysdeps/x86/Versions
|
||||
+++ b/sysdeps/x86/Versions
|
||||
@@ -8,4 +8,9 @@ libc {
|
||||
GLIBC_2.33 {
|
||||
__x86_get_cpuid_feature_leaf;
|
||||
}
|
||||
+ GLIBC_ABI_GNU2_TLS {
|
||||
+ # This symbol is used only for empty version map and will be removed
|
||||
+ # by scripts/versions.awk.
|
||||
+ __placeholder_only_for_empty_version_map;
|
||||
+ }
|
||||
}
|
||||
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
|
||||
index 579bb33ada0e5f16..06d8c27473c22a0e 100644
|
||||
--- a/sysdeps/x86_64/Makefile
|
||||
+++ b/sysdeps/x86_64/Makefile
|
||||
@@ -218,15 +218,6 @@ $(objpfx)check-dt-x86-64-plt.out: $(common-objpfx)libc.so
|
||||
| grep GLIBC_ABI_DT_X86_64_PLT > $@; \
|
||||
$(evaluate-test)
|
||||
generated += check-dt-x86-64-plt.out
|
||||
-
|
||||
-tests-special += $(objpfx)check-gnu2-tls.out
|
||||
-
|
||||
-$(objpfx)check-gnu2-tls.out: $(common-objpfx)libc.so
|
||||
- LC_ALL=C $(READELF) -V -W $< \
|
||||
- | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
|
||||
- | grep GLIBC_ABI_GNU2_TLS > $@; \
|
||||
- $(evaluate-test)
|
||||
-generated += check-gnu2-tls.out
|
||||
endif
|
||||
|
||||
test-internal-extras += tst-gnu2-tls2mod1
|
||||
diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions
|
||||
index 0a759029e5a00cf1..6a989ad3b373cdf6 100644
|
||||
--- a/sysdeps/x86_64/Versions
|
||||
+++ b/sysdeps/x86_64/Versions
|
||||
@@ -5,11 +5,6 @@ libc {
|
||||
GLIBC_2.13 {
|
||||
__fentry__;
|
||||
}
|
||||
- GLIBC_ABI_GNU2_TLS {
|
||||
- # This symbol is used only for empty version map and will be removed
|
||||
- # by scripts/versions.awk.
|
||||
- __placeholder_only_for_empty_version_map;
|
||||
- }
|
||||
GLIBC_ABI_DT_X86_64_PLT {
|
||||
# This symbol is used only for empty version map and will be removed
|
||||
# by scripts/versions.awk.
|
||||
60
glibc-RHEL-110535-3.patch
Normal file
60
glibc-RHEL-110535-3.patch
Normal file
@ -0,0 +1,60 @@
|
||||
commit 83340b35ccb24dcda8b709c4683ab9eade454bd7
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Jul 28 12:16:11 2025 -0700
|
||||
|
||||
i386: Add GLIBC_ABI_GNU_TLS version [BZ #33221]
|
||||
|
||||
On i386, programs and shared libraries with __thread usage may fail
|
||||
silently at run-time against glibc without the TLS run-time fix for:
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=32996
|
||||
|
||||
Add GLIBC_ABI_GNU_TLS version to indicate that glibc has the working
|
||||
GNU TLS run-time. Linker can add the GLIBC_ABI_GNU_TLS version to
|
||||
binaries which depend on the working TLS run-time so that such programs
|
||||
and shared libraries will fail to load and run at run-time against
|
||||
libc.so without the GLIBC_ABI_GNU_TLS version, instead of fail silently
|
||||
at random.
|
||||
|
||||
This fixes BZ #33221.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
(cherry picked from commit ed1b7a5a489ab555a27fad9c101ebe2e1c1ba881)
|
||||
|
||||
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
|
||||
index a2e8c0b12822be0b..7d799454e0b4e990 100644
|
||||
--- a/sysdeps/i386/Makefile
|
||||
+++ b/sysdeps/i386/Makefile
|
||||
@@ -58,6 +58,15 @@ $(objpfx)tst-ld-sse-use.out: ../sysdeps/i386/tst-ld-sse-use.sh $(objpfx)ld.so
|
||||
@echo "Checking ld.so for SSE register use. This will take a few seconds..."
|
||||
$(BASH) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \
|
||||
$(evaluate-test)
|
||||
+
|
||||
+tests-special += $(objpfx)check-gnu-tls.out
|
||||
+
|
||||
+$(objpfx)check-gnu-tls.out: $(common-objpfx)libc.so
|
||||
+ LC_ALL=C $(READELF) -V -W $< \
|
||||
+ | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
|
||||
+ | grep GLIBC_ABI_GNU_TLS > $@; \
|
||||
+ $(evaluate-test)
|
||||
+generated += check-gnu-tls.out
|
||||
else
|
||||
CFLAGS-.os += $(if $(filter rtld-%.os,$(@F)), $(rtld-CFLAGS))
|
||||
endif
|
||||
diff --git a/sysdeps/i386/Versions b/sysdeps/i386/Versions
|
||||
index 36e23b466a622f43..9c84c8ef049eb18d 100644
|
||||
--- a/sysdeps/i386/Versions
|
||||
+++ b/sysdeps/i386/Versions
|
||||
@@ -28,6 +28,11 @@ libc {
|
||||
GLIBC_2.13 {
|
||||
__fentry__;
|
||||
}
|
||||
+ GLIBC_ABI_GNU_TLS {
|
||||
+ # This symbol is used only for empty version map and will be removed
|
||||
+ # by scripts/versions.awk.
|
||||
+ __placeholder_only_for_empty_version_map;
|
||||
+ }
|
||||
}
|
||||
libm {
|
||||
GLIBC_2.1 {
|
||||
76
glibc-RHEL-110949-1.patch
Normal file
76
glibc-RHEL-110949-1.patch
Normal file
@ -0,0 +1,76 @@
|
||||
commit 269e89bd8d25a0659c6c963a509e152faefd6ba2
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu Aug 14 07:03:20 2025 -0700
|
||||
|
||||
x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]
|
||||
|
||||
When the linker -z mark-plt option is used to add DT_X86_64_PLT,
|
||||
DT_X86_64_PLTSZ and DT_X86_64_PLTENT, the r_addend field of the
|
||||
R_X86_64_JUMP_SLOT relocation stores the offset of the indirect
|
||||
branch instruction. However, glibc versions without the commit:
|
||||
|
||||
commit f8587a61892cbafd98ce599131bf4f103466f084
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Fri May 20 19:21:48 2022 -0700
|
||||
|
||||
x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT
|
||||
|
||||
According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
|
||||
and R_X86_64_JUMP_SLOT. Since linkers always set their r_addends to 0, we
|
||||
can ignore their r_addends.
|
||||
|
||||
Reviewed-by: Fangrui Song <maskray@google.com>
|
||||
|
||||
won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
|
||||
Such programs and shared libraries will fail at run-time randomly.
|
||||
|
||||
Add GLIBC_ABI_DT_X86_64_PLT version to indicate that glibc is compatible
|
||||
with DT_X86_64_PLT.
|
||||
|
||||
The linker can add the glibc GLIBC_ABI_DT_X86_64_PLT version dependency
|
||||
whenever -z mark-plt is passed to the linker. The resulting programs and
|
||||
shared libraries will fail to load at run-time against libc.so without the
|
||||
GLIBC_ABI_DT_X86_64_PLT version, instead of fail randomly.
|
||||
|
||||
This fixes BZ #33212.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
(cherry picked from commit 399384e0c8193e31aea014220ccfa24300ae5938)
|
||||
|
||||
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
|
||||
index af978601657c2129..579bb33ada0e5f16 100644
|
||||
--- a/sysdeps/x86_64/Makefile
|
||||
+++ b/sysdeps/x86_64/Makefile
|
||||
@@ -210,6 +210,15 @@ LDFLAGS-tst-plt-rewritemod2.so = -Wl,-z,now,-z,undefs
|
||||
tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
|
||||
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
|
||||
|
||||
+tests-special += $(objpfx)check-dt-x86-64-plt.out
|
||||
+
|
||||
+$(objpfx)check-dt-x86-64-plt.out: $(common-objpfx)libc.so
|
||||
+ LC_ALL=C $(READELF) -V -W $< \
|
||||
+ | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
|
||||
+ | grep GLIBC_ABI_DT_X86_64_PLT > $@; \
|
||||
+ $(evaluate-test)
|
||||
+generated += check-dt-x86-64-plt.out
|
||||
+
|
||||
tests-special += $(objpfx)check-gnu2-tls.out
|
||||
|
||||
$(objpfx)check-gnu2-tls.out: $(common-objpfx)libc.so
|
||||
diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions
|
||||
index a63c11bcb25adf48..0a759029e5a00cf1 100644
|
||||
--- a/sysdeps/x86_64/Versions
|
||||
+++ b/sysdeps/x86_64/Versions
|
||||
@@ -10,6 +10,11 @@ libc {
|
||||
# by scripts/versions.awk.
|
||||
__placeholder_only_for_empty_version_map;
|
||||
}
|
||||
+ GLIBC_ABI_DT_X86_64_PLT {
|
||||
+ # This symbol is used only for empty version map and will be removed
|
||||
+ # by scripts/versions.awk.
|
||||
+ __placeholder_only_for_empty_version_map;
|
||||
+ }
|
||||
}
|
||||
libm {
|
||||
GLIBC_2.1 {
|
||||
39
glibc-RHEL-110949-2.patch
Normal file
39
glibc-RHEL-110949-2.patch
Normal file
@ -0,0 +1,39 @@
|
||||
commit a0dc87da2a689f3570a11a80ca8876bfb7ddcca6
|
||||
Author: Arjun Shankar <arjun@redhat.com>
|
||||
Date: Thu Sep 4 20:30:41 2025 +0200
|
||||
|
||||
x86_64: Unconditionally run test elf/check-dt-x86-64-plt
|
||||
|
||||
The intention of GLIBC_ABI_DT_X86_64_PLT is simply to mark the existence
|
||||
of the fix in f8587a61892cbafd98ce599131bf4f103466f084
|
||||
("x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT").
|
||||
|
||||
Testing for GLIBC_ABI_DT_X86_64_PLT does not depend on the linker
|
||||
supporting -z mark-plt. Therefore remove this dependency on linker
|
||||
support and test unconditionally.
|
||||
|
||||
Fixes commit 399384e0c8193e31aea014220ccfa24300ae5938
|
||||
("x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]")
|
||||
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
|
||||
index 06d8c27473c22a0e..cd243adb49ca4e1e 100644
|
||||
--- a/sysdeps/x86_64/Makefile
|
||||
+++ b/sysdeps/x86_64/Makefile
|
||||
@@ -209,6 +209,7 @@ LDFLAGS-tst-plt-rewrite2 = -Wl,-z,now
|
||||
LDFLAGS-tst-plt-rewritemod2.so = -Wl,-z,now,-z,undefs
|
||||
tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
|
||||
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
|
||||
+endif
|
||||
|
||||
tests-special += $(objpfx)check-dt-x86-64-plt.out
|
||||
|
||||
@@ -218,7 +219,6 @@ $(objpfx)check-dt-x86-64-plt.out: $(common-objpfx)libc.so
|
||||
| grep GLIBC_ABI_DT_X86_64_PLT > $@; \
|
||||
$(evaluate-test)
|
||||
generated += check-dt-x86-64-plt.out
|
||||
-endif
|
||||
|
||||
test-internal-extras += tst-gnu2-tls2mod1
|
||||
|
||||
45
glibc-RHEL-114263.patch
Normal file
45
glibc-RHEL-114263.patch
Normal file
@ -0,0 +1,45 @@
|
||||
commit 0fceed254559836b57ee05188deac649bc505d05
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Sep 12 21:33:34 2025 +0200
|
||||
|
||||
nss: Group merge does not react to ERANGE during merge (bug 33361)
|
||||
|
||||
The break statement in CHECK_MERGE is expected to exit the surrounding
|
||||
while loop, not the do-while loop with in the macro. Remove the
|
||||
do-while loop from the macro. It is not needed to turn the macro
|
||||
expansion into a single statement due to the way CHECK_MERGE is used
|
||||
(and the statement expression would cover this anyway).
|
||||
|
||||
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
|
||||
|
||||
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
|
||||
index fe7d5b7d0eddfb05..3a15b1a4ae151fcc 100644
|
||||
--- a/nss/getXXbyYY_r.c
|
||||
+++ b/nss/getXXbyYY_r.c
|
||||
@@ -157,19 +157,15 @@ __merge_einval (LOOKUP_TYPE *a,
|
||||
|
||||
#define CHECK_MERGE(err, status) \
|
||||
({ \
|
||||
- do \
|
||||
+ if (err) \
|
||||
{ \
|
||||
- if (err) \
|
||||
- { \
|
||||
- __set_errno (err); \
|
||||
- if (err == ERANGE) \
|
||||
- status = NSS_STATUS_TRYAGAIN; \
|
||||
- else \
|
||||
- status = NSS_STATUS_UNAVAIL; \
|
||||
- break; \
|
||||
- } \
|
||||
+ __set_errno (err); \
|
||||
+ if (err == ERANGE) \
|
||||
+ status = NSS_STATUS_TRYAGAIN; \
|
||||
+ else \
|
||||
+ status = NSS_STATUS_UNAVAIL; \
|
||||
+ break; \
|
||||
} \
|
||||
- while (0); \
|
||||
})
|
||||
|
||||
/* Type of the lookup function we need here. */
|
||||
36
glibc.spec
36
glibc.spec
@ -138,15 +138,7 @@ end}
|
||||
Summary: The GNU libc libraries
|
||||
Name: glibc
|
||||
Version: %{glibcversion}
|
||||
|
||||
# We'll use baserelease here for two reasons:
|
||||
# - It is known to rpmdev-bumpspec, so it will be properly handled for mass-
|
||||
# rebuilds
|
||||
# - It allows using the Release number without the %%dist tag in the dependency
|
||||
# generator to make the generated requires interchangeable between Rawhide
|
||||
# and ELN (.elnYY < .fcXX).
|
||||
%global baserelease 46
|
||||
Release: %{baserelease}%{?dist}
|
||||
Release: 46%{?dist}.4
|
||||
|
||||
# Licenses:
|
||||
#
|
||||
@ -580,6 +572,16 @@ Patch262: glibc-RHEL-104151.patch
|
||||
Patch263: glibc-RHEL-95246-1.patch
|
||||
Patch264: glibc-RHEL-95246-2.patch
|
||||
Patch265: glibc-RHEL-105324.patch
|
||||
Patch266: glibc-RHEL-104853-1.patch
|
||||
Patch267: glibc-RHEL-104853-2.patch
|
||||
Patch268: glibc-RHEL-104853-3.patch
|
||||
Patch269: glibc-RHEL-104853-4.patch
|
||||
Patch270: glibc-RHEL-110535-1.patch
|
||||
Patch271: glibc-RHEL-110949-1.patch
|
||||
Patch272: glibc-RHEL-110535-2.patch
|
||||
Patch273: glibc-RHEL-110535-3.patch
|
||||
Patch274: glibc-RHEL-110949-2.patch
|
||||
Patch275: glibc-RHEL-114263.patch
|
||||
|
||||
##############################################################################
|
||||
# Continued list of core "glibc" package information:
|
||||
@ -597,6 +599,9 @@ Provides: rtld(GNU_HASH)
|
||||
|
||||
# We need libgcc for cancellation support in POSIX threads.
|
||||
Requires: libgcc%{_isa}
|
||||
# Encourage the package manager to break the libgcc/glibc dependency
|
||||
# cycle by installing libgcc first. (This is the historic installation order.)
|
||||
Requires(pre): libgcc%{_isa}
|
||||
|
||||
Requires: glibc-common = %{version}-%{release}
|
||||
|
||||
@ -2577,6 +2582,19 @@ update_gconv_modules_cache ()
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Sep 22 2025 Arjun Shankar <arjun@redhat.com> - 2.39-46.4
|
||||
- nss: Fix incorrect/empty results when merging groups (RHEL-114263)
|
||||
|
||||
* Fri Sep 05 2025 Arjun Shankar <arjun@redhat.com> - 2.39-46.3
|
||||
- x86-64: Provide GLIBC_ABI_GNU2_TLS symbol version (RHEL-110535)
|
||||
- x86-64: Provide GLIBC_ABI_DT_X86_64_PLT symbol version (RHEL-110949)
|
||||
|
||||
* Wed Sep 03 2025 Arjun Shankar <arjun@redhat.com> - 2.39-46.2
|
||||
- Handle load segment gaps in _dl_find_object (RHEL-104853)
|
||||
|
||||
* Mon Aug 25 2025 Patsy Griffin <patsy@redhat.com> - 2.39-46.1
|
||||
- Use Requires(pre): libgcc%%{_isa} to break libgcc cycle (RHEL-110560)
|
||||
|
||||
* Thu Jul 24 2025 Florian Weimer <fweimer@redhat.com> - 2.39-46
|
||||
- CVE-2025-8058: Double free in regcomp (RHEL-105324)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user