diff options
| author | Po Lu | 2023-05-03 17:01:44 +0800 |
|---|---|---|
| committer | Po Lu | 2023-05-03 17:01:44 +0800 |
| commit | b0d6c6737260f10407a734b2e4811afa1516d79a (patch) | |
| tree | 7e8deb2d180ae92620f81e3f78ffa8c476846c49 /exec | |
| parent | 7b3c774bcee29fa0a13f38a60ddebc6fbdbedd0e (diff) | |
| download | emacs-b0d6c6737260f10407a734b2e4811afa1516d79a.tar.gz emacs-b0d6c6737260f10407a734b2e4811afa1516d79a.zip | |
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')
| -rw-r--r-- | exec/config.h.in | 3 | ||||
| -rw-r--r-- | exec/configure.ac | 4 | ||||
| -rw-r--r-- | exec/trace.c | 25 |
3 files changed, 32 insertions, 0 deletions
diff --git a/exec/config.h.in b/exec/config.h.in index 6301275fd8a..3e04af37f79 100644 --- a/exec/config.h.in +++ b/exec/config.h.in | |||
| @@ -58,6 +58,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 58 | /* Define to 1 if process_vm_readv is available. */ | 58 | /* Define to 1 if process_vm_readv is available. */ |
| 59 | #undef HAVE_PROCESS_VM | 59 | #undef HAVE_PROCESS_VM |
| 60 | 60 | ||
| 61 | /* Define to 1 if `si_syscall' is a member of `siginfo_t'. */ | ||
| 62 | #undef HAVE_SIGINFO_T_SI_SYSCALL | ||
| 63 | |||
| 61 | /* Define to 1 if stdbool.h conforms to C99. */ | 64 | /* Define to 1 if stdbool.h conforms to C99. */ |
| 62 | #undef HAVE_STDBOOL_H | 65 | #undef HAVE_STDBOOL_H |
| 63 | 66 | ||
diff --git a/exec/configure.ac b/exec/configure.ac index efefc6c7dbc..e78d8ebea90 100644 --- a/exec/configure.ac +++ b/exec/configure.ac | |||
| @@ -73,6 +73,10 @@ AC_CHECK_FUNC([process_vm_readv], | |||
| 73 | #include <sys/uio.h> | 73 | #include <sys/uio.h> |
| 74 | ]])])]) | 74 | ]])])]) |
| 75 | AC_CHECK_HEADERS([sys/param.h sys/uio.h]) | 75 | AC_CHECK_HEADERS([sys/param.h sys/uio.h]) |
| 76 | AC_CHECK_MEMBERS([siginfo_t.si_syscall], [], [], | ||
| 77 | [[ | ||
| 78 | #include <signal.h> | ||
| 79 | ]]) | ||
| 76 | 80 | ||
| 77 | AH_BOTTOM([ | 81 | AH_BOTTOM([ |
| 78 | #ifdef HAVE_STDBOOL_H | 82 | #ifdef HAVE_STDBOOL_H |
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) | |||
| 1174 | ptrace (PTRACE_SYSCALL, pid, 0, 0); | 1174 | ptrace (PTRACE_SYSCALL, pid, 0, 0); |
| 1175 | return -1; | 1175 | return -1; |
| 1176 | 1176 | ||
| 1177 | #ifdef SIGSYS | ||
| 1178 | case SIGSYS: | ||
| 1179 | if (ptrace (PTRACE_GETSIGINFO, pid, 0, &siginfo)) | ||
| 1180 | return -1; | ||
| 1181 | |||
| 1182 | /* Continue the process until the next syscall, but don't | ||
| 1183 | pass through the signal if an emulated syscall led to | ||
| 1184 | it. */ | ||
| 1185 | #ifdef HAVE_SIGINFO_T_SI_SYSCALL | ||
| 1186 | #ifndef __arm__ | ||
| 1187 | ptrace (PTRACE_SYSCALL, pid, 0, ((siginfo.si_code == SYS_SECCOMP | ||
| 1188 | && siginfo.si_syscall == -1) | ||
| 1189 | ? 0 : status)); | ||
| 1190 | #else /* __arm__ */ | ||
| 1191 | ptrace (PTRACE_SYSCALL, pid, 0, ((siginfo.si_code == SYS_SECCOMP | ||
| 1192 | && siginfo.si_syscall == 222) | ||
| 1193 | ? 0 : status)); | ||
| 1194 | #endif /* !__arm__ */ | ||
| 1195 | #else /* !HAVE_SIGINFO_T_SI_SYSCALL */ | ||
| 1196 | /* Drop this signal, since what caused it is unknown. */ | ||
| 1197 | ptrace (PTRACE_SYSCALL, pid, 0, 0); | ||
| 1198 | #endif /* HAVE_SIGINFO_T_SI_SYSCALL */ | ||
| 1199 | return -1; | ||
| 1200 | #endif /* SIGSYS */ | ||
| 1201 | |||
| 1177 | default: | 1202 | default: |
| 1178 | /* Continue the process until the next syscall. */ | 1203 | /* Continue the process until the next syscall. */ |
| 1179 | ptrace (PTRACE_SYSCALL, pid, 0, status); | 1204 | ptrace (PTRACE_SYSCALL, pid, 0, status); |