Skip to content

Android 12 | [Bug]: OpenJDK is broken due to tagged pointers #7332

Closed
@ghost

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.

Screenshot_20210815-223542

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:

What steps will reproduce the bug?

  1. Upgrade to Android 12 or obtain such OS version through installing GSI.
  2. Install the latest Termux app (it was 0.117 at time of reporting).
  3. pkg upgrade && pkg install openjdk-17
  4. 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

Activity

ghost added
bug reportSomething is not working properly
on Aug 15, 2021
agnostic-apollo

agnostic-apollo commented on Aug 15, 2021

@agnostic-apollo
Member

Maybe try adding android:allowNativeHeapPointerTagging="false" to AndroidManifest.xml of termux-app, as per https://source.android.com/devices/tech/debug/tagged-pointers. Although it mentions it only works with targetSdkVersion 30, but don't see any checks in AOSP from a quick look, but at least should work on android 12 with targetSdkVersion 30.

The logic for decision has changed in android 11 r40 vs master as per https://cs.android.com/android/_/android/platform/frameworks/base/+/15cce113f7232e117b091770c220ebc1b55f41d2 even though master is also 11.

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

finagolfin commented on Aug 17, 2021

@finagolfin
Member

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

finagolfin commented on Oct 16, 2021

@finagolfin
Member

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?

ghost changed the title [-]Android 12 beta | [Bug]: OpenJDK is broken due to tagged pointers[/-] [+]Android 12 | [Bug]: OpenJDK is broken due to tagged pointers[/+] on Oct 19, 2021
ghost pinned this issue on Oct 19, 2021
finagolfin

finagolfin commented on Nov 30, 2021

@finagolfin
Member

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.

deleted a comment from on Dec 10, 2021
ghost unpinned this issue on Dec 24, 2021
Vixeliz

Vixeliz commented on Dec 29, 2021

@Vixeliz

Seems to work fine for me on my s21 ultra running android 12

finagolfin

finagolfin commented on Dec 29, 2021

@finagolfin
Member

Seems to work fine for me on my s21 ultra running android 12

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

Vixeliz commented on Dec 29, 2021

@Vixeliz

Oh sorry my bad in that case I hope this gets fixed by time I buy a new phone

63 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Leif-W@ericwomer@SwimmingTiger@easyaspi314@Grimler91

        Issue actions

          Android 12 | [Bug]: OpenJDK is broken due to tagged pointers · Issue #7332 · termux/termux-packages