Skip to content

Commit 4bfb8c5

Browse files
Al Viroralfbaechle
authored andcommitted
MIPS: do_sigaltstack() expects userland pointers
o32 compat does the right thing, native and n32 compat do not... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: http://patchwork.linux-mips.org/patch/1700/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 5b89c00 commit 4bfb8c5

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎arch/mips/kernel/signal.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
390390
{
391391
struct rt_sigframe __user *frame;
392392
sigset_t set;
393-
stack_t st;
394393
int sig;
395394

396395
frame = (struct rt_sigframe __user *) regs.regs[29];
@@ -411,11 +410,9 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
411410
else if (sig)
412411
force_sig(sig, current);
413412

414-
if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
415-
goto badframe;
416413
/* It is more difficult to avoid calling this function than to
417414
call it and ignore errors. */
418-
do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
415+
do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]);
419416

420417
/*
421418
* Don't let your children do this ...

‎arch/mips/kernel/signal_n32.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
109109
asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
110110
{
111111
struct rt_sigframe_n32 __user *frame;
112+
mm_segment_t old_fs;
112113
sigset_t set;
113114
stack_t st;
114115
s32 sp;
@@ -143,7 +144,11 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
143144

144145
/* It is more difficult to avoid calling this function than to
145146
call it and ignore errors. */
147+
old_fs = get_fs();
148+
set_fs(KERNEL_DS);
146149
do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
150+
set_fs(old_fs);
151+
147152

148153
/*
149154
* Don't let your children do this ...

0 commit comments

Comments
 (0)