-
Notifications
You must be signed in to change notification settings - Fork 74
Comparing changes
Open a pull request
base repository: termux/termux-exec-package
base: v2.2.0
head repository: termux/termux-exec-package
compare: master
- 18 commits
- 38 files changed
- 1 contributor
Commits on Mar 26, 2025
-
Fixed(ExecIntercept): Fix file descriptor leak when reading file header
Credits to @drinkcat for reporting it. - 3300bfb#r154209904
Configuration menu - View commit details
-
Copy full SHA for 3f3a69f - Browse repository at this point
Copy the full SHA 3f3a69fView commit details -
Changed: Use standardized format for version string output as per the…
… `<component_name> version=<name> org=<name> project=<name>` format
Configuration menu - View commit details
-
Copy full SHA for f9deee2 - Browse repository at this point
Copy the full SHA f9deee2View commit details -
Fixed(ExecIntercept_RuntimeBinaryTests): Do not log failure logs to s…
…tdout of parent and log them to original stderr of child, otherwise they would get captured in `output` of parent and compared with `output_regex`
Configuration menu - View commit details
-
Copy full SHA for 0f0866e - Browse repository at this point
Copy the full SHA 0f0866eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4064813 - Browse repository at this point
Copy the full SHA 4064813View commit details -
Added(ExecIntercept_RuntimeBinaryTests): Allow not running
ExecLP, ……`ExecVP` and `ExecVPE` tests by setting `file` to `NULL`
Configuration menu - View commit details
-
Copy full SHA for 9e0f4b2 - Browse repository at this point
Copy the full SHA 9e0f4b2View commit details -
Added(ExecIntercept_RuntimeBinaryTests): Allow not comparing exit cod…
…e by setting `expectedExitCode` to `-1` This is needed for running specific commands whose exit code can vary on different Android versions, like when getting help output of system executables.
Configuration menu - View commit details
-
Copy full SHA for 4ac33b3 - Browse repository at this point
Copy the full SHA 4ac33b3View commit details -
Added(ExecIntercept_RuntimeBinaryTests): Allow test runner functions …
…to override init function of child process that runs the test
Configuration menu - View commit details
-
Copy full SHA for 5b124c1 - Browse repository at this point
Copy the full SHA 5b124c1View commit details -
Fixed(ExecIntercept): Return
Permission denied (EACCES)if executin……g a non-regular file instead of `Is a directory (EISDIR)` for a directory Despite `EISDIR` being more appropriate if trying to execute a directory, considering even `bash` and `sh` return the same, `execve` expects `EACCES` as per its man page. > EACCES The file or a script interpreter is not a regular file. - https://man7.org/linux/man-pages/man2/execve.2.html ``` ~ $ TERMUX_EXEC__LOG_LEVEL=4 env . 28077 E termux : TERMUX_EXEC__VERSION: '1:2.1.0+direct-ld-preload' 28077 E termux.exec: <----- execve() intercepted -----> 28077 E termux.exec: executable = '/data/data/com.termux/files/usr/bin/env' 28077 E termux.exec: argv[0] = 'env' 28077 E termux.exec: argv[1] = '.' 28077 E termux.exec: Intercepting execve 28077 E termux.exec: read_file_header: '1' 28077 E termux.ld-preload: system_linker_exec_mode: '1' 28077 E termux.ld-preload: android_build_version_sdk: '30' 28077 E termux.ld-preload: se_process_context_from_file: 'u:r:untrusted_app_27:s0:c212,c256,c512,c768' 28077 E termux.ld-preload: app_data_file_exec_exempted: '1' 28077 E termux.ld-preload: system_linker_exec_enabled: '0' 28077 E termux.exec: unset_ld_vars_from_env: '0' 28077 E termux.exec: modify_env: '0' 28077 E termux.exec: modify_args: '0' 28077 E termux.exec: Calling syscall execve 28077 E termux.exec: executable = '/data/data/com.termux/files/usr/bin/env' 28077 E termux.exec: argv[0] = 'env' 28077 E termux.exec: argv[1] = '.' 28077 E termux : TERMUX_EXEC__VERSION: '1:2.1.0+direct-ld-preload' 28077 E termux.exec: <----- execvp() intercepted -----> 28077 E termux.exec: executable = '/data/data/com.termux/files/usr/bin/.' 28077 E termux.exec: argv[0] = '.' 28077 E termux.exec: Intercepting execve 28077 E termux.exec: normalized_executable: '/data/data/com.termux/files/usr/bin' 28077 E termux.exec: read_file_header: '1' 28077 E termux.exec: Failed to read executable path '/data/data/com.termux/files/usr/bin' for file header: Is a directory 28077 E termux.exec: <----- execve() failed -----> env: ‘.’: Is a directory ~ $ bash -c './' bash: line 1: ./: Is a directory ~ $ /system/bin/sh -c './' /system/bin/sh: ./: can't execute: Is a directory ``` Related commit termux/termux-core-package@1779618b Closes #33
Configuration menu - View commit details
-
Copy full SHA for 577ffd9 - Browse repository at this point
Copy the full SHA 577ffd9View commit details -
Fixed(ExecIntercept): Fix issue on at least on Android
<= 7, where ……running commands with empty `$LD_PRELOAD` variable, like `LD_PRELOAD= <command>` will fail with `CANNOT LINK EXECUTABLE` errors with a random environment variable `<name=value>` pair or `DT_RUNPATH` directory loaded as a library ``` $ LD_DEBUG=3 LD_PRELOAD= bash CANNOT LINK EXECUTABLE "bash": can't read file "/data/data/com.termux/files/usr/lib": Is a directory [ Android dynamic linker (64-bit) ] W [ LD_PRELOAD set to "" ] I name /data/data/com.termux/files/usr/bin/bash: allocated soinfo @ 0x7f97a24010 W [ Linking "/data/data/com.termux/files/usr/bin/bash" ] I [ "" find_loaded_library_by_soname failed (*candidate=n/a@0x0). Trying harder...] I [ opening ] I name /data/data/com.termux/files/usr/lib: allocated soinfo @ 0x7f97a24240 D DEBUG: can't read file "/data/data/com.termux/files/usr/lib": Is a directory I name /data/data/com.termux/files/usr/lib: freeing soinfo @ 0x7f97a24240 A CANNOT LINK EXECUTABLE "bash": can't read file "/data/data/com.termux/files/usr/lib": Is a directory $ LD_PRELOAD="" /system/bin/sh CANNOT LINK EXECUTABLE "/system/bin/sh": cant read file "/system/lib64": Is a directory ``` ``` $ LD_DEBUG=3 LD_PRELOAD= bash CANNOT LINK EXECUTABLE: library "SHELL=/data/data/com.termux/files/usr/bin/bash" not found page record for 0x7f6384688050 was not found (block_size=64) W [ android linker & debugger ] I name bash: allocated soinfo @ 0x7fa61e09b008 W [ linking bash ] I [ 'SHELL=/data/data/com.termux/files/usr/bin/bash' find_loaded_library_by_soname returned false (*candidate=n/a@0x0). Trying harder...] I [ opening SHELL=/data/data/com.termux/files/usr/bin/bash ] D DEBUG: library "SHELL=/data/data/com.termux/files/usr/bin/bash" not found $ LD_PRELOAD= /system/bin/sh CANNOT LINK EXECUTABLE: library "_=/system/bin/sh" not found $ LD_PRELOAD= /system/bin/pm CANNOT LINK EXECUTABLE: library "_=/system/bin/pm" not found ``` Cause is unknown, but related changes in linker for empty LD_PRELOAD are at: - https://cs.android.com/android/_/android/platform/bionic/+/d799b2bb - https://cs.android.com/android/_/android/platform/bionic/+/44f6e189 Was found locally before on Android 6 while testing, but ignored. Reported again by @robertkirkman at following: - #31 (comment)
Configuration menu - View commit details
-
Copy full SHA for 760ff6e - Browse repository at this point
Copy the full SHA 760ff6eView commit details -
Changed(ExecIntercept): Rename
isSystemExecutable()function to `is……ExecutableUnderSystemDir()`
Configuration menu - View commit details
-
Copy full SHA for adf08af - Browse repository at this point
Copy the full SHA adf08afView commit details -
Fixed(ExecIntercept): Fix
LD_VARSnot being unset for system execut……ables if executed with `fexecve()` or fd path, and their file header being read instead of skipped as per 3300bfb File descriptor executable paths are in the format `/proc/self/fd/<num>` or `/proc/<pid>/fd/<num>`, normally for `fexecve()`, but can be passed manually by callers. For such paths, checks would fail for if the path is under system directories with `isExecutableUnderSystemDir()` or if `LD_VARS` should be unset with `shouldUnsetLDVarsFromEnv()`, as path would start with `/proc` instead of one of the system directories. Now we find the real path before any checks are done by calling `readlink()` via `getRegularFileFdRealPath()` on the fd path. Note that `fexecve()` is only supported for Android `>= 9` and `CANNOT LINK EXECUTABLE` errors due to `LD_VARS` being set like `LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib` when calling system binaries only seem to occur on older Android versions. So we simulate `fexecve()` for tests by opening a system executable, generating fd path manually and then executing it. Following are examples of errors caused by `LD_LIBRARY_PATH` being set. Termux app only exports it for Android `5` and `6` though. ``` $ LD_PRELOAD= bash $ LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib PATH=/system/bin /system/bin/{am,pm} CANNOT LINK EXECUTABLE: could not load library "libandroid_runtime.so" needed by "app_process"; caused by could not load library "libhwui.so" needed by "libandroid_runtime.so"; caused by could not load library "libRS.so" needed by "libhwui.so"; caused by could not load library "libbcc.so" needed by "libRS.so"; caused by could not load library "libbcinfo.so" needed by "libbcc.so"; caused by cannot locate symbol "_ZNK4llvm6MDNode10getOperandEj" referenced by "libbcinfo.so"... $ LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib PATH=/system/bin /system/bin/dalvikvm Aborted dlopen("libjavacore.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "bn_expand2" referenced by "libjavacore.so"... LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib PATH=/system/bin /system/bin/{am,pm} CANNOT LINK EXECUTABLE: cannot locate symbol "u_charMirror_55" referenced by "/system/lib64/libandroid_runtime.so"... $ LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib PATH=/system/bin /system/bin/dalvikvm Aborted art/runtime/runtime.cc:1149] LoadNativeLibrary failed for "libjavacore.so": dlopen failed: cannot locate symbol "_ZTVN6icu_5513UnicodeStringE" referenced by "/system/lib64/libjavacore.so"... ~ $ LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib PATH=/system/bin /system/bin/{am,pm} CANNOT LINK EXECUTABLE "app_process": cannot locate symbol "glTexGenxvOES" referenced by "/system/lib64/libandroid_runtime.so"... Aborted $ LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib PATH=/system/bin /system/bin/dalvikvm Failed to initialize JNI invocation API from (null) Failed to dlopen libart.so: dlopen failed: cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib64/libunwind.so"... ```
Configuration menu - View commit details
-
Copy full SHA for 4477568 - Browse repository at this point
Copy the full SHA 4477568View commit details -
Configuration menu - View commit details
-
Copy full SHA for 07b0d82 - Browse repository at this point
Copy the full SHA 07b0d82View commit details
Commits on May 1, 2025
-
Added: Add link to 5ea25ee for initial implementation of `system_link…
Configuration menu - View commit details
-
Copy full SHA for 8885c26 - Browse repository at this point
Copy the full SHA 8885c26View commit details -
Fixed: Do not log some debug messages to
stderrto keep logging out……put synchronous if `stdout` and `stderr` streams are captured separately as other log entries are being sent to `stdout` The existence of `stderr` being set can also be considered a failure by clients.
Configuration menu - View commit details
-
Copy full SHA for 8793fc7 - Browse repository at this point
Copy the full SHA 8793fc7View commit details -
Changed: Move
lib/termux-exec_nos_c_tredirectory to `lib/termux-ex……ec_nos_c/tre` and `termux/api/termux_exec/ld_preload` sources to `termux/api/termux_exec/service/ld_preload` stage 1
Configuration menu - View commit details
-
Copy full SHA for f3e7306 - Browse repository at this point
Copy the full SHA f3e7306View commit details -
Changed: Move
lib/termux-exec_nos_c_tredirectory to `lib/termux-ex……ec_nos_c/tre` and `api/termux_exec/ld_preload` sources to `api/termux_exec/service/ld_preload` stage 2 The Termux Runtime Environment `tre` is a variant of the `termux-exec_nos_c` library and so its sources should be under the `tre` sub directory to be consistent with the library naming and directory hierarchy convention. For example, for a `foo_jvm_java` library with the Android App Runtime Environment `aare` and Java Runtime Environment `jre` variants that share common code, the directory hierarchy would be `lib/foo_jvm_java/{share,aare,jre}`, where `share` sub directory contains the common code. The API service code must exist under the `service` directory like `api/<host>/service/<service_name>` as other directories like `config`/`utils` could exist that are shared between different API services, as they would otherwise conflict with the service name directory.Configuration menu - View commit details
-
Copy full SHA for 578549c - Browse repository at this point
Copy the full SHA 578549cView commit details
Commits on May 5, 2025
-
Configuration menu - View commit details
-
Copy full SHA for fc36b43 - Browse repository at this point
Copy the full SHA fc36b43View commit details
Commits on Jun 25, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 4606100 - Browse repository at this point
Copy the full SHA 4606100View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v2.2.0...master