Improve personality initialization

1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
   personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
This commit is contained in:
Dmitriy Ivanov
2015-06-30 15:10:51 -07:00
parent 754f669076
commit f643eb38c3
4 changed files with 19 additions and 9 deletions

View File

@@ -37,7 +37,6 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/personality.h>
#include <unistd.h>
#include <new>
@@ -3111,12 +3110,6 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
ldpreload_env = getenv("LD_PRELOAD");
}
#if !defined(__LP64__)
if (personality(PER_LINUX32) == -1) {
__libc_fatal("error setting PER_LINUX32 personality: %s", strerror(errno));
}
#endif
INFO("[ android linker & debugger ]");
soinfo* si = soinfo_alloc(args.argv[0], nullptr, 0, RTLD_GLOBAL);