Commit 4f7dcde5 authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

[PATCH] PPC64: fix stack alignment for signal handlers

The PPC64 ABI specifies that the stack should be kept aligned to 16
bytes.  However, signal handlers on PPC64 are getting run with the stack
misaligned (sp % 16 == 8).  This patch fixes that by ensuring that the
signal frame allocated is a multiple of 16 bytes.

In addition to the PPC64 signal frame itself being of misaligned size,
the explicit alignment of the starting stack pointer is also to 8
instead of 16.  I've corrected this as well, so signal frames are
aligned even if the interrupted registers contained a misaligned stack
pointer. 
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>

[ Paul Mackerras <paulus@samba.org> acked the original patch (which
  also did it for the 32-bit cases), and pointed out that the 32-bit
  cases all already did the alignment elsewhere and didn't need this.
  Patch edited down accordingly. ]
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a2f97129
......@@ -67,7 +67,7 @@ struct rt_sigframe {
struct siginfo info;
/* 64 bit ABI allows for 288 bytes below sp before decrementing it. */
char abigap[288];
};
} __attribute__ ((aligned (16)));
/*
......@@ -254,7 +254,7 @@ static inline void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs
newsp = (current->sas_ss_sp + current->sas_ss_size);
}
return (void __user *)((newsp - frame_size) & -8ul);
return (void __user *)((newsp - frame_size) & -16ul);
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment