!304 ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]

Merge pull request !304 from liusirui/master
This commit is contained in:
openeuler-ci-bot 2021-12-27 00:42:05 +00:00 committed by Gitee
commit 481c991301
2 changed files with 42 additions and 1 deletions

View File

@ -65,7 +65,7 @@
##############################################################################
Name: glibc
Version: 2.34
Release: 36
Release: 37
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -144,6 +144,7 @@ Patch57: Fix-failing-nss-tst-nss-files-hosts-long-with-local-.patch
Patch58: nptl-Add-one-more-barrier-to-nptl-tst-create1.patch
Patch59: io-Fix-ftw-internal-realloc-buffer-BZ-28126.patch
Patch60: Do-not-define-tgmath.h-fmaxmag-fminmag-macros-for-C2.patch
Patch61: ld.so-Don-t-fill-the-DT_DEBUG-entry-in-ld.so-BZ-2812.patch
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
@ -1340,6 +1341,9 @@ fi
%endif
%changelog
* Sat Dec 25 2021 liusirui <liusirui@huawei.com> - 2.34-37
- ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]
* Fri Dec 24 2021 Qingqing Li <liqingqing3@huawei.com> - 2.34-36
- do not define tgmath.h fmaxmag, fminmag macros for C2X (BZ #28397)

View File

@ -0,0 +1,37 @@
From 3234a31b489707f19ec6d4c9909af06f20ddb901 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 2 Aug 2021 13:52:36 -0700
Subject: [PATCH] ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]
Linker creates the DT_DEBUG entry only in executables. Don't fill the
non-existent DT_DEBUG entry in ld.so with the run-time address of the
r_debug structure. This fixes BZ #28129.
---
elf/rtld.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/elf/rtld.c b/elf/rtld.c
index 9642eb9c92..628245d8cd 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1761,17 +1761,11 @@ dl_main (const ElfW(Phdr) *phdr,
#ifdef ELF_MACHINE_DEBUG_SETUP
/* Some machines (e.g. MIPS) don't use DT_DEBUG in this way. */
ELF_MACHINE_DEBUG_SETUP (main_map, r);
- ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
#else
if (main_map->l_info[DT_DEBUG] != NULL)
/* There is a DT_DEBUG entry in the dynamic section. Fill it in
with the run-time address of the r_debug structure */
main_map->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
-
- /* Fill in the pointer in the dynamic linker's own dynamic section, in
- case you run gdb on the dynamic linker directly. */
- if (GL(dl_rtld_map).l_info[DT_DEBUG] != NULL)
- GL(dl_rtld_map).l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
#endif
/* We start adding objects. */
--
2.25.1