Thread (9 messages) 9 messages, 3 authors, 10d ago

Re: [PATCH 1/2] x86/uprobes: Keep shadow stack in sync for emulated CALLs

From: Peter Zijlstra <peterz@infradead.org>
Date: 2026-06-23 12:57:33
Also in: linux-kselftest, lkml

On Tue, Jun 23, 2026 at 02:52:32PM +0200, Oleg Nesterov wrote:
On 06/22, David Windsor wrote:
quoted
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -1246,8 +1246,12 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs
 		long correction = utask->vaddr - utask->xol_vaddr;
 		regs->ip += correction;
 	} else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) {
+		unsigned long retaddr = utask->vaddr + auprobe->defparam.ilen;
+
 		regs->sp += sizeof_long(regs); /* Pop incorrect return address */
-		if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen))
+		if (emulate_push_stack(regs, retaddr))
+			return -ERESTART;
+		if (shstk_update_last_frame(retaddr))
 			return -ERESTART;
Well, if shstk_update_last_frame() fails after emulate_push_stack(), we should
probably return another error, so that the caller handle_singlestep() will kill
this task?
Makes sense, the other user has a force_sig(SIGSEGV) on failure.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help