JDK-6463096 : icache invalidation code can segv
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-08-23
  • Updated: 2012-10-08
  • Resolved: 2006-11-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.
Other JDK 6 JDK 7 Other
1.4.2_14,hs10Fixed 6u1Fixed 7Fixed hs10Fixed
Description
The code to invalidate a word (defined to be 4 bytes) in the icache in icache.cpp
can segv if

1. The word is the last word in it's line.

2. The line is the last one in its mapped memory segment (e.g., the code cache).

The bad code is in

void AbstractICache::invalidate_word(address addr) {
  // Because this is called for instruction patching on the fly,
  // long after bootstrapping, we execute the stub directly.
  // Account for a 4-byte word spanning two cache lines.
  intptr_t start_line = ((intptr_t)addr + 0) & ~(ICache::line_size - 1);
  intptr_t end_line   = ((intptr_t)addr + 4) & ~(ICache::line_size - 1);
  (*_flush_icache_stub)((address)start_line, start_line == end_line ? 1 : 2, 0);
}

'4' should be '3'.

Comments
EVALUATION Ok.
23-08-2006

SUGGESTED FIX See Description.
23-08-2006