From 101c85967662bcd41d87e3394ca1517a9db1c1d4 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 17 Mar 2020 23:57:18 -0700 Subject: [PATCH] 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 Maintainer: Gabe Black Tested-by: kokoro --- src/arch/power/process.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc index 6ebdd6f2f..9bb3b19a1 100644 --- a/src/arch/power/process.cc +++ b/src/arch/power/process.cc @@ -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; } } -- 2.30.2