[parisc-linux] Re: [parisc-linux-cvs] linux-2.6 carlos

Carlos O'Donell carlos at baldric.uwo.ca
Wed Dec 10 18:03:40 MST 2003


On Wed, Dec 10, 2003 at 03:40:26PM -0700, Carlos O'Donell wrote:
> CVSROOT:	/var/cvs
> Module name:	linux-2.6
> Changes by:	carlos	03/12/10 15:40:25
> 
> Modified files:
> 	include/asm-parisc: compat.h rt_sigframe.h siginfo.h ucontext.h 
> 
> Log message:
> Cleanup for non-native thread signals, and ensure that during 64-bit builds everything works too.

You may have noticed the following:

  8 #define SIGRETURN_TRAMP 4
  9 #define SIGRESTARTBLOCK_TRAMP 5 
 10 #define TRAMP_SIZE (SIGRETURN_TRAMP + SIGRESTARTBLOCK_TRAMP)
 11 
 12 struct rt_sigframe {
 13         /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c 
 14                 Secondary to that it must protect the ERESTART_RESTARTBLOCK
 15                 trampoline we left on the stack (we were bad and didn't 
 16                 change sp so we could run really fast.) */
 17         unsigned int tramp[TRAMP_SIZE];
 18         struct siginfo info;
 19         struct ucontext uc;
 20 };

And wondered "Why do people write XXX: followed by some scary sounding
stuff?" Here is the part where we clarify what this means.

When Randolph wrote the ERESTART_RESTARTBLOCK code he used a stack
trampoline to rewrite the syscall entry into the kernel with a different
syscall number. This stack trampoline is *unprotected* and the stack
pointer is not adjusted.

If one were to take a signal while executing the ERESTART_RESTARTBLOCK
stack trampoline the signal's frame would destroy the trampoline. Instead
we *notch* 5 more words out of the front of the signal frame to protect a
possible ERESTART_RESTARTBLOCK trampoline. The signal code used to do
exactly the same thing before, it had it's own notch for the sigreturn
trampoline on the stack. Thus now we protect both trampolines.

What if you took another ERESTART_RESTARTBLOCK signal while walking the
last ERESTART_RESTARTBLOCK trampoline? Well that scenario isn't allowed
to happen, and according to Linux we have to disable
ERESTART_RESTARTBLOCK until we are back in the kernel handling the
restart. We still haven't fixed this last bit.

c.




More information about the parisc-linux mailing list