Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: (termux-api) termux-clipboard-set not working on Android 14 #16411

Closed
AntonPieper opened this issue Apr 24, 2023 · 3 comments
Closed

[Bug]: (termux-api) termux-clipboard-set not working on Android 14 #16411

AntonPieper opened this issue Apr 24, 2023 · 3 comments
Labels
android-14 bug report Something is not working properly. duplicate Issue was posted previously. Use search ! termux-api Issue is related to Termux:API.

Comments

@AntonPieper
Copy link

Problem description

On Android 14 Beta, trying to run

termux-clipboard-set "test"

will result in the cursor returning to the next line (hanging forever), not copying "Test" and the program not exiting (only by pressing Ctrl + C).

Screenshot:

Screenshot_20230424-073407

What steps will reproduce the bug?

Install Termux:API from F-Droid, then install termux-clipboard-set by running

pkg install termux-api

lastly try to set the clipboard via

termux-clipboard-set "test"

What is the expected behavior?

It should not hang forever. It should set the clipboard and return.

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=19024
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main stable main
Updatable packages:
clang/stable 16.0.2 aarch64 [upgradable from: 16.0.1-1]
command-not-found/stable 2.1.0-20 aarch64 [upgradable from: 2.1.0-19]
coreutils/stable 9.3 aarch64 [upgradable from: 9.2-4]
glib/stable 2.76.2 aarch64 [upgradable from: 2.76.1]
libcompiler-rt/stable 16.0.2 aarch64 [upgradable from: 16.0.1-1]
libllvm/stable 16.0.2 aarch64 [upgradable from: 16.0.1-1]
libmpfr/stable 4.2.0-p4-0 aarch64 [upgradable from: 4.2.0]
lld/stable 16.0.2 aarch64 [upgradable from: 16.0.1-1]
llvm/stable 16.0.2 aarch64 [upgradable from: 16.0.1-1]
python-pip/stable 23.1.1 all [upgradable from: 23.1]
rust-analyzer/stable 20230320 aarch64 [upgradable from: 20230220]
rust/stable 1.69.0 aarch64 [upgradable from: 1.68.2]
termux-tools/stable 1.38.1 all [upgradable from: 1.38.0]
termux-tools version:
1.36.1
Android version:
13
Kernel build information:
Linux localhost 5.10.149-android13-4-693040-g6422af733678-ab9739629 #1 SMP PREEMPT Fri Mar 10 01:44:38 UTC 2023 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 7 Pro
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
@AntonPieper AntonPieper added bug report Something is not working properly. untriaged labels Apr 24, 2023
@xtkoba xtkoba added the termux-api Issue is related to Termux:API. label Apr 24, 2023
@aicynide
Copy link
Contributor

See termux-info, its a13

@sylirre
Copy link
Member

sylirre commented Apr 26, 2023

@aicynide Sometimes the beta version of Android OS is displayed as previous one. The system SDK level is more accurate then version number returned by getprop.

Edit: perhaps even SDK level not changed. The only difference I see is the release name. For Android 14 this is "UpsideDownCake", aka Android U.

ADB getprop values on Android 14 (dev) GSI:

[ro.build.version.preview_sdk]: [1]
[ro.build.version.preview_sdk_fingerprint]: [649baee05dadd66233ce9eaf03b06712]
[ro.build.version.release]: [13]
[ro.build.version.release_or_codename]: [UpsideDownCake]
[ro.build.version.release_or_preview_display]: [UpsideDownCake]
[ro.build.version.sdk]: [33]
[ro.build.version.security_patch]: [2023-04-05]

Screenshot from GSI installed on my device (Pixel 5) using dynamic system updates (side-by-side installation with stable OS version):

Screenshot_20230426-161525

Will try to get some information what is going on with Termux:API...

@sylirre
Copy link
Member

sylirre commented Apr 26, 2023

This is new W^X enforcement:

04-26 16:26:02.221  8073  8073 E app_process: Attempt to load writable dex file: /data/data/com.termux/files/usr/libexec/termux-am/am.apk
04-26 16:26:02.221  8073  8073 W System  : No Compatibility callbacks set! Querying change 218865702
04-26 16:26:02.221  8073  8073 W app_process: Ljava/lang/ClassLoader$SystemClassLoader; failed initialization: java.lang.SecurityException: Writable dex file '/data/data/com.termux/files/usr/libexec/termux-am/am.apk' is not allowed.
04-26 16:26:02.221  8073  8073 W app_process:   at java.lang.Object dalvik.system.DexFile.openDexFileNative(java.lang.String, java.lang.String, int, java.lang.ClassLoader, dalvik.system.DexPathList$Element[]) (DexFile.java:-2)
04-26 16:26:02.221  8073  8073 W app_process:   at java.lang.Object dalvik.system.DexFile.openDexFile(java.lang.String, java.lang.String, int, java.lang.ClassLoader, dalvik.system.DexPathList$Element[]) (DexFile.java:406)
04-26 16:26:02.221  8073  8073 W app_process:   at void dalvik.system.DexFile.<init>(java.lang.String, java.lang.ClassLoader, dalvik.system.DexPathList$Element[]) (DexFile.java:128)
04-26 16:26:02.221  8073  8073 W app_process:   at void dalvik.system.DexFile.<init>(java.io.File, java.lang.ClassLoader, dalvik.system.DexPathList$Element[]) (DexFile.java:101)
04-26 16:26:02.221  8073  8073 W app_process:   at dalvik.system.DexFile dalvik.system.DexPathList.loadDexFile(java.io.File, java.io.File, java.lang.ClassLoader, dalvik.system.DexPathList$Element[]) (DexPathList.java:438)
04-26 16:26:02.221  8073  8073 W app_process:   at dalvik.system.DexPathList$Element[] dalvik.system.DexPathList.makeDexElements(java.util.List, java.io.File, java.util.List, java.lang.ClassLoader, boolean) (DexPathList.java:397)
04-26 16:26:02.221  8073  8073 W app_process:   at void dalvik.system.DexPathList.<init>(java.lang.ClassLoader, java.lang.String, java.lang.String, java.io.File, boolean) (DexPathList.java:166)
04-26 16:26:02.221  8073  8073 W app_process:   at void dalvik.system.BaseDexClassLoader.<init>(java.lang.String, java.lang.String, java.lang.ClassLoader, java.lang.ClassLoader[], java.lang.ClassLoader[], boolean) (BaseDexClassLoader.java:160)
04-26 16:26:02.221  8073  8073 W app_process:   at void dalvik.system.BaseDexClassLoader.<init>(java.lang.String, java.io.File, java.lang.String, java.lang.ClassLoader) (BaseDexClassLoader.java:105)
04-26 16:26:02.221  8073  8073 W app_process:   at void dalvik.system.PathClassLoader.<init>(java.lang.String, java.lang.String, java.lang.ClassLoader) (PathClassLoader.java:71)
04-26 16:26:02.221  8073  8073 W app_process:   at java.lang.ClassLoader java.lang.ClassLoader.createSystemClassLoader() (ClassLoader.java:224)
04-26 16:26:02.221  8073  8073 W app_process:   at java.lang.ClassLoader java.lang.ClassLoader.-$$Nest$smcreateSystemClassLoader() (ClassLoader.java:-1)
04-26 16:26:02.221  8073  8073 W app_process:   at void java.lang.ClassLoader$SystemClassLoader.<clinit>() (ClassLoader.java:183)
04-26 16:26:02.221  8073  8073 W app_process:   at java.lang.ClassLoader java.lang.ClassLoader.getSystemClassLoader() (ClassLoader.java:1098)
04-26 16:26:02.221  8073  8073 F app_process: runtime.cc:903] Check failed: system_class_loader != nullptr 
04-26 16:26:02.277  1026  1032 W statsd  : StatsPullerManager: Unknown tagId 10108

DEX files with write permission are not allowed to be executed, though the fix is trivial. Just run:

chmod 400 $PREFIX/libexec/termux-am/am.apk

This is basically a duplicate of #16255.

termux-clipboard-set and termux-clipboard-get work perfectly under Android 14 after chmod 400 on the termux-am files.


Other issues related to W^X hardening:

@sylirre sylirre closed this as completed Apr 26, 2023
@sylirre sylirre added the duplicate Issue was posted previously. Use search ! label Apr 26, 2023
@xtkoba xtkoba removed the untriaged label Apr 27, 2023
@termux termux locked as resolved and limited conversation to collaborators Apr 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
android-14 bug report Something is not working properly. duplicate Issue was posted previously. Use search ! termux-api Issue is related to Termux:API.
Projects
None yet
Development

No branches or pull requests

5 participants