Re: [PATCH v8 1/1] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD

From: Andrei Vagin
Date: Thu Feb 09 2023 - 15:29:55 EST


On Tue, Jan 31, 2023 at 7:30 AM Gregory Price <gourry.memverge@xxxxxxxxx> wrote:
>
> Implement ptrace getter/setter interface for syscall user dispatch.
>
> These prctl settings are presently write-only, making it impossible to
> implement transparent checkpoint/restore via software like CRIU.
>
> 'on_dispatch' field is not exposed because it is a kernel-internal
> only field that cannot be 'true' when returning to userland.
>

Acked-by: Andrei Vagin <avagin@xxxxxxxxx>

> Signed-off-by: Gregory Price <gregory.price@xxxxxxxxxxxx>

<snip>

> diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
> index 195ae64a8c87..6d2f3b86f932 100644
> --- a/include/uapi/linux/ptrace.h
> +++ b/include/uapi/linux/ptrace.h
> @@ -112,6 +112,15 @@ struct ptrace_rseq_configuration {
> __u32 pad;
> };
>
> +#define PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG 0x4210
> +#define PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG 0x4211
> +struct syscall_user_dispatch_config {

nit: all structures in this header have the ptrace prefix. I think it
is better to add it to this one too.

> + __u64 mode;
> + __s8 *selector;
> + __u64 offset;
> + __u64 len;
> +};
> +
> /*
> * These values are stored in task->ptrace_message
> * by ptrace_stop to describe the current syscall-stop.