|
@@ -115,19 +115,20 @@ static int rseq_reset_rseq_cpu_id(struct task_struct *t)
|
|
|
static int rseq_get_rseq_cs(struct task_struct *t, struct rseq_cs *rseq_cs)
|
|
|
{
|
|
|
struct rseq_cs __user *urseq_cs;
|
|
|
- unsigned long ptr;
|
|
|
+ u64 ptr;
|
|
|
u32 __user *usig;
|
|
|
u32 sig;
|
|
|
int ret;
|
|
|
|
|
|
- ret = get_user(ptr, &t->rseq->rseq_cs);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
+ if (copy_from_user(&ptr, &t->rseq->rseq_cs.ptr64, sizeof(ptr)))
|
|
|
+ return -EFAULT;
|
|
|
if (!ptr) {
|
|
|
memset(rseq_cs, 0, sizeof(*rseq_cs));
|
|
|
return 0;
|
|
|
}
|
|
|
- urseq_cs = (struct rseq_cs __user *)ptr;
|
|
|
+ if (ptr >= TASK_SIZE)
|
|
|
+ return -EINVAL;
|
|
|
+ urseq_cs = (struct rseq_cs __user *)(unsigned long)ptr;
|
|
|
if (copy_from_user(rseq_cs, urseq_cs, sizeof(*rseq_cs)))
|
|
|
return -EFAULT;
|
|
|
|
|
@@ -203,7 +204,9 @@ static int clear_rseq_cs(struct task_struct *t)
|
|
|
*
|
|
|
* Set rseq_cs to NULL.
|
|
|
*/
|
|
|
- return put_user(0UL, &t->rseq->rseq_cs);
|
|
|
+ if (clear_user(&t->rseq->rseq_cs.ptr64, sizeof(t->rseq->rseq_cs.ptr64)))
|
|
|
+ return -EFAULT;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/*
|