From 08c79a194d1a3430801c04f37d13216cc9ec1da3 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 21 May 2019 16:36:32 +0100 Subject: [PATCH] sim-se: add a release parameter to Process.py Set the default release to that single value for all ISAs. glibc has checks for the kernel version based on uname, and refuses to start any syscall emulation programs if those checks don't pass with error: FATAL: kernel too old The ideal solution to this problem is to actually implement all missing system calls for the required kernel version and bumping the release accordingly. However, it is very hard to implement all missing syscalls and verify compliance. Previously, we have simply bumped the version manually from time to time when major glibc versions started breaking. This commit alleviates the problem in two ways. Firstly, having a single kernel version for all versions means that it is easier to bump all versions at once. Secondly, it makes it is possible to set the release with a parameter, which in turn can be set from the command line with: se.py --param 'system.cpu[:].workload[:].release = "4.18.0"' Change-Id: I9e3c31073bfe68735f7b0775c8e299aa62b98222 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17849 Maintainer: Brandon Potter Reviewed-by: Jason Lowe-Power Tested-by: kokoro --- src/arch/alpha/linux/process.cc | 2 +- src/arch/arm/linux/process.cc | 4 ++-- src/arch/mips/linux/process.cc | 2 +- src/arch/power/linux/process.cc | 2 +- src/arch/riscv/linux/process.cc | 4 ++-- src/arch/sparc/linux/syscalls.cc | 2 +- src/arch/sparc/solaris/process.cc | 2 +- src/arch/x86/linux/process.cc | 2 +- src/sim/Process.py | 1 + src/sim/process.cc | 1 + src/sim/process.hh | 3 +++ 11 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index de89410ac..d342c5d2d 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -85,7 +85,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); - strcpy(name->release, "3.0.0"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "alpha"); diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 25bccb6b6..3fcb01fe7 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -113,7 +113,7 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename, "m5.eecs.umich.edu"); - strcpy(name->release, "3.7.0+"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012"); strcpy(name->machine, "armv7l"); @@ -131,7 +131,7 @@ unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename, "gem5"); - strcpy(name->release, "4.10.8+"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012"); strcpy(name->machine, "armv8l"); diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index 8a4811a04..9efaf2624 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -88,7 +88,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename,"sim.gem5.org"); - strcpy(name->release, "3.0.0"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "mips"); diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index 58e7eb507..8a5cd137c 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -88,7 +88,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); - strcpy(name->release, "3.0.0"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "power"); diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index f3f328e48..8aebd558e 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -96,7 +96,7 @@ unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename,"sim.gem5.org"); - strcpy(name->release, "3.0.0"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "riscv64"); @@ -114,7 +114,7 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename,"sim.gem5.org"); - strcpy(name->release, "3.0.0"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "riscv32"); diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index 9cf08b7b3..70d1b2af6 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -47,7 +47,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); - strcpy(name->release, "3.0.0-sparc64"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "sparc"); diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index 0b67f53d3..3a13229ed 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -80,7 +80,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "SunOS"); strcpy(name->nodename, "m5.eecs.umich.edu"); - strcpy(name->release, "5.9"); //?? do we want this or something newer? + strcpy(name->release, process->release.c_str()); strcpy(name->version, "Generic_118558-21"); strcpy(name->machine, "sun4u"); diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 98a68b409..d38b168fd 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -99,7 +99,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); - strcpy(name->release, "3.2.0"); + strcpy(name->release, process->release.c_str()); strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "x86_64"); diff --git a/src/sim/Process.py b/src/sim/Process.py index 73a0145fd..6714ee560 100644 --- a/src/sim/Process.py +++ b/src/sim/Process.py @@ -62,6 +62,7 @@ class Process(SimObject): cwd = Param.String(getcwd(), "current working directory") simpoint = Param.UInt64(0, 'simulation point at which to start simulation') drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers') + release = Param.String('5.1.0', "Linux kernel uname release") @classmethod def export_methods(cls, code): diff --git a/src/sim/process.cc b/src/sim/process.cc index 90d0e5d55..f647467b8 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -97,6 +97,7 @@ Process::Process(ProcessParams *params, EmulationPageTable *pTable, executable(params->executable), tgtCwd(normalize(params->cwd)), hostCwd(checkPathRedirect(tgtCwd)), + release(params->release), _uid(params->uid), _euid(params->euid), _gid(params->gid), _egid(params->egid), _pid(params->pid), _ppid(params->ppid), diff --git a/src/sim/process.hh b/src/sim/process.hh index 27c569602..23ed6d661 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -224,6 +224,9 @@ class Process : public SimObject std::string tgtCwd; std::string hostCwd; + // Syscall emulation uname release. + std::string release; + // Id of the owner of the process uint64_t _uid; uint64_t _euid; -- 2.30.2