Commit e50c5d2e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'core-rseq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull rseq updates from Ingo Molnar:
 "A cleanup and a fix to comments"

* 'core-rseq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  rseq: Remove superfluous rseq_len from task_struct
  rseq: Clean up comments by reflecting removal of event counter
parents 5ba2a4b1 83b0b15b
...@@ -549,8 +549,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) ...@@ -549,8 +549,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
int ret; int ret;
/* /*
* Increment event counter and perform fixup for the pre-signal * Perform fixup for the pre-signal frame.
* frame.
*/ */
rseq_signal_deliver(ksig, regs); rseq_signal_deliver(ksig, regs);
......
...@@ -693,10 +693,7 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs) ...@@ -693,10 +693,7 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
sigset_t *set = sigmask_to_save(); sigset_t *set = sigmask_to_save();
compat_sigset_t *cset = (compat_sigset_t *) set; compat_sigset_t *cset = (compat_sigset_t *) set;
/* /* Perform fixup for the pre-signal frame. */
* Increment event counter and perform fixup for the pre-signal
* frame.
*/
rseq_signal_deliver(ksig, regs); rseq_signal_deliver(ksig, regs);
/* Set up the stack frame */ /* Set up the stack frame */
......
...@@ -1057,7 +1057,6 @@ struct task_struct { ...@@ -1057,7 +1057,6 @@ struct task_struct {
#ifdef CONFIG_RSEQ #ifdef CONFIG_RSEQ
struct rseq __user *rseq; struct rseq __user *rseq;
u32 rseq_len;
u32 rseq_sig; u32 rseq_sig;
/* /*
* RmW on rseq_event_mask must be performed atomically * RmW on rseq_event_mask must be performed atomically
...@@ -1855,12 +1854,10 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) ...@@ -1855,12 +1854,10 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
{ {
if (clone_flags & CLONE_THREAD) { if (clone_flags & CLONE_THREAD) {
t->rseq = NULL; t->rseq = NULL;
t->rseq_len = 0;
t->rseq_sig = 0; t->rseq_sig = 0;
t->rseq_event_mask = 0; t->rseq_event_mask = 0;
} else { } else {
t->rseq = current->rseq; t->rseq = current->rseq;
t->rseq_len = current->rseq_len;
t->rseq_sig = current->rseq_sig; t->rseq_sig = current->rseq_sig;
t->rseq_event_mask = current->rseq_event_mask; t->rseq_event_mask = current->rseq_event_mask;
} }
...@@ -1869,7 +1866,6 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) ...@@ -1869,7 +1866,6 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
static inline void rseq_execve(struct task_struct *t) static inline void rseq_execve(struct task_struct *t)
{ {
t->rseq = NULL; t->rseq = NULL;
t->rseq_len = 0;
t->rseq_sig = 0; t->rseq_sig = 0;
t->rseq_event_mask = 0; t->rseq_event_mask = 0;
} }
......
...@@ -254,8 +254,7 @@ static int rseq_ip_fixup(struct pt_regs *regs) ...@@ -254,8 +254,7 @@ static int rseq_ip_fixup(struct pt_regs *regs)
* - signal delivery, * - signal delivery,
* and return to user-space. * and return to user-space.
* *
* This is how we can ensure that the entire rseq critical section, * This is how we can ensure that the entire rseq critical section
* consisting of both the C part and the assembly instruction sequence,
* will issue the commit instruction only if executed atomically with * will issue the commit instruction only if executed atomically with
* respect to other threads scheduled on the same CPU, and with respect * respect to other threads scheduled on the same CPU, and with respect
* to signal handlers. * to signal handlers.
...@@ -314,7 +313,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, ...@@ -314,7 +313,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
/* Unregister rseq for current thread. */ /* Unregister rseq for current thread. */
if (current->rseq != rseq || !current->rseq) if (current->rseq != rseq || !current->rseq)
return -EINVAL; return -EINVAL;
if (current->rseq_len != rseq_len) if (rseq_len != sizeof(*rseq))
return -EINVAL; return -EINVAL;
if (current->rseq_sig != sig) if (current->rseq_sig != sig)
return -EPERM; return -EPERM;
...@@ -322,7 +321,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, ...@@ -322,7 +321,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
if (ret) if (ret)
return ret; return ret;
current->rseq = NULL; current->rseq = NULL;
current->rseq_len = 0;
current->rseq_sig = 0; current->rseq_sig = 0;
return 0; return 0;
} }
...@@ -336,7 +334,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, ...@@ -336,7 +334,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
* the provided address differs from the prior * the provided address differs from the prior
* one. * one.
*/ */
if (current->rseq != rseq || current->rseq_len != rseq_len) if (current->rseq != rseq || rseq_len != sizeof(*rseq))
return -EINVAL; return -EINVAL;
if (current->rseq_sig != sig) if (current->rseq_sig != sig)
return -EPERM; return -EPERM;
...@@ -354,7 +352,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, ...@@ -354,7 +352,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
if (!access_ok(rseq, rseq_len)) if (!access_ok(rseq, rseq_len))
return -EFAULT; return -EFAULT;
current->rseq = rseq; current->rseq = rseq;
current->rseq_len = rseq_len;
current->rseq_sig = sig; current->rseq_sig = sig;
/* /*
* If rseq was previously inactive, and has just been * If rseq was previously inactive, and has just been
......
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