#2 new
Tomek Grabiec

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

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.

New-ticket Create new ticket

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.

People watching this ticket

Attachments