This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug kprobes/2071] Probes on ISR with probes on task thread's prehandler crash the system


------- Additional Comments From mhiramat at redhat dot com  2008-01-17 21:56 -------
As the result of investigation, I found a bug in restore_previous_kprobe().
This function and save_previous_kprobe() do FILO(stack) operation. 
These functions work as like below;

save_previous_kprobe() // this pushes a value to stack
{
i = ++index;
stack[i-1] = val;
}

restore_previous_kprobe() // this pops a value from stack
{
i = --index;    // (a)
val = stack[i]; // (b)
}

However, if an interrupt occurs between (a) and (b), and a kprobe
is hit in that interrupt, this overwrites previous stack[] entry.

restore_previous_kprobe() // this pops a value from stack
{
i = --index;    // (a) (i == 0, index == 0)
--(interrupt)
	save_previous_kprobe() // this pushes a value to stack
	{
	i = ++index; (i == 1, index == 1)
	stack[i-1] = val2; (!!overwrite stack[0]!!)
	}
	restore_previous_kprobe() // this pops a value from stack
	{
	i = --index; (i == 0, index == 0)
	val2 = stack[i]; (stack[0] == val2)
	}
--
val = stack[i]; // (b) (val = val2)
}

Thus, the index must be decremented AFTER reading the value.

restore_previous_kprobe() // this pops a value from stack
{
i = index;
val = stack[i-1];
--index;
}

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2071

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]