Re: [PATCH] alpha: Add extra switch_stack frames in exit, exec, and kernel threads

From: Linus Torvalds
Date: Tue Jun 15 2021 - 18:03:19 EST


On Tue, Jun 15, 2021 at 12:36 PM Eric W. Biederman
<ebiederm@xxxxxxxxxxxx> wrote:
>
> I looked and there nothing I can do that is not arch specific, so
> whack the moles with a minimal backportable fix.
>
> This change survives boot testing on qemu-system-alpha.

So as mentioned in the other thread, I think this patch is exactly right.

However, the need for this part

> @@ -785,6 +785,7 @@ ret_from_kernel_thread:
> mov $9, $27
> mov $10, $16
> jsr $26, ($9)
> + lda $sp, SWITCH_STACK_SIZE($sp)
> br $31, ret_to_user
> .end ret_from_kernel_thread

obviously eluded me in my "how about something like this", and I had
to really try to figure out why we'd ever return.

Which is why I came to that "oooh - kernel_execve()" realization.

It might be good to comment on that somewhere. And if you can think of
some other case, that should be mentioned too.

Anyway, thanks for looking into this odd case. And if you have a
test-case for this all, it really would be a good thing. Yes, it
should only affect a couple of odd-ball architectures, but still... It
would also be good to hear that you actually did verify the behavior
of this patch wrt that ptrace-of-io-worker-threads case..

Linus

Linus