From: Carsten Haitzler carsten.haitzler@foss.arm.com
Fix the kcmp syscall (when CONFIG_CHECKPOINT_RESTORE is enabled) for the case that the idx arguments might be pointers (capabilites) passed in. One of the kcmp types uses idx2 to carry a capability pointer to extended structure information copied in from userspace.
Signed-off-by: Carsten Haitzler carsten.haitzler@foss.arm.com --- kernel/kcmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/kcmp.c b/kernel/kcmp.c index 5353edfad8e1..d59f74c68c93 100644 --- a/kernel/kcmp.c +++ b/kernel/kcmp.c @@ -133,7 +133,7 @@ static int kcmp_epoll_target(struct task_struct *task1, #endif
SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type, - unsigned long, idx1, unsigned long, idx2) + unsigned long, idx1, user_uintptr_t, idx2) { struct task_struct *task1, *task2; int ret; @@ -204,7 +204,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type, #endif break; case KCMP_EPOLL_TFD: - ret = kcmp_epoll_target(task1, task2, idx1, (void *)idx2); + ret = kcmp_epoll_target(task1, task2, idx1, + (struct kcmp_epoll_slot __user *)idx2); break; default: ret = -EINVAL;
From: Carsten Haitzler carsten.haitzler@foss.arm.com
Block device ioctl's now take a user_uintptr_t as last argument, so adapt to this to keep compiling if CONFIG_CHECKPOINT_RESTORE is enabled.
Signed-off-by: Carsten Haitzler carsten.haitzler@foss.arm.com --- fs/timerfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/timerfd.c b/fs/timerfd.c index e9c96a0c79f1..5a362ef4eed1 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -347,7 +347,7 @@ static void timerfd_show(struct seq_file *m, struct file *file) #endif
#ifdef CONFIG_CHECKPOINT_RESTORE -static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +static long timerfd_ioctl(struct file *file, unsigned int cmd, user_uintptr_t arg) { struct timerfd_ctx *ctx = file->private_data; int ret = 0;
On 02/11/2022 10:46, carsten.haitzler@foss.arm.com wrote:
From: Carsten Haitzler carsten.haitzler@foss.arm.com
Fix the kcmp syscall (when CONFIG_CHECKPOINT_RESTORE is enabled) for the case that the idx arguments might be pointers (capabilites) passed in. One of the kcmp types uses idx2 to carry a capability pointer to extended structure information copied in from userspace.
Signed-off-by: Carsten Haitzler carsten.haitzler@foss.arm.com
kernel/kcmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/kcmp.c b/kernel/kcmp.c index 5353edfad8e1..d59f74c68c93 100644 --- a/kernel/kcmp.c +++ b/kernel/kcmp.c @@ -133,7 +133,7 @@ static int kcmp_epoll_target(struct task_struct *task1, #endif SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type,
unsigned long, idx1, unsigned long, idx2)
{ struct task_struct *task1, *task2; int ret;unsigned long, idx1, user_uintptr_t, idx2)
@@ -204,7 +204,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type, #endif break; case KCMP_EPOLL_TFD:
ret = kcmp_epoll_target(task1, task2, idx1, (void *)idx2);
ret = kcmp_epoll_target(task1, task2, idx1,
break; default: ret = -EINVAL;(struct kcmp_epoll_slot __user *)idx2);
Both patches now applied on next, thanks!
Kevin
linux-morello@op-lists.linaro.org