Re: [PATCH 1/2] alpha/ptrace: Record and handle the absence of switch_stack

From: Linus Torvalds
Date: Wed Jun 16 2021 - 17:13:29 EST


On Wed, Jun 16, 2021 at 1:57 PM Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote:
>
> Do you know if struct switch_stack or pt_regs is ever exposeed to
> usespace? They are both defined in arch/alpha/include/uapi/asm/ptrace.h
> which makes me think userspace must see those definitions somewhere.

Yeah, that uapi location is a bit unfortunate. It means that user
space _could_ have seen it.

Which probably means that some user space uses it. Not for any kernel
interfaces (the alpha ptrace register offsets are actually sane, and
we have that "regoff[]" array to find them) - but I could see some odd
program having decided to use the kernel pt_regs and switch_stack
structures for their own reasons.

Annoying. Because we don't really expose it as-is in any way, afaik.
Only incidentally - and by mistake - in a uapi header file.

Maybe a flag in thread_info->status (or even a new 32-bit field
entirely in thread_info) is the way to go like Al says.

Linus