Trampoline back-patching doesn't invalidate icache on code cross-modification
Reported by Tomek Grabiec | April 15th, 2009 @ 11:15 PM
Jato patches relative calls (fun. fixup_invoke) calling a trampoline so that they call method native code directly. This may cause problems in some multiprocessor systems because of bugs existing in some CPUs. See the Intel erratum (download.intel.com/design/processor/specupdt/318733.pdf) for description of a bug: "AW75.Unsynchronized Cross-Modifying Code Operations Can Cause Unexpected Instruction Execution Results". If cpu0 modifies instruction already fetched by cpu1, a General Protection Fault may be generated if cpu1 does not execute a serializing instruction before execution of modified instruction.
Solution proposal: When code patching is about to be done, all other threads are suspended. When modifications are done, suspended threads are resumed and they execute a serializing instruction (eg. CPUID) before they leave the suspension handler.
Comments and changes to this ticket
-

Pekka Enberg April 23rd, 2009 @ 04:23 PM
- → Title changed from lack of icache invalidation on code cross-modyfication to Trampoline back-patching doesn't invalidate icache on code cross-modification
-

Pekka Enberg April 29th, 2009 @ 12:15 PM
I've attached a proof-of-concept implementation of the polling page part of safepoints.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Jato is a Java virtual machine implementation with a Just-in-time (JIT) compiler.