From 97a0ad7f632eab6a17c987f93d2f8f3cc11056d0 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 27 Nov 2019 01:46:31 -0800 Subject: [PATCH] arch,sim: Replace setuidFunc with ignoreFunc. The setuidFunc just ignores the call and warns about it, and that's what ignoreFunc already does. Jira Issue: https://gem5.atlassian.net/browse/GEM5-187 Change-Id: I7655863ed6fe200ff3ac087be3218d49c3c43061 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23194 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- src/arch/alpha/linux/process.cc | 2 +- src/arch/arm/linux/process.cc | 2 +- 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 | 4 ++-- src/arch/sparc/solaris/process.cc | 2 +- src/sim/syscall_emul.cc | 8 -------- src/sim/syscall_emul.hh | 4 ---- 9 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index 91decc79f..2cd910249 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -179,7 +179,7 @@ SyscallDescABI AlphaLinuxProcess::syscallDescs[] = { /* 20 */ { "getxpid", getpidPseudoFunc }, /* 21 */ { "osf_mount" }, /* 22 */ { "umount" }, - /* 23 */ { "setuid", setuidFunc }, + /* 23 */ { "setuid", ignoreFunc }, /* 24 */ { "getxuid", getuidPseudoFunc }, /* 25 */ { "exec_with_loader" }, /* 26 */ { "osf_ptrace" }, diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 039148739..4b54a5414 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -188,7 +188,7 @@ static SyscallDescABI syscallDescs32[] = { /* 20 */ { "getpid", getpidFunc }, /* 21 */ { "mount" }, /* 22 */ { "umount" }, - /* 23 */ { "setuid", setuidFunc }, + /* 23 */ { "setuid", ignoreFunc }, /* 24 */ { "getuid", getuidFunc }, /* 25 */ { "stime" }, /* 26 */ { "ptrace" }, diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index 0b03c9981..31bf9906e 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -192,7 +192,7 @@ SyscallDescABI MipsLinuxProcess::syscallDescs[] = { /* 20 */ { "getpid", getpidFunc }, /* 21 */ { "mount" }, /* 22 */ { "umount" }, - /* 23 */ { "setuid", setuidFunc }, + /* 23 */ { "setuid", ignoreFunc }, /* 24 */ { "getuid", getuidFunc }, /* 25 */ { "stime" }, /* 26 */ { "ptrace" }, diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index 217f0bd97..7c55a57bd 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -120,7 +120,7 @@ SyscallDescABI PowerLinuxProcess::syscallDescs[] = { /* 20 */ { "getpid", getpidFunc }, /* 21 */ { "mount" }, /* 22 */ { "umount" }, - /* 23 */ { "setuid", setuidFunc }, + /* 23 */ { "setuid", ignoreFunc }, /* 24 */ { "getuid", getuidFunc }, /* 25 */ { "stime" }, /* 26 */ { "ptrace" }, diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index b20d09d31..6f3f03741 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -269,7 +269,7 @@ std::map> {143, { "setregid" }}, {144, { "setgid" }}, {145, { "setreuid" }}, - {146, { "setuid", setuidFunc }}, + {146, { "setuid", ignoreFunc }}, {147, { "setresuid" }}, {148, { "getresuid" }}, {149, { "getresgid" }}, @@ -601,7 +601,7 @@ std::map> {143, { "setregid" }}, {144, { "setgid" }}, {145, { "setreuid" }}, - {146, { "setuid", setuidFunc }}, + {146, { "setuid", ignoreFunc }}, {147, { "setresuid" }}, {148, { "getresuid" }}, {149, { "getresgid" }}, diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index a166a5188..65ad2986d 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -112,7 +112,7 @@ SyscallDescABI SparcLinuxProcess::syscall32Descs[] = { /* 20 */ { "getpid", getpidFunc }, /* 21 */ { "capget" }, /* 22 */ { "capset" }, - /* 23 */ { "setuid", setuidFunc }, // 32 bit + /* 23 */ { "setuid", ignoreFunc }, // 32 bit /* 24 */ { "getuid", getuidFunc }, // 32 bit /* 25 */ { "time" }, /* 26 */ { "ptrace" }, @@ -418,7 +418,7 @@ SyscallDescABI SparcLinuxProcess::syscallDescs[] = { /* 20 */ { "getpid", getpidFunc }, /* 21 */ { "capget" }, /* 22 */ { "capset" }, - /* 23 */ { "setuid", setuidFunc }, + /* 23 */ { "setuid", ignoreFunc }, /* 24 */ { "getuid", getuidFunc }, /* 25 */ { "time" }, /* 26 */ { "ptrace" }, diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index 4c22f1e4f..e95f2d755 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -114,7 +114,7 @@ SyscallDescABI SparcSolarisProcess::syscallDescs[] = { /* 20 */ { "getpid", getpidFunc }, /* 21 */ { "mount" }, /* 22 */ { "umount" }, - /* 23 */ { "setuid", setuidFunc }, + /* 23 */ { "setuid", ignoreFunc }, /* 24 */ { "getuid", getuidFunc }, /* 25 */ { "stime" }, /* 26 */ { "pcsample" }, diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index e7efbaa0e..585465d82 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -1013,14 +1013,6 @@ getgidPseudoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) } -SyscallReturn -setuidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int uid) -{ - // can't fathom why a benchmark would call this. - warn("Ignoring call to setuid(%d)\n", uid); - return 0; -} - SyscallReturn getpidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 69a583f57..3e727e831 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -275,10 +275,6 @@ SyscallReturn fcntlFunc(SyscallDesc *desc, int num, ThreadContext *tc); /// Target fcntl64() handler. SyscallReturn fcntl64Func(SyscallDesc *desc, int num, ThreadContext *tc); -/// Target setuid() handler. -SyscallReturn setuidFunc(SyscallDesc *desc, int num, ThreadContext *tc, - int uid); - /// Target pipe() handler. SyscallReturn pipeFunc(SyscallDesc *desc, int num, ThreadContext *tc); -- 2.30.2