aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rseq.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-27 16:45:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-27 16:45:36 +0200
commit9b40e16ee51a0e9255cd2571c76b1c8a0b504c74 (patch)
treefc2226242e187d1827398bd527b9a795e3458ff9 /kernel/rseq.c
parentstaging; wlan-ng: remove duplicate USB device ID (diff)
parentLinux 5.15-rc3 (diff)
Merge branch 5.15-rc3 into staging-next
We need the fixes in here, and it resolves a merge issue with drivers/staging/r8188eu/os_dep/ioctl_linux.c Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> 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;