JDK-8273373 : Zero: Cannot invoke JVM in primordial threads on Zero
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11,17,18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-09-06
  • Updated: 2021-10-05
  • Resolved: 2021-09-14
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.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 18
11.0.14Fixed 17.0.2Fixed 18 b15Fixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Description
Running current Zero with gtests:

$ CONF=linux-x86_64-zero-fastdebug make exploded-test TEST=jtreg:gtest/

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/shade/trunks/jdk/src/hotspot/os/linux/os_linux.cpp:3227), pid=562477, tid=562477
#  assert(imin <= imax) failed: Unexpected page size

The actual problem is underflow in os::pd_create_stack_guard_pages() here:

stack_extent = (uintptr_t) get_stack_commited_bottom(
os::Linux::initial_thread_stack_bottom(),
(size_t)addr - stack_extent);

For Zero x86_64, these are off by a page, so the (addr - stack_extent) underflows, then get_stack_commited_bottom gets called with super-large size, which then fails the assert above. The assert should check for underflow specifically.

[0.002s][warning][os] Addr: 0x00007fff35e73000, stack_extent: 0x00007fff35e74000

I believe the root cause is primordial thread (which is why it is only seen in gtests?) having a weird stack base, which is explicitly handled by the shared code commonned by JDK-8169373. I see little reason not to use the same code for Zero. There is the IA64 block in Zero version that handles the double stack on Itanium, but I think we can sacrifice it since Itanium is discontinued.
Comments
Fix Request (11u) Same reason as for 17u.
04-10-2021

Fix Request (17u) This fixes the gtests and other tests running Zero in primordial threads. Patch applies cleanly, tests start to pass.
01-10-2021

Changeset: 0f31d0fb Author: Aleksey Shipilev <shade@openjdk.org> Date: 2021-09-14 15:49:00 +0000 URL: https://git.openjdk.java.net/jdk/commit/0f31d0fb2c0d5db305e75e1d61bcc44de3e77839
14-09-2021