aboutsummaryrefslogtreecommitdiffstats
path: root/exec/exec.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Port recent Android changes to mips64elPo Lu2025-04-151-4/+5
| | | | | | | | | | | | | | | | | | | | | * exec/config-mips.m4.in (DADDI2, DADDI3): Disable at-clobbering by assembler macros expressly. * exec/loader-mips64el.s: Adapt from loader-mipsel.s. * exec/configure.ac (exec_cv_as_daddi): Properly escape reg names. * exec/exec.c (struct exec_jump_command, exec_0): Don't define or set `fpu_mode' if __LP64__. * exec/exec.h (struct exec_tracee): New field `callno'. * exec/trace.c (process_system_call): Always record the current system call number in TRACEE lest it should be required once it has been overwritten upon the syscall's completion. (seccomp_system_call): Likewise. (after_fork): Clear `tracee->callno'.
* Port recent changes to mipsel systemsPo Lu2025-04-141-8/+5
| | | | | | | | | | | | | | | * exec/exec.c (exec_0): Don't disable AT_EXECFN substitution on MIPS systems. * exec/loader-aarch64.s (skip_environ): Correct typo in commentary. * exec/loader-mips64el.s: Add a disclaimer that this file is currently inoperable. * exec/loader-mipsel.s (__start): Move environment and argument vectors and produce and replace AT_EXECFN. Clear stack before proceeding to circumvent an oversight in glibc.
* Replace AT_EXECFN in auxiliary vectors of programs executed on AndroidPo Lu2025-04-131-1/+24
| | | | | | | | | | | | | | | | | | * exec/exec.c (insert_args, exec_0): On non-MIPS systems, copy NAME and its length to the loader area. State that MIPS support is not yet available (though it will be pending the availability of a functioning emulator). * exec/loader-aarch64.s (_start): * exec/loader-armeabi.s (_start): * exec/loader-x86.s (_start): * exec/loader-x86_64.s (_start): Displace auxv, environ, and argv to create sufficient space for the provided file name, and copy the file name there. Replace AT_EXECFN to refer to this space.
* Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Fix some #! misparsing in check_interpreterPaul Eggert2024-09-171-5/+5
| | | | | | | | | * exec/exec.c: Do not include ctype.h, as the kernel does not care about the locale. (check_interpreter): Treat only spaces and tabs as white space. Do not inspect more bytes than were read. Although the resulting code does not exactly match what the Android kernel does, it’s closer than what it was before.
* * exec/exec.c (exec_0): Restore erroneously deleted statement.Po Lu2024-07-011-0/+3
|
* Optimize process execution on AndroidPo Lu2024-07-011-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Improve /proc/self/exe substitution on AndroidPo Lu2024-03-141-1/+1
| | | | | | | | | | | | * exec/configure.ac (USER_SWORD): New macro. * exec/exec.c (format_pid): Export this function. * exec/exec.h: * exec/trace.c (canon_path): New function. (handle_readlinkat, handle_openat): Test complete file name against /proc/self/exe, and further check for /proc/pid/exe.
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* Correct build on systems without PAGE_MASKPo Lu2023-09-181-1/+1
| | | | | * exec/exec.c (write_load_command) <PAGE_MASK, PAGE_SIZE>: Uniformly define even if !HAVE_GETPAGESIZE.
* Avoid stpncpyPaul Eggert2023-08-121-72/+5
| | | | | | | | | | | | | It’s not worth the porting hassle, and as the glibc manual says, “this function is generally a poor choice for processing strings”. * admin/merge-gnulib (GNULIB_MODULES): Remove stpncpy. * exec/configure.ac: Do not check for stpncpy. * exec/exec.c (rpl_stpncpy, stpncpy): Remove this replacement. (exec_0): Properly clear buffer1. Use memcpy instead of stpncpy to add the trailing name. This code is clearly still suboptimal but efficiency is not that important here and I tried to minimize the change. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* Merge from origin/emacs-29Eli Zaretskii2023-08-121-1/+1
| | | | | | | | | | | | | | | | 4767f5eaeed Better fix for bug#65156 dd1d8414b33 Fix insert-file-contents with pipes and /dev/stdin 50649a6d1a2 ; * etc/PROBLEMS: Fix wording. f0dda682ffb ; * etc/NEWS.28: Add deletion of levents.el. f4acae842c0 Fix bug#65042 e1874c4e8bf * configure.ac (HAVE_TREE_SITTER): Set NEED_DYNLIB=yes (b... ef8838c3a5f * etc/NEWS: Mention tramp-show-ad-hoc-proxies. 495bee253fc * test/lisp/net/tramp-tests.el (tramp-test42-utf8): Skip ... de1effd73b4 ; Fix last change 7c7966862bc * test/lisp/net/tramp-tests.el (tramp-test10-write-region... 16205e8db65 ; Improve help-echo in package.el a95e7006989 ; Filter packages available for upgrade via menu bar adff72dd1d2 Fix reverting Rmail buffers
* Update Android portPo Lu2023-05-311-30/+63
| | | | | | * exec/exec.c (insert_args): New argument `arg3'. Replace argv[1] with that argument. (exec_0): Pass file name of script to `insert_args'.
* ; * exec/exec.c (exec_0): Use strcpy.Po Lu2023-05-231-1/+1
|
* Update Android portPo Lu2023-05-051-30/+46
| | | | | | | * doc/emacs/android.texi (Android Environment): Document lossage with SIGSTOP. * exec/exec.c (exec_0): Check X_OK on file being opened. Also handle /proc/self/exe.
* Update Android portPo Lu2023-05-021-15/+37
| | | | | | | | | | | | | | * exec/config.h.in (__bool_true_false_are_defined): * exec/configure.ac (REENTRANT): New definition. (READLINKAT_SYSCALL, READLINK_SYSCALL): New defines. Set on all hosts. * exec/exec.c (MIN, MAX): Remove redundant declarations. Move to config.h. (exec_0): Copy name of executable into NAME when !REENTRANT. * exec/exec.h (struct exec_tracee): New struct `exec_file'. * exec/trace.c (remove_tracee, handle_exec, handle_readlinkat) (process_system_call, after_fork): Handle readlinkat system calls.
* Port Android port to older Android systemsPo Lu2023-05-021-5/+5
| | | | | | | | | * exec/config.h.in: Autoheader. * exec/configure.ac: Check for declarations of stpcpy and stpncpy. * exec/exec.c (stpcpy, stpncpy): Use replacements if declarations are not present; this happens when a new Android NDK is building for an old version of Android.
* Update Android portPo Lu2023-05-011-4/+99
| | | | | | | | * exec/config.h.in: Update config.h.in. * exec/configure.ac: Check for stpcpy and stpncpy. * exec/exec.c (rpl_stpcpy, rpl_stpncpy): Define replacements when they are not present on the system. (process_program_header): Fill comment.
* Fix cwd relative process execution on AndroidPo Lu2023-05-011-0/+53
| | | | | | | | * exec/exec.c (format_pid): New function. (exec_0): Make cwd relative file names relative to /proc/pid/cwd. * exec/trace.c (handle_exec): Handle EINTR. (process_system_call): Report failure without clobbering x0.
* Update Android portPo Lu2023-05-011-1/+1
| | | | | | | | | | | | | | | | | | | * Makefile.in (extraclean): Clean in exec as well. * configure.ac: Fix detection of absolute srcdir. Also, pass CFLAGS. * exec/Makefile.in: (.c.o): Add -I. so config.h can be found.:(.s.o): Don't create m4 temporary in srcdir. * exec/config-mips.m4.in (DADDI2, DADDI3): New macros. Define to substitute if as cannot assemble daddi. * exec/configure.ac (user_h): Look for user.h in asm/ as well. Use new user.h. Also look in ptrace.h on arm systems. Check if as supports daddi on mips64. * exec/exec.c (check_interpreter): Fix char signedness bug. * exec/loader-mips64el.s (__start): Use DADDI2 and DADDI3 for two- and 3-operand daddi. * exec/mipsel-user.h: Don't include sgidefs.h. * java/INSTALL: Document that m4 is now required. * src/android.c (android_rewrite_spawn_argv): Add missing NULL.
* Add helper binary `exec1'Po Lu2023-04-301-0/+1016
* .gitignore: New files. * Makefile.in (mostlyclean_dirs): Add libexec, if its Makefile exists. * autogen.sh (do_git): Autoreconf in exec as well. * configure.ac: Configure libexec on Android. * exec/Makefile.in: * exec/README: * exec/config-mips.m4.in: * exec/config.guess: * exec/config.h.in: * exec/config.sub: * exec/configure: * exec/configure.ac: * exec/deps.mk: * exec/exec.c (MIN, struct exec_open_command) (struct exec_map_command, struct exec_jump_command) (write_open_command, write_load_command, process_interpreter_1) (process_interpreter, process_program_header, insert_args) (exec_0): * exec/exec.h (_EXEC_H_, struct elf_header_32) (struct program_header_32, struct dt_entry_32) (struct elf_header_64, struct program_header_64) (struct dt_entry_64, struct exec_tracee): * exec/exec1.c (main): * exec/install-sh (scriptversion): * exec/loader-aarch64.s (_start): * exec/loader-armeabi.s (_start): * exec/loader-mips64el.s (__start): * exec/loader-mipsel.s (__start): * exec/loader-x86.s (_start): * exec/loader-x86_64.s (_start): * exec/mipsel-user.h (_MIPSEL_USER_H_): * exec/mipsfpu.c (MIPS_ABI_FP_ANY, fpu_reqs, valid_abi_p) (fp_mode_for_abi, cpu_supports_fr0_p, determine_fpu_mode): * exec/mipsfpu.h (_MIPSFPU_H_, FP_FR0): * exec/test.c (print_usage, main): * exec/trace.c (MAX_TRACEES, aarch64_set_regs, read_memory) (user_alloca, user_copy, remove_tracee, handle_clone) (syscall_trap_p, handle_exec, process_system_call, tracing_execve) (after_fork, find_tracee, exec_waitpid, exec_init): New files. * java/Makefile.in (CROSS_EXEC_BINS): Add exec1 and loader. ($(CROSS_EXEC_BINS) &): New target.