summaryrefslogtreecommitdiff
path: root/ldso/ldso/ldso.c
diff options
context:
space:
mode:
authorCédric VINCENT <cedric.vincent@st.com>2014-04-07 10:04:40 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2014-04-08 15:19:48 +0200
commit278a06d7abcc8774ba9bb9c15779749c7e2d68cd (patch)
tree1cb6c4676ba1da2d6c42f4bad72091807c632c8b /ldso/ldso/ldso.c
parent9902a14bea380686320279c22bb01c53f81f4266 (diff)
ldso: fix standalone execution on x86_64 architecture
If the dynamic linker is built with LDSO_STANDALONE_SUPPORT=y, it can load then run a dynamically linked program when explicitly invoked from the command line. This is used for test and prelink purposes, and also by other tools like PRoot to force the kernel to load the right ELF interpreter. This feature is currently broken on x86_64 since the number of command line arguments (ie. argc) passed from the kernel is an "elf_addr_t" (64 bit on x86_64), whereas it is read as an "unsigned int" (32 bit on x86_64). Ref: https://github.com/cedric-vincent/PRoot/issues/45 Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'ldso/ldso/ldso.c')
-rw-r--r--ldso/ldso/ldso.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 0c2ed07bf..3b00e053d 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -526,8 +526,8 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
#ifdef __LDSO_STANDALONE_SUPPORT__
if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
- unsigned int *aux_dat = (unsigned int *) argv;
- int argc = aux_dat[-1];
+ int argc = (int) aux_dat[-1];
+ ElfW(Addr) *aux_dat = (ElfW(Addr) *) argv;
tpnt->libname = argv[0];
while (argc > 1)