On Fri, 31 Jan 2025, Ivan Kokshaysky wrote:
Parts of asm/ptrace.h went into UAPI with commit 96433f6ee490 ("UAPI: (Scripted) Disintegrate arch/alpha/include/asm") back in 2012. At first glance it looked correct, as many other architectures expose 'struct pt_regs' for ptrace(2) PTRACE_GETREGS/PTRACE_SETREGS requests and bpf(2) BPF_PROG_TYPE_KPROBE/BPF_PROG_TYPE_PERF_EVENT program types.
On Alpha, however, these requests have never been implemented; 'struct pt_regs' describes internal kernel stack frame which has nothing to do with userspace. Same applies to 'struct switch_stack', as PTRACE_GETFPREG/PTRACE_SETFPREG are not implemented either.
I note that we, unusually, neither save nor even have room for statics in `struct pt_regs', so this structure by itself is unsuitable to pass the register file around with tracing calls and the like. So it seems to me there's no point in exporting `struct pt_regs' in any way to the userland.
What do you think about providing arch/alpha/include/asm/bpf_perf_event.h instead with either a dummy definition of `bpf_user_pt_regs_t', or perhaps one typedef'd to `struct sigcontext' (as it seems to provide all that's needed), and then reverting to v1 of arch/alpha/include/uapi/asm/ptrace.h (and then just copying the contents of arch/alpha/include/asm/ftrace.h over rather than leaving all the useless CPP stuff in) so that we don't have useless `struct pt_regs' exported at all?
Move this stuff back into internal asm, where we can ajust it
s/ajust/adjust/ (NB scripts/checkpatch.pl does complain about it).
Maciej