On Fri, Jan 20, 2023 at 7:05 AM Gregory Price gourry.memverge@gmail.com wrote:
Implement ptrace getter/setter interface for syscall user dispatch.
Presently, these settings are write-only via prctl, making it impossible to implement transparent checkpoint (coordination with the software is required).
This is modeled after a similar interface for SECCOMP, which can have its configuration dumped by ptrace for software like CRIU.
Signed-off-by: Gregory Price gregory.price@memverge.com
.../admin-guide/syscall-user-dispatch.rst | 5 +- include/linux/syscall_user_dispatch.h | 19 +++++++ include/uapi/linux/ptrace.h | 10 ++++ kernel/entry/syscall_user_dispatch.c | 49 +++++++++++++++++++ kernel/ptrace.c | 9 ++++ 5 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/syscall-user-dispatch.rst b/Documentation/admin-guide/syscall-user-dispatch.rst index 60314953c728..a23ae21a1d5b 100644 --- a/Documentation/admin-guide/syscall-user-dispatch.rst +++ b/Documentation/admin-guide/syscall-user-dispatch.rst
<snip>
+int syscall_user_dispatch_get_config(struct task_struct *task, unsigned long size,
void __user *data)
+{
struct syscall_user_dispatch *sd = &task->syscall_dispatch;
struct syscall_user_dispatch_config config;
if (size != sizeof(struct syscall_user_dispatch_config))
return -EINVAL;
if (sd->selector) {
config.mode = PR_SYS_DISPATCH_ON;
config.offset = sd->offset;
config.len = sd->len;
config.selector = sd->selector;
config.on_dispatch = sd->on_dispatch;
} else {
This doesn't look right for me. selector is optional and if it is 0, it doesn't mean that mode is PR_SYS_DISPATCH_OFF, does it?
config.mode = PR_SYS_DISPATCH_OFF;
config.offset = 0;
config.len = 0;
config.selector = NULL;
config.on_dispatch = false;
}
if (copy_to_user(data, &config, sizeof(config)))
return -EFAULT;
return 0;
+}