From 7298ebd49b4eef335ec5b78709e74aad8931e261 Mon Sep 17 00:00:00 2001 From: Nicholas Mosier Date: Thu, 21 Sep 2023 05:16:17 +0000 Subject: [PATCH] arch-x86: properly initialize the auxv platform string The auxv platform string was not copied to the same location that was pointed to by the value of AT_PLATFORM; instead, it was copied over the auxv random buffer. This patch fixes this by copying the auxv platform string to the right offset in the initial program stack. GitHub issue: https://github.com/gem5/gem5/issues/346 Change-Id: Ied4b660d5fc444a94acb97b799be0a3722438b5e --- src/arch/x86/process.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index 6589ee821d..17cc7ba801 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -997,7 +997,8 @@ X86Process::argsInit(int pageSize, initVirtMem->write(auxv_array_end, zero); auxv_array_end += sizeof(zero); - initVirtMem->writeString(aux_data_base, platform.c_str()); + initVirtMem->writeString(aux_data_base + numRandomBytes, + platform.c_str()); copyStringArray(envp, envp_array_base, env_data_base, ByteOrder::little, *initVirtMem);