Commit 9ac89901 authored by Russell King's avatar Russell King

[ARM] Check access permissions for whole of signal stack frame.

We really need to check that we have access to the whole of the
signal frame when we allocate it, rather than "most of it" when
we have iWMMXt extensions selected.
parent c6d508b9
...@@ -409,6 +409,7 @@ static inline void __user * ...@@ -409,6 +409,7 @@ static inline void __user *
get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize) get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
{ {
unsigned long sp = regs->ARM_sp; unsigned long sp = regs->ARM_sp;
void __user *frame;
#ifdef CONFIG_IWMMXT #ifdef CONFIG_IWMMXT
if (test_thread_flag(TIF_USING_IWMMXT)) if (test_thread_flag(TIF_USING_IWMMXT))
...@@ -424,7 +425,15 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize) ...@@ -424,7 +425,15 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
/* /*
* ATPCS B01 mandates 8-byte alignment * ATPCS B01 mandates 8-byte alignment
*/ */
return (void __user *)((sp - framesize) & ~7); frame = (void __user *)((sp - framesize) & ~7);
/*
* Check that we can actually write to the signal frame.
*/
if (!access_ok(VERIFY_WRITE, frame, framesize))
frame = NULL;
return frame;
} }
static int static int
...@@ -493,7 +502,7 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg ...@@ -493,7 +502,7 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg
struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
int err = 0; int err = 0;
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) if (!frame)
return 1; return 1;
err |= setup_sigcontext(&frame->sc, /*&frame->fpstate,*/ regs, set->sig[0]); err |= setup_sigcontext(&frame->sc, /*&frame->fpstate,*/ regs, set->sig[0]);
...@@ -522,7 +531,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, ...@@ -522,7 +531,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
stack_t stack; stack_t stack;
int err = 0; int err = 0;
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) if (!frame)
return 1; return 1;
__put_user_error(&frame->info, &frame->pinfo, err); __put_user_error(&frame->info, &frame->pinfo, err);
......
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