On Tue, May 21, 2024 at 01:31:53AM +0000, Edgecombe, Rick P wrote:
On Mon, 2024-05-20 at 00:18 +0200, Jiri Olsa wrote:
quoted
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.
yes, if we want to enable the fast path for shadow stack in future
we'll need to remove that shstk_is_enabled and push extra frame on
shadow stack
jirka