diff options
| author | Po Lu | 2024-07-01 18:11:58 +0800 |
|---|---|---|
| committer | Po Lu | 2024-07-01 18:11:58 +0800 |
| commit | ebf5bcb9f0b6adeb97a3918b8f3845844c9091b0 (patch) | |
| tree | f7660b9380f715d48dfe4ff30a57e12965b6166d /exec/exec1.c | |
| parent | 7c8d4e96ba6db19bdca20a87bafed024a84eb517 (diff) | |
| download | emacs-ebf5bcb9f0b6adeb97a3918b8f3845844c9091b0.tar.gz emacs-ebf5bcb9f0b6adeb97a3918b8f3845844c9091b0.zip | |
Optimize process execution on Android
* exec/configure.ac (REENTRANT): Remove option for reentrancy.
(PROGRAM_COUNTER, HAVE_SECCOMP): Define register providing the
program counter and enable seccomp if its headers are available.
* exec/exec.c (write_load_command): Avoid defining unused
variable.
(exec_0): Remove code specific to REENTRANT configurations.
* exec/exec.h (struct exec_tracee) <exec_data, data_size>: New
fields for loader instructions and their size.
* exec/exec1.c (main): Call exec_init before forking.
* exec/mipsel-user.h (ELF_NGREG): Delete definition.
(struct mipsel_regs): Reduce number of gregs to 32, but
introduce separate fields for special registers.
* exec/trace.c (use_seccomp_p): New variable; defile to false if
!HAVE_SECCOMP.
(remove_tracee): Cease providing for non-reentrant
configurations. Release executable data if present.
(handle_clone_prepare): Likewise. Resume process with
PTRACE_CONT if seccomp-based interception is enabled.
(handle_clone, check_signal): Resume processes as above.
(handle_exec): Divide into two functions, with only rewriting
the system call and generating instructions for the loader
remaining in the first, and copying such instructions into the
loader's stack removed into a new function, `finish_exec'.
(finish_exec): New function.
(handle_readlinkat, handle_openat): Abolish non-REENTRANT
configurations.
(process_system_call): Divide exec system calls into two phases,
disambiguated by the value of tracee->waiting_for_syscall. Typo
fixes. Accommodate syscall-exit-stops where the signal was
initially intercepted by `seccomp_system_call'.
(interesting_syscalls): New array.
(ARRAYELTS): New macro.
(seccomp_system_call, establish_seccomp_filter): New function.
(tracing_execve) [HAVE_SECCOMP]: Establish a seccomp filter if
this is to be enabled.
(after_fork): Provide PTRACE_O_TRACESECCOMP. Resume process
with PTRACE_CONT if seccomp-based interception is enabled.
(exec_waitpid): Resume process with PTRACE_CONT if seccomp-based
interception is enabled. Dispatch stops identifying as
PTRACE_EVENT_SECCOMP to `seccomp_system_call'.
(exec_init): Establish whether it is possible to enable seccomp.
Diffstat (limited to 'exec/exec1.c')
| -rw-r--r-- | exec/exec1.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/exec/exec1.c b/exec/exec1.c index aaff9a94c62..cbd756d3d5c 100644 --- a/exec/exec1.c +++ b/exec/exec1.c | |||
| @@ -42,6 +42,9 @@ main (int argc, char **argv) | |||
| 42 | extern char **environ; | 42 | extern char **environ; |
| 43 | int wstatus; | 43 | int wstatus; |
| 44 | 44 | ||
| 45 | /* Provide the file name of the loader. */ | ||
| 46 | exec_init (argv[1]); | ||
| 47 | |||
| 45 | pid1 = getpid (); | 48 | pid1 = getpid (); |
| 46 | pid = fork (); | 49 | pid = fork (); |
| 47 | 50 | ||
| @@ -58,9 +61,6 @@ main (int argc, char **argv) | |||
| 58 | } | 61 | } |
| 59 | else | 62 | else |
| 60 | { | 63 | { |
| 61 | /* Provide the file name of the loader. */ | ||
| 62 | exec_init (argv[1]); | ||
| 63 | |||
| 64 | if (after_fork (pid)) | 64 | if (after_fork (pid)) |
| 65 | exit (127); | 65 | exit (127); |
| 66 | 66 | ||