From: Nick Kralevich Date: Sat, 12 Jan 2013 02:38:26 +0000 (-0800) Subject: libc_init_static: apply relro earlier. X-Git-Tag: android-x86-4.4-r1~313^2~25^2~64^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9fb48ac257d9a01ba99c6c9ced497b24512a86b7;p=android-x86%2Fbionic.git libc_init_static: apply relro earlier. The dynamic linker applies relro before the preinit and init arrays are executed, so we should be consistent for statically linked executables. Change-Id: Ia0a49d0e981a6e8791f74eed00280edf576ba139 --- diff --git a/libc/bionic/libc_init_static.c b/libc/bionic/libc_init_static.c index bb3a41021..24a4397a8 100644 --- a/libc/bionic/libc_init_static.c +++ b/libc/bionic/libc_init_static.c @@ -101,6 +101,8 @@ __noreturn void __libc_init(uintptr_t *elfdata, /* Initialize the C runtime environment */ __libc_init_common(elfdata); + apply_gnu_relro(); + /* Several Linux ABIs don't pass the onexit pointer, and the ones that * do never use it. Therefore, we ignore it. */ @@ -122,6 +124,5 @@ __noreturn void __libc_init(uintptr_t *elfdata, if (structors->fini_array) __cxa_atexit(__libc_fini,structors->fini_array,NULL); - apply_gnu_relro(); exit(slingshot(argc, argv, envp)); }