From: Chris Friesen <hidden> Date: 2007-07-26 19:38:12
Hi all,
I'm porting kprobes to 2.6.14, and I think I've got it mostly done. The
last thing that I want to do is to mark flush_icache_range() as part of
the .kprobes.text section so that we don't accidently try to probe it.
On ppc64 this was done by duplicating the _GLOBAL macro and just
modifying the ".section" line.
Unfortunately for me, ppc doesn't have a ".section" line in that macro,
so I'm at a bit of a loss.
Anyone got any suggestions, or pointers on where I could read up on it?
Chris
From: Grant Likely <hidden> Date: 2007-07-26 19:55:36
On 7/26/07, Chris Friesen [off-list ref] wrote:
Hi all,
I'm porting kprobes to 2.6.14, and I think I've got it mostly done. The
last thing that I want to do is to mark flush_icache_range() as part of
the .kprobes.text section so that we don't accidently try to probe it.
Hey Chris,
Mild question; What the *@*#^$! are you doing trying to backport to a
2 year old kernel?!? :-)
On ppc64 this was done by duplicating the _GLOBAL macro and just
modifying the ".section" line.
Unfortunately for me, ppc doesn't have a ".section" line in that macro,
so I'm at a bit of a loss.
Just add the section. Should be trivial to do. You might have to add
it to the linker script as well.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Chris Friesen <hidden> Date: 2007-07-27 18:56:04
Grant Likely wrote:
Mild question; What the *@*#^$! are you doing trying to backport to a
2 year old kernel?!? :-)
That's what happens in the embedded space. It's the current version
from our distro vendor. It's also the version that all our different
board suppliers could agree to provide support for.
Of course, it's also a royal pain.
quoted
Unfortunately for me, ppc doesn't have a ".section" line in that macro,
so I'm at a bit of a loss.
Just add the section. Should be trivial to do. You might have to add
it to the linker script as well.
I've done the linker script part already. As for the processor.h bit,
does this seem reasonable? It seems to do the trick based on the
function addresses, but I may be missing something and I haven't
actually booted it yet.
The ppc64 version appends ',"a"' to the kprobes.text section line. Is
this needed here as well? Could someone elaborate on exactly what its
purpose is?
Thanks,
Chris
Index: linux-ias/include/asm-ppc/processor.h
===================================================================
The ppc64 version appends ',"a"' to the kprobes.text section line. Is
this needed here as well? Could someone elaborate on exactly what its
purpose is?
It's the (ELF) section attributes for the section. If this
is executable code, it should be "ax"; if it's writable, it
should be "wa"; if it's not initialised, it should be "".
If the section name followed the normal naming conventions,
(newer) GCC could figure out the section attributes itself;
but then, ".text.kprobes" would imply executable, maybe the
section is really misnamed? Or maybe you need the "ax"
flags :-)
Segher
From: Chris Friesen <hidden> Date: 2007-08-08 16:24:35
Well, I've played around with the sections a bit more, and just can't
seem to get it to work. As soon as I apply the following, the kernel
refuses to boot. (And if I remove the changes to _GLOBAL, then it
refuses to boot if I enable CONFIG_KPROBES.)
Index: linux/include/asm-ppc/processor.h
===================================================================
Based on Segher's comments I tried changing it to:
+ .section ".text","ax"; \
but that didn't work either.
Anyone else got any suggestions on how I might force
flush_icache_range() into a ".kprobes.text" section?
Chris