1 Star 0 Fork 152

yangzhenyu/glibc

forked from src-openEuler/glibc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-elf-Move-__rtld_malloc_init_stubs-call-into-_dl_star.patch 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
桐小哥 提交于 2024-11-29 11:17 . sync some patches
From 2abfa1907218c5ec9d52bb81bee3f1af652f67c7 Mon Sep 17 00:00:00 2001
From: Florian Weimer <[email protected]>
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dev11101/glibc.git
[email protected]:dev11101/glibc.git
dev11101
glibc
glibc
master

搜索帮助