|
|
Message-Id: <1568091399-23967-1-git-send-email-rodger.combs@gmail.com>
Date: Mon, 9 Sep 2019 23:56:37 -0500
From: Rodger Combs <rodger.combs@...il.com>
To: musl@...ts.openwall.com
Subject: [PATCH 1/3] ldso: when run via CLI, set auxv as if the app was loaded by the kernel
---
ldso/dynlink.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 5ef2111..22181e3 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1805,6 +1805,22 @@ void __dls3(size_t *sp)
}
dprintf(1, "\t%s (%p)\n", ldso.name, ldso.base);
}
+
+ // Make it look to the app as if it was loaded by the kernel
+ for (i=0; auxv[i]; i+=2) {
+ if (auxv[i] == AT_BASE)
+ auxv[i + 1] = (size_t)ldso.base;
+ if (auxv[i] == AT_PHDR)
+ auxv[i + 1] = (size_t)app.phdr;
+ if (auxv[i] == AT_ENTRY)
+ auxv[i + 1] = aux[AT_ENTRY];
+ if (auxv[i] == AT_PHNUM)
+ auxv[i + 1] = app.phnum;
+ if (auxv[i] == AT_PHENT)
+ auxv[i + 1] = app.phentsize;
+ if (auxv[i] == AT_EXECFN)
+ auxv[i + 1] = (size_t)app.name;
+ }
}
if (app.tls.size) {
libc.tls_head = tls_tail = &app.tls;
--
2.7.4
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.