From c65fa3dceb2163967bbb7199013e9fccdc6ff46c Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 5 May 2015 09:25:59 -0700 Subject: syscall_emul: fix warn_once behavior The current ignoreWarnOnceFunc doesn't really work as expected, since it will only generate one warning total, for whichever "warn-once" syscall is invoked first. This patch fixes that behavior by keeping a "warned" flag in the SyscallDesc object, allowing suitably flagged syscalls to warn exactly once per syscall. --- src/arch/arm/linux/process.cc | 14 +++++++------- src/arch/x86/linux/process.cc | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/arch') diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 269e92bae..223db7afd 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -245,7 +245,7 @@ static SyscallDesc syscallDescs32[] = { /* 123 */ SyscallDesc("unused#123", unimplementedFunc), /* 124 */ SyscallDesc("adjtimex", unimplementedFunc), /* 125 */ SyscallDesc("mprotect", ignoreFunc), - /* 126 */ SyscallDesc("sigprocmask", ignoreWarnOnceFunc), + /* 126 */ SyscallDesc("sigprocmask", ignoreFunc, SyscallDesc::WarnOnce), /* 127 */ SyscallDesc("unused#127", unimplementedFunc), /* 128 */ SyscallDesc("init_module", unimplementedFunc), /* 129 */ SyscallDesc("delete_module", unimplementedFunc), @@ -281,7 +281,7 @@ static SyscallDesc syscallDescs32[] = { /* 159 */ SyscallDesc("sched_get_priority_max", unimplementedFunc), /* 160 */ SyscallDesc("sched_get_priority_min", unimplementedFunc), /* 161 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc), - /* 162 */ SyscallDesc("nanosleep", ignoreWarnOnceFunc), + /* 162 */ SyscallDesc("nanosleep", ignoreFunc, SyscallDesc::WarnOnce), /* 163 */ SyscallDesc("mremap", mremapFunc), // ARM-specific /* 164 */ SyscallDesc("setresuid", unimplementedFunc), /* 165 */ SyscallDesc("getresuid", unimplementedFunc), @@ -293,8 +293,8 @@ static SyscallDesc syscallDescs32[] = { /* 171 */ SyscallDesc("getresgid", unimplementedFunc), /* 172 */ SyscallDesc("prctl", unimplementedFunc), /* 173 */ SyscallDesc("rt_sigreturn", unimplementedFunc), - /* 174 */ SyscallDesc("rt_sigaction", ignoreWarnOnceFunc), - /* 175 */ SyscallDesc("rt_sigprocmask", ignoreWarnOnceFunc), + /* 174 */ SyscallDesc("rt_sigaction", ignoreFunc, SyscallDesc::WarnOnce), + /* 175 */ SyscallDesc("rt_sigprocmask", ignoreFunc, SyscallDesc::WarnOnce), /* 176 */ SyscallDesc("rt_sigpending", unimplementedFunc), /* 177 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc), /* 178 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc), @@ -359,7 +359,7 @@ static SyscallDesc syscallDescs32[] = { /* 237 */ SyscallDesc("fremovexattr", unimplementedFunc), /* 238 */ SyscallDesc("tkill", unimplementedFunc), /* 239 */ SyscallDesc("sendfile64", unimplementedFunc), - /* 240 */ SyscallDesc("futex", ignoreWarnOnceFunc), + /* 240 */ SyscallDesc("futex", ignoreFunc, SyscallDesc::WarnOnce), /* 241 */ SyscallDesc("sched_setaffinity", unimplementedFunc), /* 242 */ SyscallDesc("sched_getaffinity", unimplementedFunc), /* 243 */ SyscallDesc("io_setup", unimplementedFunc), @@ -589,7 +589,7 @@ static SyscallDesc syscallDescs64[] = { /* 98 */ SyscallDesc("futex", unimplementedFunc), /* 99 */ SyscallDesc("set_robust_list", unimplementedFunc), /* 100 */ SyscallDesc("get_robust_list", unimplementedFunc), - /* 101 */ SyscallDesc("nanosleep", ignoreWarnOnceFunc), + /* 101 */ SyscallDesc("nanosleep", ignoreFunc, SyscallDesc::WarnOnce), /* 102 */ SyscallDesc("getitimer", unimplementedFunc), /* 103 */ SyscallDesc("setitimer", unimplementedFunc), /* 104 */ SyscallDesc("kexec_load", unimplementedFunc), @@ -623,7 +623,7 @@ static SyscallDesc syscallDescs64[] = { /* 132 */ SyscallDesc("sigaltstack", unimplementedFunc), /* 133 */ SyscallDesc("rt_sigsuspend", unimplementedFunc), /* 134 */ SyscallDesc("rt_sigaction", ignoreFunc), - /* 135 */ SyscallDesc("rt_sigprocmask", ignoreWarnOnceFunc), + /* 135 */ SyscallDesc("rt_sigprocmask", ignoreFunc, SyscallDesc::WarnOnce), /* 136 */ SyscallDesc("rt_sigpending", unimplementedFunc), /* 137 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc), /* 138 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc), diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 9a2bb96b5..ed17d7388 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -231,8 +231,8 @@ static SyscallDesc syscallDescs64[] = { /* 10 */ SyscallDesc("mprotect", ignoreFunc), /* 11 */ SyscallDesc("munmap", munmapFunc), /* 12 */ SyscallDesc("brk", brkFunc), - /* 13 */ SyscallDesc("rt_sigaction", ignoreFunc), - /* 14 */ SyscallDesc("rt_sigprocmask", ignoreFunc), + /* 13 */ SyscallDesc("rt_sigaction", ignoreFunc, SyscallDesc::WarnOnce), + /* 14 */ SyscallDesc("rt_sigprocmask", ignoreFunc, SyscallDesc::WarnOnce), /* 15 */ SyscallDesc("rt_sigreturn", unimplementedFunc), /* 16 */ SyscallDesc("ioctl", ioctlFunc), /* 17 */ SyscallDesc("pread64", unimplementedFunc), @@ -253,7 +253,7 @@ static SyscallDesc syscallDescs64[] = { /* 32 */ SyscallDesc("dup", dupFunc), /* 33 */ SyscallDesc("dup2", unimplementedFunc), /* 34 */ SyscallDesc("pause", unimplementedFunc), - /* 35 */ SyscallDesc("nanosleep", unimplementedFunc), + /* 35 */ SyscallDesc("nanosleep", ignoreFunc, SyscallDesc::WarnOnce), /* 36 */ SyscallDesc("getitimer", unimplementedFunc), /* 37 */ SyscallDesc("alarm", unimplementedFunc), /* 38 */ SyscallDesc("setitimer", unimplementedFunc), -- cgit v1.2.3