-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
17.0.6
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
MacBookPro 2020 M1, Monterey, Oracle JDK 17.0.6, Zulu 17.0.6
MacBookPro 2022, Ventura, M2 Max, Temurin JDK 17.0.6
A DESCRIPTION OF THE PROBLEM :
Calling Unsafe::getLongVolatile() on an allocateDirect ByteBuffer causes SIGBUS on Apple Silicon CPU:s.
The issue occurs from idk 15 and onwards.
Running a heap allocated buffer works.
We did manage to get a dump file from Zulu 15 that shows a SIGBUS.
REGRESSION : Last worked in version 11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test code,.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Not crash
ACTUAL -
InternalError
---------- BEGIN SOURCE ----------
import java.nio.ByteBuffer;
import java.util.concurrent.ThreadLocalRandom;
import sun.misc.Unsafe;
public class UnsafeVolatileLong
{
private static final int OFFSET =28;
public static void main(String[] args) throws ReflectiveOperationException
{
var f = Unsafe.class.getDeclaredField("theUnsafe");
f.setAccessible(true);
var u = (Unsafe)f.get(null);
byte[] bs = new byte[OFFSET*2];
ThreadLocalRandom.current().nextBytes(bs);
ByteBuffer bbd = ByteBuffer.allocateDirect(bs.length);
bbd.put(bs);
var val = u.getLongVolatile(bbd, OFFSET);
System.out.println(val);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Possible workaround is to install a x86-64 version and trust Rosetta. We have not tried that.
Otherwise, stay onJDK 11
FREQUENCY : always
MacBookPro 2020 M1, Monterey, Oracle JDK 17.0.6, Zulu 17.0.6
MacBookPro 2022, Ventura, M2 Max, Temurin JDK 17.0.6
A DESCRIPTION OF THE PROBLEM :
Calling Unsafe::getLongVolatile() on an allocateDirect ByteBuffer causes SIGBUS on Apple Silicon CPU:s.
The issue occurs from idk 15 and onwards.
Running a heap allocated buffer works.
We did manage to get a dump file from Zulu 15 that shows a SIGBUS.
REGRESSION : Last worked in version 11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test code,.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Not crash
ACTUAL -
InternalError
---------- BEGIN SOURCE ----------
import java.nio.ByteBuffer;
import java.util.concurrent.ThreadLocalRandom;
import sun.misc.Unsafe;
public class UnsafeVolatileLong
{
private static final int OFFSET =28;
public static void main(String[] args) throws ReflectiveOperationException
{
var f = Unsafe.class.getDeclaredField("theUnsafe");
f.setAccessible(true);
var u = (Unsafe)f.get(null);
byte[] bs = new byte[OFFSET*2];
ThreadLocalRandom.current().nextBytes(bs);
ByteBuffer bbd = ByteBuffer.allocateDirect(bs.length);
bbd.put(bs);
var val = u.getLongVolatile(bbd, OFFSET);
System.out.println(val);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Possible workaround is to install a x86-64 version and trust Rosetta. We have not tried that.
Otherwise, stay onJDK 11
FREQUENCY : always