While working with some kprobe unit test, I stumbled across some wacky
behavior that the below module exposes.
If you build and install this module, you can run tc1 (the working case)
by doing a "cat /proc/run_tc1". You can then run the broken case by
doing a "cat /proc/run_tc2".
When the module is installed a kprobe with a pre_handler that increments
a global counter is registered for a target function.
When the tescase is run it stores the current value of the global counter,
calls a simple function (the target function that has been armed with a
kprobe) that just returns the value of the global counter, and then the
testcase verifies that the returned value has incremented (thanks to the
kprobe.)
By adding a simple printk("peep\n"); to the target function, the effects
of the pre_handler on the global counter are lost.
Can someone else verify they see this behavior? I see the bug on both i386
and x86_64 FC3 systems, but not on my ia64 REL4 system.