Commit graph

71 commits

Author SHA1 Message Date
Po Lu
2b7268c43f ; * exec/loader-mips64el.s (skip_environ): Eliminate one more `daddi'. 2025-04-15 17:21:25 +08:00
Po Lu
638b084a61 Unconditionally define MIPS_NABI on mips64el
* exec/configure.ac (MIPS_NABI): Always define to 1 on
mips64el-*-linux*.
2025-04-15 17:21:25 +08:00
Po Lu
19b6e36a22 * exec/loader-mips64el.s (rest_of_exec): Deal with assembler bugs. 2025-04-15 17:11:56 +08:00
Po Lu
458ad0cb89 * exec/configure.ac (exec_CHECK_MIPS_NABI): Test __LP64__ also. 2025-04-15 17:03:57 +08:00
Po Lu
5bf86e2be0 Port recent Android changes to mips64el
* 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'.
2025-04-15 16:17:14 +08:00
Po Lu
e790873be1 Address typos in MIPS executable loader
* exec/loader-mipsel.s (rest_of_exec): Delete redundant nop.
(skip_environ): Correct stack space test.  Don't jump into
the label for the sp preserving case's delay slot.
2025-04-15 11:14:14 +08:00
Po Lu
74df372398 Port recent changes to mipsel systems
* 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.
2025-04-14 21:31:07 +08:00
Po Lu
462bd149cd Fix typos in executable loaders
* exec/loader-aarch64.s (skip_environ, cleanup): Minor thinkos.

* exec/loader-x86_64.s (skip_environ): Insert missing label.
2025-04-14 09:10:14 +08:00
Po Lu
7a01350624 Replace AT_EXECFN in auxiliary vectors of programs executed on Android
* 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.
2025-04-13 18:51:49 +08:00
Po Lu
d93342cf32 Merge from savannah/emacs-30
563efd6838 Fix program execution on Android 15 QPR2 Beta
2025-02-09 12:08:27 +08:00
Po Lu
563efd6838 Fix program execution on Android 15 QPR2 Beta
* exec/trace.c (process_vm_readv, process_vm_writev): New
function pointers.  Attempt to load them on recent Android
systems when `exec' was not linked with a sufficiently
up-to-date libc.
(read_memory, user_copy): Always use process_vm_readv and
process_vm_writev if available.
(handle_openat): Write trailing NULL byte of filename to user
buffer.
(exec_init): Attempt to dlsym process_vm_readv and
process_vm_writev.
2025-02-09 12:06:52 +08:00
Po Lu
b683280f87 ; * exec/configure.ac (config-mips.m4): Fix typo. 2025-01-03 13:04:34 +08:00
Stefan Kangas
cd6e2a0828 Fix copyright years by hand
These are dates that admin/update-copyright did not update.
2025-01-02 18:44:48 +01:00
Stefan Kangas
7fa975adbc Update copyright year to 2025
Run "TZ=UTC0 admin/update-copyright".
2025-01-02 18:39:42 +01:00
Po Lu
be9577d4a1 Fix volatile Android build
* exec/Makefile.in (config-mips.m4): Call config.status in
builddir.
2025-01-02 20:26:56 +08:00
Paul Eggert
b36b1be491 Fix copyright years by hand
These are dates that admin/update-copyright did not update.
2025-01-01 07:41:51 +00:00
Paul Eggert
4da38c6321 Update copyright year to 2025
Run "TZ=UTC0 admin/update-copyright".
2025-01-01 07:39:17 +00:00
Andrea Corallo
9d93d717d5 * Bump Emacs version to 30.0.93
* nt/README.W32: Update Emacs version.
* msdos/sed2v2.inp: Likewise.
* exec/configure.ac: Likewise.
* configure.ac: Likewise.
* README: Likewise.
2024-12-19 22:27:30 +01:00
Stefan Kangas
7cb77385d3 ; Fix typos 2024-11-21 10:06:19 +01:00
Andrea Corallo
bbc8a5830a Bump Emacs version to 30.0.92
* nt/README.W32: Update Emacs version.
* msdos/sed2v2.inp: Likewise.
* exec/configure.ac: Likewise.
* configure.ac: Likewise.
* README: Likewise.
2024-10-26 11:41:45 +02:00
Paul Eggert
e0b027d121 Fix some #! misparsing in check_interpreter
* 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.
2024-09-17 16:39:25 -07:00
Andrea Corallo
9a1c76bf7f Bump Emacs version to 30.0.91
* nt/README.W32: Update Emacs version.
* msdos/sed2v2.inp: Likewise.
* exec/configure.ac: Likewise.
* configure.ac: Likewise.
* README: Likewise.
2024-09-11 22:14:09 +02:00
Po Lu
69e1aca041 ; * exec/configure.ac: Update version. 2024-09-11 13:26:17 +08:00
Po Lu
76487b7454 Merge from savannah/emacs-30
ee3e3a6311 ; Update version number of exec/configure.ac
c5925b6ba5 Fix heex-ts-mode indentation following previews elixir-mo...
c3383be5f0 ; * admin/make-tarball.txt: Improve last change.
8ddb54117f ; * admin/make-tarball.txt: Remove now unnecessary config...
7e194d33f9 * lisp/ldefs-boot.el: Update.
9019536ea6 Fix use of Uniscribe font driver in MinGW build
5c55c860db Avoid crashes in redisplay in batch-mode testing
ba2190e1ae ; * etc/NEWS: Fix indentation.
818c0cc9a5 eglot-test-rust-completion-exit-function: Fix failure in ...
f47297782b ; * doc/lispref/searching.texi (Rx Notation): Simplify rx...
03e5698167 Clarify the semantics of 'string-pixel-width'
9f0603207b ; * src/treesit.c: Minor cleanups of recent changes.
e0d3f74395 * src/treesit.c (treesit_debug_print_parser_list): Fix fo...
bed38ded73 ; * src/treesit.c (treesit_debug_print_parser_list): Fix ...
18c6487dbd ; * src/treesit.c: Add a prototype so there's no warning ...
bf23382f1f Read more on each call to treesit's buffer reader
3435464452 Fix the range handling in treesit.c
3fcec09f75 Add debugging function for treesit.c
0fd259d166 Fix elixir-ts-mode's range query
2329b36b1f ; project-files-relative-names: Update docstring (bug#72701)
e55e2e1c6b Make json-serialize always return a unibyte string (bug#7...
89c99891b2 ; * doc/lispref/os.texi (Suspending Emacs): Fix last change.
4f044d0d3d ; Improve documentation of 'suspend-emacs'
2024-09-11 13:21:58 +08:00
Po Lu
ee3e3a6311 ; Update version number of exec/configure.ac
* admin/admin.el (set-version): Update AC_INIT expansion in
exec/configure.ac.

* exec/configure.ac: Update version to 30.0.90.
2024-09-11 13:18:35 +08:00
Po Lu
6b5accdc05 Port seccomp acceleration to Linux 3.5.0
* etc/NEWS: Update correspondingly.

* exec/Makefile.in (config-mips.m4): Don't define rule
or predicate $(LOADOBJS) on it elsewhere than on MIPS.

* exec/README: Direct developers to GDB.

* exec/trace.c (finish_exec): Resume the tracee after reporting
an error in `exec'.
(after_fork): If seccomp is enabled on Android, and the kernel
is 4.7 or earlier, detect whether revisions to the sequencing of
seccomp events have been backported from 4.8.
(exec_waitpid): Resume the process with PTRACE_CONT after
receiving an unknown signal.
(exec_init): Cease disabling seccomp on Android kernels earlier
than 4.8.
2024-07-02 12:12:14 +08:00
Po Lu
e087d3009b * exec/exec.c (exec_0): Restore erroneously deleted statement. 2024-07-01 22:55:03 +08:00
Po Lu
5965614d3e ; * exec/trace.c (seccomp_system_call): Typo in commentary. 2024-07-01 18:22:01 +08:00
Po Lu
ebf5bcb9f0 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.
2024-07-01 18:11:58 +08:00
Po Lu
fa322155ad Disable preprocessing of assembler files with m4 on non-MIPS systems
* exec/Makefile.in (is_mips): New substitution.
(.s.o): Avoid calling m4 unless it be set.

* exec/configure.ac: Substitute is_mips, and don't generate
config-mips.m4 otherwise.

* exec/loader-x86.s:

* exec/loader-x86_64.s: Use assembler rather than m4-defined
comment syntax.
2024-06-27 10:15:13 +08:00
Po Lu
1b94f800ae * exec/trace.c (rpl_stpcpy): Replace stpcpy if absent. 2024-03-14 14:21:49 +08:00
Po Lu
30bc867aec Improve /proc/self/exe substitution on Android
* 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.
2024-03-14 13:45:48 +08:00
Po Lu
b9f348ce1e * exec/configure.ac (OPENAT_SYSCALL): Define on MIPS. 2024-01-29 11:54:46 +08:00
Po Lu
c37b50ad41 Intercept calls to `openat' under Android
* exec/configure.ac (OPEN_SYSCALL, OPENAT_SYSCALL): Define new
macros.

* exec/exec.h (struct exec_tracee): New field `sp'.

* exec/trace.c (handle_openat): New function.
(process_system_call): If handle_openat executes successfully,
save the unmodified stack pointer within the tracee structure to
be restored once the system call completes.
2024-01-27 10:36:30 +08:00
Po Lu
8da6c8c7c1 ; * exec/Makefile.in: Correct typo. 2024-01-21 09:59:47 +08:00
Po Lu
76efd4037e ; * exec/Makefile.in (extraclean): Remove standard files. 2024-01-21 09:59:47 +08:00
Paul Eggert
afc9cd1721 Fix autogen.sh’s spurious ‘git diff’ output
Problem reported by Gerd Möllmann (Bug#68464).
* .gitignore: Ignore files in exec that are now copied from build-aux.
* admin/merge-gnulib (avoided_flags): Instead of clearing
autom4te.cache here ...
* autogen.sh (do_git): ... clear it here.
Use config.guess, config.sub and install-sh from
the Emacs repository, as they are more likely to be up to date.
This avoids unnecessary differences among different builders,
and avoids unnecessary ‘git diff’ output after autogen.sh.
Also, copy these files from build-aux to exec since there
should be no difference between the two copies.
* exec/config.guess, exec/config.sub, exec/install-sh:
Remove from repository, as autogen.sh now copies them from build-aux.
2024-01-20 16:35:24 -08:00
Po Lu
d2528f5c0f ; Update copyright years in more files 2024-01-02 10:31:42 +08:00
Po Lu
070cb32463 ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
Stefan Kangas
c3b41c123a ; Use ?c instead of integer in local variables
* exec/loader-armeabi.s (timespec):
* exec/loader-mips64el.s (__start):
* exec/loader-mipsel.s (__start): Use ?c instead of integer in local
variables.
2023-12-10 22:09:56 +01:00
Stefan Kangas
06a12b0ccc ; Fix typos 2023-12-10 13:22:04 +01:00
Po Lu
fb0198bf7e ; Update Autoconf auxiliaries in exec
* exec/config.guess:

* exec/config.sub: Update configury files.
2023-11-26 08:28:45 +08:00
Po Lu
b331bf6d8a Correct build on systems without PAGE_MASK
* exec/exec.c (write_load_command) <PAGE_MASK, PAGE_SIZE>:
Uniformly define even if !HAVE_GETPAGESIZE.
2023-09-18 14:16:40 +08:00
Po Lu
cd69120731 Correct crash in child processes under armeabi Android
* exec/trace.c (process_system_call) <READLINKAT_SYSCALL>:
Examine tracee->waiting_for_syscall and avoid rewriting user
arguments if a system call is presently being executed by the
kernel.  Reported by Romário Rios <romariorios@protonmail.com>.
2023-09-18 14:16:39 +08:00
Paul Eggert
5315e6e8d7 Avoid stpncpy
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.
2023-08-12 12:57:35 -07:00
Eli Zaretskii
b289f0769f Merge from origin/emacs-29
4767f5eaee Better fix for bug#65156
dd1d8414b3 Fix insert-file-contents with pipes and /dev/stdin
50649a6d1a ; * etc/PROBLEMS: Fix wording.
f0dda682ff ; * etc/NEWS.28: Add deletion of levents.el.
f4acae842c Fix bug#65042
e1874c4e8b * configure.ac (HAVE_TREE_SITTER): Set NEED_DYNLIB=yes (b...
ef8838c3a5 * etc/NEWS: Mention tramp-show-ad-hoc-proxies.
495bee253f * test/lisp/net/tramp-tests.el (tramp-test42-utf8): Skip ...
de1effd73b ; Fix last change
7c7966862b * test/lisp/net/tramp-tests.el (tramp-test10-write-region...
16205e8db6 ; Improve help-echo in package.el
a95e700698 ; Filter packages available for upgrade via menu bar
adff72dd1d Fix reverting Rmail buffers
2023-08-12 13:42:14 -04:00
Po Lu
f74166c726 Stop tracking exec/config.h.in
* .gitignore: Add exec/config.h.in.

* exec/config.h.in: Remove from Git.
2023-08-07 20:15:33 +08:00
Po Lu
916ef57489 Update Android port
* exec/trace.c (handle_readlinkat): Adjust commentary to match
behavior.
* src/android.c (android_get_keysym_name): NULL terminate
*name_return.
2023-07-20 20:50:50 +08:00
Po Lu
32352bec96 ; * exec/loader-mips64el.s (rest_of_exec): Fix typo in comment. 2023-06-27 09:53:04 +08:00
Po Lu
0bdeb217fc ; * exec/Makefile.in (clean): Add `exec1'. 2023-06-19 08:56:49 +08:00