summaryrefslogtreecommitdiff
path: root/exec/trace.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-05-03 17:01:44 +0800
committerPo Lu <luangruo@yahoo.com>2023-05-03 17:01:44 +0800
commitb0d6c6737260f10407a734b2e4811afa1516d79a (patch)
tree7e8deb2d180ae92620f81e3f78ffa8c476846c49 /exec/trace.c
parent7b3c774bcee29fa0a13f38a60ddebc6fbdbedd0e (diff)
downloademacs-b0d6c6737260f10407a734b2e4811afa1516d79a.tar.gz
Update Android port
* exec/config.h.in: Autoheader. * exec/configure.ac: Check for siginfo_t.si_syscall. * exec/trace.c (exec_waitpid): If SIGSYS is received, and caused by seccomp, drop it should the call number be the invalid system call used by Emacs.
Diffstat (limited to 'exec/trace.c')
-rw-r--r--exec/trace.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/exec/trace.c b/exec/trace.c
index 8d107696423..579a62f6c5e 100644
--- a/exec/trace.c
+++ b/exec/trace.c
@@ -1174,6 +1174,31 @@ exec_waitpid (pid_t pid, int *wstatus, int options)
ptrace (PTRACE_SYSCALL, pid, 0, 0);
return -1;
+#ifdef SIGSYS
+ case SIGSYS:
+ if (ptrace (PTRACE_GETSIGINFO, pid, 0, &siginfo))
+ return -1;
+
+ /* Continue the process until the next syscall, but don't
+ pass through the signal if an emulated syscall led to
+ it. */
+#ifdef HAVE_SIGINFO_T_SI_SYSCALL
+#ifndef __arm__
+ ptrace (PTRACE_SYSCALL, pid, 0, ((siginfo.si_code == SYS_SECCOMP
+ && siginfo.si_syscall == -1)
+ ? 0 : status));
+#else /* __arm__ */
+ ptrace (PTRACE_SYSCALL, pid, 0, ((siginfo.si_code == SYS_SECCOMP
+ && siginfo.si_syscall == 222)
+ ? 0 : status));
+#endif /* !__arm__ */
+#else /* !HAVE_SIGINFO_T_SI_SYSCALL */
+ /* Drop this signal, since what caused it is unknown. */
+ ptrace (PTRACE_SYSCALL, pid, 0, 0);
+#endif /* HAVE_SIGINFO_T_SI_SYSCALL */
+ return -1;
+#endif /* SIGSYS */
+
default:
/* Continue the process until the next syscall. */
ptrace (PTRACE_SYSCALL, pid, 0, status);