summaryrefslogtreecommitdiffstats
path: root/kernel/rseq.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-27 15:39:40 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-27 15:39:40 +0200
commit20ac422c8ef753ae0da0c9312443b03c37cfbb5b (patch)
tree6476e9fa2504a002b105367007dcb6abc3391b96 /kernel/rseq.c
parent54fa156bb33ad06077ec709dc2331a4d5ee446f3 (diff)
parent5816b3e6577eaa676ceb00a848f0fd65fe2adc29 (diff)
downloadlinux-20ac422c8ef753ae0da0c9312443b03c37cfbb5b.tar.bz2
Merge 5.15-rc3 into char-misc next
We need the char/misc fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/rseq.c')
-rw-r--r--kernel/rseq.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/rseq.c b/kernel/rseq.c
index 35f7bd0fced0..6d45ac3dae7f 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -282,9 +282,17 @@ void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs)
if (unlikely(t->flags & PF_EXITING))
return;
- ret = rseq_ip_fixup(regs);
- if (unlikely(ret < 0))
- goto error;
+
+ /*
+ * regs is NULL if and only if the caller is in a syscall path. Skip
+ * fixup and leave rseq_cs as is so that rseq_sycall() will detect and
+ * kill a misbehaving userspace on debug kernels.
+ */
+ if (regs) {
+ ret = rseq_ip_fixup(regs);
+ if (unlikely(ret < 0))
+ goto error;
+ }
if (unlikely(rseq_update_cpu_id(t)))
goto error;
return;