Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

From
Edgecombe, Rick P <rick.p.edgecombe@intel.com>
Date
2024-05-07 17:35:58
Also in
bpf, linux-api, linux-man, lkml
Reply to
Jiri Olsa, 2024-05-07
On Tue, 2024-05-07 at 12:53 +0200, Jiri Olsa wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index 81e6ee95784d..ae6c3458a675 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -406,6 +406,11 @@ SYSCALL_DEFINE0(uretprobe)
         * trampoline's ret instruction
         */
        r11_cx_ax[2] = regs->ip;
+
+       /* make the shadow stack follow that */
+       if (shstk_push_frame(regs->ip))
+               goto sigill;
+
        regs->ip = ip;
 
Per the earlier discussion, this cannot be reached unless uretprobes are in use,
which cannot happen without something with privileges taking an action. But are
uretprobes ever used for monitoring applications where security is important? Or
is it strictly a debug-time thing?
Thread (32 messages) 32 messages, 7 authors, last reply 2024-05-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help