Skip to content

Commit 4336068

Browse files
Gregory PriceKAGA-KOKO
authored andcommitted
syscall_user_dispatch: Split up set_syscall_user_dispatch()
syscall user dispatch configuration is not covered by checkpoint/restore. To prepare for ptrace access to the syscall user dispatch configuration, move the inner working of set_syscall_user_dispatch() into a helper function. Make the helper function task pointer based and let set_syscall_user_dispatch() invoke it with task=current. No functional change. Signed-off-by: Gregory Price <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Oleg Nesterov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 09a9639 commit 4336068

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

kernel/entry/syscall_user_dispatch.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ bool syscall_user_dispatch(struct pt_regs *regs)
6868
return true;
6969
}
7070

71-
int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
72-
unsigned long len, char __user *selector)
71+
static int task_set_syscall_user_dispatch(struct task_struct *task, unsigned long mode,
72+
unsigned long offset, unsigned long len,
73+
char __user *selector)
7374
{
7475
switch (mode) {
7576
case PR_SYS_DISPATCH_OFF:
@@ -94,15 +95,21 @@ int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
9495
return -EINVAL;
9596
}
9697

97-
current->syscall_dispatch.selector = selector;
98-
current->syscall_dispatch.offset = offset;
99-
current->syscall_dispatch.len = len;
100-
current->syscall_dispatch.on_dispatch = false;
98+
task->syscall_dispatch.selector = selector;
99+
task->syscall_dispatch.offset = offset;
100+
task->syscall_dispatch.len = len;
101+
task->syscall_dispatch.on_dispatch = false;
101102

102103
if (mode == PR_SYS_DISPATCH_ON)
103-
set_syscall_work(SYSCALL_USER_DISPATCH);
104+
set_task_syscall_work(task, SYSCALL_USER_DISPATCH);
104105
else
105-
clear_syscall_work(SYSCALL_USER_DISPATCH);
106+
clear_task_syscall_work(task, SYSCALL_USER_DISPATCH);
106107

107108
return 0;
108109
}
110+
111+
int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
112+
unsigned long len, char __user *selector)
113+
{
114+
return task_set_syscall_user_dispatch(current, mode, offset, len, selector);
115+
}

0 commit comments

Comments
 (0)