Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc

Issue 260793003: [MIPS] Add seccomp bpf support (Closed) Base URL: https://git.chromium.org/git/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
index c4a6f92c01d423521aee83ffcaf2e4cc35f4e82a..8a23af8df354f8f01853503572d2f202c0a3ef33 100644
--- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
@@ -47,8 +47,14 @@ void WriteToStdErr(const char* error_message, size_t size) {
// Print a seccomp-bpf failure to handle |sysno| to stderr in an
// async-signal safe way.
void PrintSyscallError(uint32_t sysno) {
+#if defined(__mips__)
+ // On MIPS syscall numbers are in different range than on x86 and ARM
+ if ((sysno < __NR_Linux) || (sysno >= __NR_Linux + __NR_Linux_syscalls))
jln (very slow on Chromium) 2014/05/02 20:42:04 What is the value of __NR_linux? We need to make
nedeljko 2014/05/07 15:40:05 Value of __NR_Linux for is either 4000, 5000 or 60
+ sysno = 0;
+#else
if (sysno >= 1024)
sysno = 0;
+#endif
// TODO(markus): replace with async-signal safe snprintf when available.
const size_t kNumDigits = 4;
char sysno_base10[kNumDigits];
@@ -73,8 +79,14 @@ namespace sandbox {
intptr_t CrashSIGSYS_Handler(const struct arch_seccomp_data& args, void* aux) {
uint32_t syscall = args.nr;
+#if defined(__mips__)
+ // On MIPS syscall numbers are in different range than on x86 and ARM
jln (very slow on Chromium) 2014/05/02 20:42:04 Let's make a function TruncSysnoToValu(int sysno,
nedeljko 2014/05/07 15:40:05 Done.
+ if ((syscall < __NR_Linux) || (syscall >= __NR_Linux + __NR_Linux_syscalls))
+ syscall = 0;
+#else
if (syscall >= 1024)
syscall = 0;
+#endif
PrintSyscallError(syscall);
// Encode 8-bits of the 1st two arguments too, so we can discern which socket

Powered by Google App Engine
This is Rietveld 408576698