aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rseq.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/rseq.c')
-rw-r--r--kernel/rseq.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/rseq.c b/kernel/rseq.c
index 25e9a7b60eba..9424ee90589e 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -254,8 +254,7 @@ static int rseq_ip_fixup(struct pt_regs *regs)
254 * - signal delivery, 254 * - signal delivery,
255 * and return to user-space. 255 * and return to user-space.
256 * 256 *
257 * This is how we can ensure that the entire rseq critical section, 257 * This is how we can ensure that the entire rseq critical section
258 * consisting of both the C part and the assembly instruction sequence,
259 * will issue the commit instruction only if executed atomically with 258 * will issue the commit instruction only if executed atomically with
260 * respect to other threads scheduled on the same CPU, and with respect 259 * respect to other threads scheduled on the same CPU, and with respect
261 * to signal handlers. 260 * to signal handlers.
@@ -314,7 +313,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
314 /* Unregister rseq for current thread. */ 313 /* Unregister rseq for current thread. */
315 if (current->rseq != rseq || !current->rseq) 314 if (current->rseq != rseq || !current->rseq)
316 return -EINVAL; 315 return -EINVAL;
317 if (current->rseq_len != rseq_len) 316 if (rseq_len != sizeof(*rseq))
318 return -EINVAL; 317 return -EINVAL;
319 if (current->rseq_sig != sig) 318 if (current->rseq_sig != sig)
320 return -EPERM; 319 return -EPERM;
@@ -322,7 +321,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
322 if (ret) 321 if (ret)
323 return ret; 322 return ret;
324 current->rseq = NULL; 323 current->rseq = NULL;
325 current->rseq_len = 0;
326 current->rseq_sig = 0; 324 current->rseq_sig = 0;
327 return 0; 325 return 0;
328 } 326 }
@@ -336,7 +334,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
336 * the provided address differs from the prior 334 * the provided address differs from the prior
337 * one. 335 * one.
338 */ 336 */
339 if (current->rseq != rseq || current->rseq_len != rseq_len) 337 if (current->rseq != rseq || rseq_len != sizeof(*rseq))
340 return -EINVAL; 338 return -EINVAL;
341 if (current->rseq_sig != sig) 339 if (current->rseq_sig != sig)
342 return -EPERM; 340 return -EPERM;
@@ -354,7 +352,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
354 if (!access_ok(rseq, rseq_len)) 352 if (!access_ok(rseq, rseq_len))
355 return -EFAULT; 353 return -EFAULT;
356 current->rseq = rseq; 354 current->rseq = rseq;
357 current->rseq_len = rseq_len;
358 current->rseq_sig = sig; 355 current->rseq_sig = sig;
359 /* 356 /*
360 * If rseq was previously inactive, and has just been 357 * If rseq was previously inactive, and has just been