power: Add the AT_RANDOM aux vector to the initial stack.
This is blindly used by at least modern glibc-s Change-Id: I8ee7872c8072ee8aa1b3718e988679968ac172d0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26829 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -131,6 +131,8 @@ PowerProcess::argsInit(int intSize, int pageSize)
|
||||
auxv.emplace_back(M5_AT_EGID, egid());
|
||||
//Whether to enable "secure mode" in the executable
|
||||
auxv.emplace_back(M5_AT_SECURE, 0);
|
||||
//The address of 16 "random" bytes
|
||||
auxv.emplace_back(M5_AT_RANDOM, 0);
|
||||
//The filename of the program
|
||||
auxv.emplace_back(M5_AT_EXECFN, 0);
|
||||
//The string "v51" with unknown meaning
|
||||
@@ -151,6 +153,9 @@ PowerProcess::argsInit(int intSize, int pageSize)
|
||||
// string.
|
||||
int aux_data_size = filename.size() + 1;
|
||||
|
||||
const int numRandomBytes = 16;
|
||||
aux_data_size += numRandomBytes;
|
||||
|
||||
int env_data_size = 0;
|
||||
for (int i = 0; i < envp.size(); ++i) {
|
||||
env_data_size += envp[i].size() + 1;
|
||||
@@ -235,8 +240,10 @@ PowerProcess::argsInit(int intSize, int pageSize)
|
||||
auxv[i].val = platform_base;
|
||||
initVirtMem->writeString(platform_base, platform.c_str());
|
||||
} else if (auxv[i].type == M5_AT_EXECFN) {
|
||||
auxv[i].val = aux_data_base;
|
||||
auxv[i].val = aux_data_base + numRandomBytes;
|
||||
initVirtMem->writeString(aux_data_base, filename.c_str());
|
||||
} else if (auxv[i].type == M5_AT_RANDOM) {
|
||||
auxv[i].val = aux_data_base;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user