Thread (32 messages) 32 messages, 7 authors, 2024-05-21

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

From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Date: 2024-05-21 01:31:58
Also in: bpf, linux-man, linux-trace-kernel, lkml

On Mon, 2024-05-20 at 00:18 +0200, Jiri Olsa wrote:
anyway I think we can fix that in another way by using the optimized
trampoline,
but returning to the user space through iret when shadow stack is detected
(as I did in the first version, before you adjusted it to the sysret path).

we need to update the return address on stack only when returning through the
trampoline, but we can jump to original return address directly from syscall
through iret.. which is slower, but with shadow stack we don't care

basically the only change is adding the shstk_is_enabled check to the
following condition in SYSCALL_DEFINE0(uretprobe):

        if (regs->sp != sp || shstk_is_enabled())
                return regs->ax;
On the surface it sounds reasonable. Thanks.

And then I guess if tradeoffs are seen differently in the future, and we want to
enable the fast path for shadow stack we can go with your other solution. So
this just simply fixes things functionally without much code.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help