8231635: SA Stackwalking code stuck in BasicTypeDataBase.findDynamicTypeForAddress()
Summary: Better checking for invalid stack address when walking the stack frames
Reviewed-by: sspitsyn, dtitov
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64CurrentFrameGuess.java Wed Nov 13 11:34:31 2019 -0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64CurrentFrameGuess.java Wed Nov 13 13:05:16 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,16 @@
setValues(curSP, null, pc);
return true;
}
+ Frame oldFrame = frame;
frame = frame.sender(map);
+ if (frame.getSP().lessThanOrEqual(oldFrame.getSP())) {
+ // Frame points to itself or to a location in the wrong direction.
+ // Break the loop and move on to next offset.
+ if (DEBUG) {
+ System.out.println("AMD64CurrentFrameGuess.run: frame <= oldFrame: " + frame);
+ }
+ break;
+ }
}
} catch (Exception e) {
if (DEBUG) {
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86CurrentFrameGuess.java Wed Nov 13 11:34:31 2019 -0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86CurrentFrameGuess.java Wed Nov 13 13:05:16 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,16 @@
setValues(curSP, null, pc);
return true;
}
+ Frame oldFrame = frame;
frame = frame.sender(map);
+ if (frame.getSP().lessThanOrEqual(oldFrame.getSP())) {
+ // Frame points to itself or to a location in the wrong direction.
+ // Break the loop and move on to next offset.
+ if (DEBUG) {
+ System.out.println("X86CurrentFrameGuess.run: frame <= oldFrame: " + frame);
+ }
+ break;
+ }
}
} catch (Exception e) {
if (DEBUG) {
--- a/test/hotspot/jtreg/ProblemList.txt Wed Nov 13 11:34:31 2019 -0800
+++ b/test/hotspot/jtreg/ProblemList.txt Wed Nov 13 13:05:16 2019 -0800
@@ -108,7 +108,7 @@
serviceability/sa/ClhsdbJdis.java 8193639 solaris-all
serviceability/sa/ClhsdbJhisto.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbJstack.java 8193639 solaris-all
-serviceability/sa/ClhsdbJstackXcompStress.java 8193639,8231635 solaris-all,windows-x64
+serviceability/sa/ClhsdbJstackXcompStress.java 8193639 solaris-all
serviceability/sa/ClhsdbLongConstant.java 8193639 solaris-all
serviceability/sa/ClhsdbPmap.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbPrintAll.java 8193639 solaris-all