我知道将vdso=0传递给内核可以关闭这个特性,而且glibc中的动态链接器可以自动检测和使用内核中的vdso特性。
在这里我遇到了这个问题。在我的机构中有一个RHEL5.6机器(内核2.6.18-238.el5),在那里我只有一个正常的用户访问权限,可能是RHEL bug 673616。
当我在上面编译一个linux-headers-3.9/gcc-4.7.2/glibc-2.17/binutils-2.23的工具链时,在stage2无法运行的情况下,gcc引导程序在cc1中失败
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaaaca6eb in ?? ()
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x00002aaaaaaabba0 0x00002aaaaaac3249 Yes (*) /home/benda/gnto/lib64/ld-linux-x86-64.so.2
0x00002aaaaacd29b0 0x00002aaaaace2480 Yes (*) /home/benda/gnto/usr/lib/libmpc.so.3
0x00002aaaaaef2cd0 0x00002aaaaaf36c08 Yes (*) /home/benda/gnto/usr/lib/libmpfr.so.4
0x00002aaaab14f280 0x00002aaaab19b658 Yes (*) /home/benda/gnto/usr/lib/libgmp.so.10
0x00002aaaab3b3060 0x00002aaaab3b3b50 Yes (*) /home/benda/gnto/lib/libdl.so.2
0x00002aaaab5b87b0 0x00002aaaab5c4bb0 Yes (*) /home/benda/gnto/usr/lib/libz.so.1
0x00002aaaab7d0e70 0x00002aaaab80f62c Yes (*) /home/benda/gnto/lib/libm.so.6
0x00002aaaaba70d40 0x00002aaaabb81aec Yes (*) /home/benda/gnto/lib/libc.so.6
(*): Shared library is missing debugging information.和一个简单的程序
#include <sys/time.h>
#include <stdio.h>
int main () {
struct timeval tim;
gettimeofday(&tim, NULL);
return 0;
}如果使用来自stage1的glibc-2.17和xgcc进行编译,则以相同的方式获取段错误。
cc1和测试程序都可以以普通用户的身份在运行RHEL5.5(内核2.6.18-194.26.1.el5)的另一个RHEL5.5上运行,使用的是glibc 4.7.2/glibc-2.17/binutils-2.23。
我不能简单地将机器升级到较新的RHEL版本,也不能通过sysctl或proc关闭VDSO。问题是,有没有办法编译glibc,让它无条件地关闭VDSO?
发布于 2013-07-04 01:02:32
问题可以通过simple patch或here来解决
Index: work/glibc-2.17/elf/dl-support.c
=====================================================================
--- work.orig/glibc-2.17/elf/dl-support.c
+++ work/glibc-2.17/elf/dl-support.c
@@ -212,16 +212,6 @@ _dl_aux_init (ElfW(auxv_t) *av)
case AT_HWCAP:
GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
break;
-#ifdef NEED_DL_SYSINFO
- case AT_SYSINFO:
- GL(dl_sysinfo) = av->a_un.a_val;
- break;
-#endif
-#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
- case AT_SYSINFO_EHDR:
- GL(dl_sysinfo_dso) = (void *) av->a_un.a_val;
- break;
-#endif
case AT_UID:
uid ^= av->a_un.a_val;
seen |= 1;
Index: work/glibc-2.17/elf/setup-vdso.h
=====================================================================
--- work.orig/glibc-2.17/elf/setup-vdso.h
+++ work/glibc-2.17/elf/setup-vdso.h
@@ -20,7 +20,7 @@ static inline void __attribute__ ((alway
setup_vdso (struct link_map *main_map __attribute__ ((unused)),
struct link_map ***first_preload __attribute__ ((unused)))
{
-#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
+#if 0
if (GLRO(dl_sysinfo_dso) == NULL)
return;https://stackoverflow.com/questions/17406389
复制相似问题