jamvm is broken due to missing native methods in sun.misc.Unsafe

Bug #1611598 reported by Tiago Stürmer Daitx on 2016-08-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenJDK
Fix Released
Medium
openjdk-7 (Ubuntu)
Undecided
Unassigned
Precise
High
Unassigned
Trusty
High
Unassigned

Bug Description

[Issue]
The fix of OpenJDK's bug 8158260 (http://icedtea.classpath.org/hg/release/icedtea7-forest-2.6/hotspot/rev/4f8cbd54a9c6) introduced 2 new native methods to the sun.misc.Unsafe class: isBigEndian0 and unalignedAccess0.

This completely broke JamVM and as of now it is impossible to start a jamvm session.

jtreg summary results for OpenJDK 7:
hotspot - Test results: passed: 5; failed: 309; error: 7
langtools - Test results: passed: 374; failed: 1,593; error: 1

An error output from a testcase:
----------System.err:(6/344)----------
Error initialising VM (initialiseMainThread)
Check the README for compatible class-libraries/versions
Exception occurred while printing exception (java/lang/NullPointerException)...
Original exception was java/lang/UnsatisfiedLinkError
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
result: Failed. Unexpected exit from test [exit code: 1]

Running java -jamvm -version fails the same way.

[Fix]
The simple fix is to add both methods to the natives.c file in the classlib/openjdk directory.

I have tested this with IcedTea 2.6.7 and now jtreg passes:
hotspot - Test results: passed: 220; failed: 90; error: 11
langtools - Test results: passed: 1,901; failed: 65; error: 2

I have reported this upstream at https://sourceforge.net/p/jamvm/code/merge-requests/1/ and it is now waiting review.

Created attachment 1546
add 2 new sun.misc.unsafe methods to jamvm

[Issue]
The fix of OpenJDK's bug 8158260 (http://icedtea.classpath.org/hg/release/icedtea7-forest-2.6/hotspot/rev/4f8cbd54a9c6) introduced 2 new native methods to the sun.misc.Unsafe class: isBigEndian0 and unalignedAccess0.

This completely broke JamVM and as of now it is impossible to start a jamvm session.

jtreg summary results:
hotspot - Test results: passed: 5; failed: 309; error: 7
langtools - Test results: passed: 374; failed: 1,593; error: 1

An error output from a testcase:
----------System.err:(6/344)----------
Error initialising VM (initialiseMainThread)
Check the README for compatible class-libraries/versions
Exception occurred while printing exception (java/lang/NullPointerException)...
Original exception was java/lang/UnsatisfiedLinkError
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
result: Failed. Unexpected exit from test [exit code: 1]

Running java -jamvm -version fails the same way.

[Fix]
The simple fix is to add both methods to the natives.c file in the classlib/openjdk directory.

I have tested this with IcedTea 2.6.7 and now jtreg passes:
hotspot - Test results: passed: 220; failed: 90; error: 11
langtools - Test results: passed: 1,901; failed: 65; error: 2

I have reported this upstream at https://sourceforge.net/p/jamvm/code/merge-requests/1/ and it is now waiting review.

Changed in openjdk-7 (Ubuntu):
status: New → Confirmed
assignee: nobody → Tiago Stürmer Daitx (tdaitx)
summary: - jamvm is broken after 2.6.7 update
+ jamvm is broken due to missing native methods in sun.misc.Unsafe
description: updated
Changed in openjdk:
importance: Unknown → Critical
status: Unknown → Confirmed

Yeah, the same will need to be done with CACAO too. I haven't had time to test those with this fix during the CPU. Your patch looks good to me.

Just as a heads up, I spent a lot of time getting both CACAO and JamVM to at least build with 8 before the release of 3.0.0 (they still can't build themselves), and haven't had much response from upstream on either.

Bug 3136 filed for CACAO.

C de-Avillez (hggdh2) on 2016-08-10
Changed in openjdk-7 (Ubuntu Precise):
importance: Undecided → High
Changed in openjdk-7 (Ubuntu Trusty):
importance: Undecided → High
Changed in openjdk:
importance: Critical → Medium
status: Confirmed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-7 - 7u111-2.6.7-0ubuntu0.12.04.2

---------------
openjdk-7 (7u111-2.6.7-0ubuntu0.12.04.2) precise-security; urgency=medium

  * Backport to Ubuntu 12.04.

openjdk-7 (7u111-2.6.7-0ubuntu0.14.04.2) trusty-security; urgency=medium

  * debian/patches/it-jamvm-8158260-unsafe-methods.patch: fix JAMVM
    after the introduction of two new Unsafe methods in the OpenJDK
    hotspot. Closes: #833933. (LP: #1611598)

openjdk-7 (7u111-2.6.7-0ubuntu0.12.04.1) precise-security; urgency=medium

  * Backport to Ubuntu 12.04.

openjdk-7 (7u111-2.6.7-0ubuntu0.14.04.1) trusty-security; urgency=medium

  [ Matthias Klose ]
  * Fix handling of /usr/lib/jvm/*/jre/lib/zi if internal tzdata is used
    (Andreas Beckmann). Closes: #821858.
  * Add missing includes for aarch64 hotspot backport (building without pch).
  * Use in-tree lcms for backports.

  [ Tiago Stürmer Daitx ]
  * IcedTea release 2.6.7 (based on 7u111):
  * Security fixes
    - S8079718, CVE-2016-3458: IIOP Input Stream Hooking
    - S8145446, CVE-2016-3485: Perfect pipe placement (Windows only)
    - S8147771: Construction of static protection domains under Javax
      custom policy
    - S8148872, CVE-2016-3500: Complete name checking
    - S8149962, CVE-2016-3508: Better delineation of XML processing
    - S8150752: Share Class Data
    - S8151925: Font reference improvements
    - S8152479, CVE-2016-3550: Coded byte streams
    - S8155981, CVE-2016-3606: Bolster bytecode verification
    - S8155985, CVE-2016-3598: Persistent Parameter Processing
    - S8158571, CVE-2016-3610: Additional method handle validation
  * debian/rules:
    - Create symbolic link in source package (thanks Avinash).
      Closes: #832720.
    - Use in-tree lcms (LP: #913434)
  * debian/JB-jre-headless.prerm.in: check for /var/lib/binfmts/jar
    instead of /var/lib/binfmts/@basename@ before removing jar entry
    from binfmts. Closes: #821146.

 -- Tiago Stürmer Daitx <email address hidden> Wed, 10 Aug 2016 20:46:47 +0000

Changed in openjdk-7 (Ubuntu Precise):
status: New → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-7 - 7u111-2.6.7-0ubuntu0.14.04.3

---------------
openjdk-7 (7u111-2.6.7-0ubuntu0.14.04.3) trusty-security; urgency=medium

  * debian/rules:
    - fix typo (aarch64 -> arm64) and disable precompiled headers for
      arm64
    - remove compile file generated by automake during debian cleanup

openjdk-7 (7u111-2.6.7-0ubuntu0.14.04.2) trusty-security; urgency=medium

  * debian/patches/it-jamvm-8158260-unsafe-methods.patch: fix JAMVM
    after the introduction of two new Unsafe methods in the OpenJDK
    hotspot. Closes: #833933. (LP: #1611598)

openjdk-7 (7u111-2.6.7-0ubuntu0.14.04.1) trusty-security; urgency=medium

  [ Matthias Klose ]
  * Fix handling of /usr/lib/jvm/*/jre/lib/zi if internal tzdata is used
    (Andreas Beckmann). Closes: #821858.
  * Add missing includes for aarch64 hotspot backport (building without pch).
  * Use in-tree lcms for backports.

  [ Tiago Stürmer Daitx ]
  * IcedTea release 2.6.7 (based on 7u111):
  * Security fixes
    - S8079718, CVE-2016-3458: IIOP Input Stream Hooking
    - S8145446, CVE-2016-3485: Perfect pipe placement (Windows only)
    - S8147771: Construction of static protection domains under Javax
      custom policy
    - S8148872, CVE-2016-3500: Complete name checking
    - S8149962, CVE-2016-3508: Better delineation of XML processing
    - S8150752: Share Class Data
    - S8151925: Font reference improvements
    - S8152479, CVE-2016-3550: Coded byte streams
    - S8155981, CVE-2016-3606: Bolster bytecode verification
    - S8155985, CVE-2016-3598: Persistent Parameter Processing
    - S8158571, CVE-2016-3610: Additional method handle validation
  * debian/rules:
    - Create symbolic link in source package (thanks Avinash).
      Closes: #832720.
    - Use in-tree lcms (LP: #913434)
  * debian/JB-jre-headless.prerm.in: check for /var/lib/binfmts/jar
    instead of /var/lib/binfmts/@basename@ before removing jar entry
    from binfmts. Closes: #821146.

 -- Tiago Stürmer Daitx <email address hidden> Thu, 11 Aug 2016 23:28:50 +0000

Changed in openjdk-7 (Ubuntu Trusty):
status: New → Fix Released

details: http://icedtea.classpath.org//hg/icedtea7?cmd=changeset;node=3f1ac6eef871
author: Andrew John Hughes <email address hidden>
date: Fri Nov 11 05:51:16 2016 +0000

 PR3134: JamVM is broken due to 2 new native methods in sun.misc.Unsafe (from S8158260)

 2016-08-10 Tiago Stuermer Daitx <email address hidden>

  PR3134: JamVM is broken due to 2 new native
  methods in sun.misc.Unsafe (from S8158260)
  * Makefile.am:
  (ICEDTEA_PATCHES): Add JamVM patch for PR3134.
  * NEWS: Updated.
  * patches/jamvm/pr3134-unsafe_methods.patch:
  Add implementation of isBigEndian0 and unalignedAccess0.

details: http://icedtea.classpath.org//hg/release/icedtea7-2.6?cmd=changeset;node=a2edcfab7d93
author: Andrew John Hughes <email address hidden>
date: Fri Nov 11 06:11:16 2016 +0000

 PR3134: JamVM is broken due to 2 new native methods in sun.misc.Unsafe (from S8158260)

 2016-08-10 Tiago Stuermer Daitx <email address hidden>

  PR3134: JamVM is broken due to 2 new native
  methods in sun.misc.Unsafe (from S8158260)
  * Makefile.am:
  (ICEDTEA_PATCHES): Add JamVM patch for PR3134.
  * NEWS: Updated.
  * patches/jamvm/pr3134-unsafe_methods.patch:
  Add implementation of isBigEndian0 and unalignedAccess0.

Fixed in icedtea-2.7.0pre09 and icedtea-2.6.8.

Changed in openjdk:
status: In Progress → Fix Released
Tiago Stürmer Daitx (tdaitx) wrote :

Set main task as invalid since this does not affect ubuntu devel and it has been fixed on the supported releases.

Changed in openjdk-7 (Ubuntu):
status: Confirmed → Invalid
assignee: Tiago Stürmer Daitx (tdaitx) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.