kernel panic during kernel module load (powerpc specific part)

Wrobel Heinz-R39252 r39252 at
Fri Jun 1 21:33:37 EST 2012

> > I believe that the basic premise is that you should provide a directly
> > reachable copy of the save/rstore functions, even if this means that
> you need several copies of the functions.
> I just fixed a very similar problem with grub2 in fact. It was using r0
> and trashing the saved LR that way.
> The real fix is indeed to statically link those gcc "helpers", we
> shouldn't generate things like cross-module calls inside function prologs
> and epilogues, when stackframes aren't even guaranteed to be reliable.
> However, in the grub2 case, it was easier to just use r12 :-)

For not just the module loading case, I believe r12 is the only real solution now. I checked one debugger capable of doing ELF download. It also uses r12 for trampoline code. I am guessing for the reason that prompted this discussion.

Without r12 we'd have to change standard libraries to automagically link in gcc helpers for any conceivable non-.text section, which I am not sure is feasible. How would you write section independent helper functions which link to any section needing them?!
Asking users to create their own section specific copy of helper functions is definitely not portable if the module or other code is not architecture dependent.
It is a normal gcc feature that you can assign specific code to non-.text sections and it is not documented that it may crash depending on the OS arch the ELF is built for, so asking for a Power Architecture specific change on tool libs to make Power Architecture Linux happy seems a bit much to ask.

Using r12 in any Linux related trampoline code seems a reachable goal, and it would eliminate the conflict to the ABI.



More information about the Linuxppc-dev mailing list