!932 sync some patches

From: @tong_1001 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2024-11-29 06:13:03 +00:00 committed by Gitee
commit fa6d1b002f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 2abfa1907218c5ec9d52bb81bee3f1af652f67c7 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 24 Sep 2024 13:23:10 +0200
Subject: [PATCH] elf: Move __rtld_malloc_init_stubs call into _dl_start_final
Calling an extern function in a different translation unit before
self-relocation is brittle. The compiler may load the address
at an earlier point in _dl_start, before self-relocation. In
_dl_start_final, the call is behind a compiler barrier, so this
cannot happen.
---
elf/rtld.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/elf/rtld.c b/elf/rtld.c
index 9355b30214..cb6b61d570 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -452,6 +452,8 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
{
ElfW(Addr) start_addr;
+ __rtld_malloc_init_stubs ();
+
/* Do not use an initializer for these members because it would
interfere with __rtld_static_init. */
GLRO (dl_find_object) = &_dl_find_object;
@@ -574,8 +576,6 @@ _dl_start (void *arg)
function, that way the compiler cannot put accesses to the GOT
before ELF_DYNAMIC_RELOCATE. */
- __rtld_malloc_init_stubs ();
-
#ifdef DONT_USE_BOOTSTRAP_MAP
return _dl_start_final (arg);
#else
--
2.27.0

View File

@ -0,0 +1,40 @@
From 8e572067976ea700e5ef750458c42c47328fe459 Mon Sep 17 00:00:00 2001
From: DJ Delorie <dj@redhat.com>
Date: Wed, 6 Nov 2024 21:40:35 -0500
Subject: [PATCH] elf: avoid jumping over a needed declaration
The declaration of found_other_class could be jumped
over via the goto just above it, but the code jumped
to uses found_other_class. Move the declaration
up a bit to ensure it's properly declared and initialized.
---
elf/dl-load.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index ac8e217a7f..335b34c56d 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1931,6 +1931,9 @@ _dl_map_object (struct link_map *loader, const char *name,
: "\nfile=%s [%lu]; dynamically loaded by %s [%lu]\n",
name, nsid, DSO_FILENAME (loader->l_name), loader->l_ns);
+ /* Will be true if we found a DSO which is of the other ELF class. */
+ bool found_other_class = false;
+
#ifdef SHARED
/* Give the auditing libraries a chance to change the name before we
try anything. */
@@ -1948,9 +1951,6 @@ _dl_map_object (struct link_map *loader, const char *name,
}
#endif
- /* Will be true if we found a DSO which is of the other ELF class. */
- bool found_other_class = false;
-
if (strchr (name, '/') == NULL)
{
/* Search for NAME in several places. */
--
2.27.0

View File

@ -67,7 +67,7 @@
##############################################################################
Name: glibc
Version: 2.38
Release: 42
Release: 43
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -243,6 +243,8 @@ Patch153: 0015-LoongArch-Change-tunable-for-2.38.patch
Patch154: 0001-LoongArch-Simplify-the-autoconf-check-for-static-PIE.patch
Patch155: 0002-nptl-Add-thread_pointer.h-for-LoongArch.patch
Patch156: 0003-nptl-fix-__builtin_thread_pointer-detection-on-Loong.patch
Patch157: backport-elf-avoid-jumping-over-a-needed-declaration.patch
Patch158: backport-elf-Move-__rtld_malloc_init_stubs-call-into-_dl_star.patch
#openEuler patch list
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
@ -1464,6 +1466,10 @@ fi
%endif
%changelog
* Fri Nov 29 2024 shixuantong <shixuantong@huawei.com> - 2.38-43
- elf: avoid jumping over a needed declaration
- elf: Move __rtld_malloc_init_stubs call into _dl_start_final
* Wed Nov 27 2024 lixing <lixing@loongson.cn> - 2.38-42
- LoongArch: Simplify static-pie support and change nptl support