Thread (148 messages) 148 messages, 17 authors, 2022-06-09

Re: [PATCH 00/35] Shadow stacks for userspace

From: Mike Rapoport <rppt@kernel.org>
Date: 2022-02-28 21:30:52
Also in: linux-api, linux-arch, linux-mm, lkml

On Mon, Feb 28, 2022 at 12:30:41PM -0800, Andy Lutomirski wrote:

On Mon, Feb 28, 2022, at 12:27 PM, Mike Rapoport wrote:
quoted
On Wed, Feb 09, 2022 at 06:37:53PM -0800, Andy Lutomirski wrote:
quoted
On 2/8/22 18:18, Edgecombe, Rick P wrote:
quoted
On Tue, 2022-02-08 at 20:02 +0300, Cyrill Gorcunov wrote:
Even with the current shadow stack interface Rick proposed, CRIU can restore
the victim using ptrace without any additional knobs, but we loose an
important ability to "self-cure" the victim from the parasite in case
anything goes wrong with criu control process.

Moreover, the issue with backward compatibility is not with ptrace but with
sigreturn and it seems that criu is not its only user.
So we need an ability for a tracer to cause the tracee to call a function
and to return successfully.  Apparently a gdb branch can already do this
with shstk, and my PTRACE_CALL_FUNCTION_SIGFRAME should also do the
trick.  I don't see why we need a sigretur-but-dont-verify -- we just
need this mechanism to create a frame such that sigreturn actually works.
If I understand correctly, PTRACE_CALL_FUNCTION_SIGFRAME() injects a frame
into the tracee and makes the tracee call sigreturn.
I.e. the tracee is stopped and this is used pretty much as PTRACE_CONT or
PTRACE_SYSCALL.

In such case this defeats the purpose of sigreturn in CRIU because it is
called asynchronously by the tracee when the tracer is about to detach or
even already detached.

For synchronous use-case PTRACE_SETREGSET will be enough, the rest of the
sigframe can be restored by other means.

And with 'criu restore' there may be even no tracer by the time sigreturn
is called.
--Andy
-- 
Sincerely yours,
Mike.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help