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
// 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;
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;
}
}