Closed

Description
If you need OpenJDK in Termux - do not upgrade to Android 12.
Problem description
After upgrading to Android 12, workaround for tagged pointers in package openjdk-17
is not working anymore.
This means we will need to either wait fixes on upstream or fix broken packages manually which may require quite much effort, depending on codebase size.
Other packages known to be affected by issue with tagged pointers:
swift
- swift: some binaries do not work on Android 11 #6261st
from x11-packages - https://github.com/termux/x11-packages/issues/407
What steps will reproduce the bug?
- Upgrade to Android 12 or obtain such OS version through installing GSI.
- Install the latest Termux app (it was 0.117 at time of reporting).
pkg upgrade && pkg install openjdk-17
- Run
javac
without arguments or attempt to compile something.
System information
termux-info:
Application version:
0.117-gda6174e
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.astra.in.ua/apt/termux-main stable main
Updatable packages:
All packages up to date
Android version:
12
Kernel build information:
Linux localhost 4.19.191-gc2161d44afae-ab7624114 #1 SMP PREEMPT Mon Aug 9 09:02:05 UTC 2021 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 5
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
agnostic-apollo commentedon Aug 15, 2021
Maybe try adding
android:allowNativeHeapPointerTagging="false"
toAndroidManifest.xml
oftermux-app
, as per https://source.android.com/devices/tech/debug/tagged-pointers. Although it mentions it only works withtargetSdkVersion
30
, but don't see any checks in AOSP from a quick look, but at least should work on android 12 withtargetSdkVersion
30
.The logic for decision has changed in android
11
r40
vsmaster
as per https://cs.android.com/android/_/android/platform/frameworks/base/+/15cce113f7232e117b091770c220ebc1b55f41d2 even thoughmaster
is also11
.https://cs.android.com/android/platform/superproject/+/android-11.0.0_r40:frameworks/base/services/core/java/com/android/server/am/ProcessList.java;l=1672
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/services/core/java/com/android/server/am/ProcessList.java;l=1697
finagolfin commentedon Aug 17, 2021
I wrote up why this was happening with Swift on the Swift forums in May: the issue is that Swift sets its own tag in the top byte and that collides with Android's system tagging. Presumably something similar is happening with OpenJDK.
finagolfin commentedon Oct 16, 2021
It appears that hardware support for memory tagging will only roll out with the new ARMv9 CPUs in the next year, but that link does mention "Software support for using MTE is being introduced as part of Android 12."
Maybe Android 12 will require software tagging, even though most hardware that is still ARMv8 doesn't natively support it yet, to get everyone to update any software that uses its own tag in the top byte, causing collisions. In our case, that only appears to be these three packages, so not much?
[-]Android 12 beta | [Bug]: OpenJDK is broken due to tagged pointers[/-][+]Android 12 | [Bug]: OpenJDK is broken due to tagged pointers[/+]finagolfin commentedon Nov 30, 2021
I just upgraded to Android 12 and have no problem with tagged pointers. Maybe this will only be a requirement for new devices that ship with Android 12 from now on.
Vixeliz commentedon Dec 29, 2021
Seems to work fine for me on my s21 ultra running android 12
finagolfin commentedon Dec 29, 2021
That shipped last year with Android 11 though, right? As I noted above, they're not requiring devices that upgrade to Android 12 to enable MTE, though they may be doing so for new devices that ship with Android 12, like the recently released Pixel 6, for all we know.
Vixeliz commentedon Dec 29, 2021
Oh sorry my bad in that case I hope this gets fixed by time I buy a new phone
63 remaining items