Re: Kernel stack read with PTRACE_EVENT_EXIT and io_uring threads

Michael Schmitz
2021-06-14T05:03:45Z

On second thought, I'm not certain what adding another empty stack frame
would achieve here.

On m68k, 'frame' already is a new stack frame, for running the new
thread in. This new frame does not have any user context at all, and
it's explicitly wiped anyway.

Unless we save all user context on the stack, then push that context to
a new save frame, and somehow point get_signal to look there for IO
threads (essentially what Eric suggested), I don't see how this could work?

I must be missing something.

Cheers,

Michael Schmitz

Am 14.06.2021 um 14:05 schrieb Michael Schmitz:
>>
>> I wouldn't be surprised if m68k has the exact same thing for the exact
>> same reason, but I didn't check..
>
> m68k is indeed similar, it has:
>
> if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
> /* kernel thread */
> memset(frame, 0, sizeof(struct fork_frame));
> frame->regs.sr = PS_S;
> frame->sw.a3 = usp; /* function */
> frame->sw.d7 = arg;
> frame->sw.retpc = (unsigned long)ret_from_kernel_thread;
> p->thread.usp = 0;
> return 0;
> }
>
> so a similar patch should be possible.
>
> Cheers,
>
> Michael
>
>
>
>>
>> Linus