The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Note that this fix may have compatibility implications on jdk8u as it changes the minimum value required for xss on Aarch64.
The minimum value of xss on Aarch64 is changed from 164k to 228k on 4k page size(328k->456k on 64k page size).
If the user-specified xss is smaller than the current minimum value, the value of xss needs to be adjusted to be larger than the minimum required value to prevent JVM startup failure.
29-08-2022
Fix request (8u)
I would like to backport this patch to fix minimum stack size computations on Aarch64.
I updated the value directly on define_pd_global because JDK-8078556 is not in 8u.
Testing: Following test case worked correctly after patch.
Before patch:
$ java TLSStackOverflow
[1] 35476 segmentation fault (core dumped) java TLSStackOverflow
After patch:
$ java TLSStackOverflow
got expected stackoverflow, passed
$ keytool -genkey -keyalg RSA -keystore localhost-rsa.jks -storepass changeit -storetype pkcs12
$ cat TLSStackOverflow.java
```java
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
import javax.net.ssl.*;
import java.io.*;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class TLSStackOverflow
{
private static final String keystore = "/home/hedongbo/myprojects/study/stackoverflow/new/localhost-rsa.jks";
private static final char[] passphrase = "changeit".toCharArray();
private static final int port = 8447;
private static KeyStore pfx = null;
public static void doWrite(OutputStream out) throws Exception {
out.write("hello".getBytes(), 0, 3);
out.flush();
doWrite(out);
}
public TLSStackOverflow()
{}
public static void main(String[] args) throws Exception
{
new Thread(() -> {
try {
pfx = KeyStore.getInstance("PKCS12");
pfx.load(new FileInputStream(keystore), passphrase);
SSLContext ctx = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(pfx, passphrase);
KeyManager[] kms = kmf.getKeyManagers();
ctx.init(kms, null, null);
ServerSocketFactory fact = ctx.getServerSocketFactory();
SSLServerSocket serversocket = (SSLServerSocket) fact.createServerSocket(port);
while (true)
{
Socket socket = null;
try
{
socket = serversocket.accept();
DataInputStream in = new DataInputStream(socket.getInputStream());
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
byte[] buf = new byte[8192];
int len = in.read(buf);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
// try
// {
// socket.close();
// }
// catch (Exception e) {
// e.printStackTrace();
// }
}
}
} catch (Exception e) {
e.printStackTrace();
}
}).start();
Thread.sleep(2000);
new Thread(() -> {
SSLSocket socket = null;
try {
pfx = KeyStore.getInstance("PKCS12");
pfx.load(new FileInputStream(keystore), passphrase);
SSLContext ctx = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(pfx, passphrase);
TrustAllManager[] trust = { new TrustAllManager() };
ctx.init(null, trust, null);
SocketFactory fact = ctx.getSocketFactory();
socket = (SSLSocket) fact.createSocket();
socket.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 2000);
socket.setTcpNoDelay(true);
socket.startHandshake();
DataInputStream in = new DataInputStream(socket.getInputStream());
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
String s = "GET " + " HTTP/1.1\r\n";
s+= "Accept: */*\r\n";
s+= "User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)\r\n";
s+= "Connection: Close\r\n";
s+= "\r\n";
try {
doWrite(out);
} catch (StackOverflowError e) {
System.out.println("got expected stackoverflow, passed");
System.exit(0);
}
byte[] buf = new byte[8192];
int len = in.read(buf);
if (len == -1)
{
System.out.println("eof");
return;
}
System.out.println(new String(buf, 0, len));
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
socket.close();
}
catch (Exception e)
{}
}
}).start();
}
}
class TrustAllManager implements X509TrustManager
{
private X509Certificate[] issuers;
public TrustAllManager()
{
this.issuers = new X509Certificate[0];
}
public X509Certificate[] getAcceptedIssuers()
{
return issuers ;
}
public void checkClientTrusted(X509Certificate[] chain, String authType)
{}
public void checkServerTrusted(X509Certificate[] chain, String authType)
{}
}
```
30-05-2022
A pull request was submitted for review.
URL: https://git.openjdk.java.net/jdk8u-dev/pull/66
Date: 2022-05-30 03:22:04 +0000
30-05-2022
URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/e20d7e4a25ac
User: lana
Date: 2017-02-01 21:14:17 +0000