configs: Assign the host gid to the Process.gid in SE configs

Some syscalls (like chown) can make use of the current process group id
(gid) to setup file ownership. If we just provide the default fake gid
([1]) we will encounter some problems when executing the syscall on the
host.

Example (guest) program:

gid_t prc_gid = getgid();
int res = chown(..., prc_gid);

By assigning the host gid to the guest we are sure we can successfully
execute syscalls from the gem5 process

[1]: https://github.com/gem5/gem5/blob/v21.1.0.2/src/sim/Process.py#L52

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Change-Id: Ia09f44916def03f68f7605d72f323f03ec71bbe1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51767
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2021-10-19 11:40:08 +01:00
parent 7eb8fb927f
commit a680b98eaf
2 changed files with 2 additions and 0 deletions

View File

@@ -140,6 +140,7 @@ def get_processes(cmd):
argv = shlex.split(c)
process = Process(pid=100 + idx, cwd=cwd, cmd=argv, executable=argv[0])
process.gid = os.getgid()
print("info: %d. command and arguments: %s" % (idx + 1, process.cmd))
multiprocesses.append(process)

View File

@@ -88,6 +88,7 @@ def get_processes(args):
process = Process(pid = 100 + idx)
process.executable = wrkld
process.cwd = os.getcwd()
process.gid = os.getgid()
if args.env:
with open(args.env, 'r') as f: