diff options
| -rw-r--r-- | arch/x86/kernel/signal.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 53425c681f2b..dde3f2ae2371 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
| @@ -191,6 +191,20 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, | |||
| 191 | /* | 191 | /* |
| 192 | * Determine which stack to use.. | 192 | * Determine which stack to use.. |
| 193 | */ | 193 | */ |
| 194 | static unsigned long align_sigframe(unsigned long sp) | ||
| 195 | { | ||
| 196 | #ifdef CONFIG_X86_32 | ||
| 197 | /* | ||
| 198 | * Align the stack pointer according to the i386 ABI, | ||
| 199 | * i.e. so that on function entry ((sp + 4) & 15) == 0. | ||
| 200 | */ | ||
| 201 | sp = ((sp + 4) & -16ul) - 4; | ||
| 202 | #else /* !CONFIG_X86_32 */ | ||
| 203 | sp = round_down(sp, 16) - 8; | ||
| 204 | #endif | ||
| 205 | return sp; | ||
| 206 | } | ||
| 207 | |||
| 194 | static inline void __user * | 208 | static inline void __user * |
| 195 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, | 209 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, |
| 196 | void __user **fpstate) | 210 | void __user **fpstate) |
| @@ -236,18 +250,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, | |||
| 236 | return (void __user *)-1L; | 250 | return (void __user *)-1L; |
| 237 | } | 251 | } |
| 238 | 252 | ||
| 239 | sp -= frame_size; | 253 | return (void __user *)align_sigframe(sp - frame_size); |
| 240 | #ifdef CONFIG_X86_32 | ||
| 241 | /* | ||
| 242 | * Align the stack pointer according to the i386 ABI, | ||
| 243 | * i.e. so that on function entry ((sp + 4) & 15) == 0. | ||
| 244 | */ | ||
| 245 | sp = ((sp + 4) & -16ul) - 4; | ||
| 246 | #else /* !CONFIG_X86_32 */ | ||
| 247 | sp = round_down(sp, 16) - 8; | ||
| 248 | #endif | ||
| 249 | |||
| 250 | return (void __user *) sp; | ||
| 251 | } | 254 | } |
| 252 | 255 | ||
| 253 | #ifdef CONFIG_X86_32 | 256 | #ifdef CONFIG_X86_32 |
