linux/kernel/entry
Gregory Price 463b7715e7 syscall_user_dispatch: Untag selector address before access_ok()
To support checkpoint/restart, ptrace must be able to set the selector
of the tracee.  The selector is a user pointer that may be subject to
memory tagging extensions on some architectures (namely ARM MTE).

access_ok() clears memory tags for tagged addresses if the current task has
memory tagging enabled.

This obviously fails when ptrace modifies the selector of a tracee when
tracer and tracee do not have the same memory tagging enabled state.

Solve this by untagging the selector address before handing it to
access_ok(), like other ptrace functions which modify tracee pointers do.

Obviously a tracer can set an invalid selector address for the tracee, but
that's independent of tagging and a general capability of the tracer.

Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Link: https://lore.kernel.org/all/ZCWXE04nLZ4pXEtM@arm.com/
Link: https://lore.kernel.org/r/20230407171834.3558-3-gregory.price@memverge.com
2023-04-16 14:23:07 +02:00
..
common.c entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up 2023-03-21 15:13:15 +01:00
common.h kernel: Implement selective syscall userspace redirection 2020-12-02 15:07:56 +01:00
kvm.c entry/kvm: Exit to user mode when TIF_NOTIFY_SIGNAL is set 2022-06-07 11:19:00 -04:00
Makefile kernel: Implement selective syscall userspace redirection 2020-12-02 15:07:56 +01:00
syscall_user_dispatch.c syscall_user_dispatch: Untag selector address before access_ok() 2023-04-16 14:23:07 +02:00