Thread (27 messages) 27 messages, 7 authors, 2024-05-07

Re: [PATCHv4 bpf-next 2/7] uprobe: Add uretprobe syscall to speed up return probe

From: Deepak Gupta <hidden>
Date: 2024-05-03 23:01:57
Also in: bpf, linux-api, linux-man, lkml

On Fri, May 03, 2024 at 07:38:18PM +0000, Edgecombe, Rick P wrote:
+Some more shadow stack folks from other archs. We are discussing how uretprobes
work with shadow stack.

Context:
https://lore.kernel.org/lkml/ZjU4ganRF1Cbiug6@krava/ (local)
Thanks Rick.

Yeah I didn't give enough attention to uprobes either.
Although now that I think for RISC-V shadow stack, it shouldn't be an issue.
On RISC-V return addresses don't get pushed as part of call instruction.
There is a distinct instruction "shadow stack push of return address" in prolog.
Similarly in epilog there is distinct instruction "shadow stack pop and check with
link register".

On RISC-V, uretprobe would install a uprobe on function start and when it's hit.
It'll replace pt_regs->ra = trampoline_handler. As function will resume, trampoline
addr will get pushed and popped. Although trampoline_handler would have to be enlightened
to eventually return to original return site.
On Fri, 2024-05-03 at 21:18 +0200, Jiri Olsa wrote:
quoted
hack below seems to fix it for the current uprobe setup,
we need similar fix for the uretprobe syscall trampoline setup
It seems like a reasonable direction.

Security-wise, applications cannot do this on themselves, or it is an otherwise
privileged thing right?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help