Make do_restart() and do_checkpoint() return long
PATCH 1/1 Make do_restart() and do_checkpoint() return long
Since syscalls return a long, do_checkpoint() and do_restart() need to also return a long. On a 64-bit platform that uses a general-purpose register for the return value, this is needed to avoid corrupting the value of that saved register if checkpointed while in userspace.
Signed-off-by Dan Smith <danms-r/[email protected]>
--- checkpoint/checkpoint.c | 4 ++-- checkpoint/restart.c | 8 ++++---- checkpoint/sys.c | 4 ++-- include/linux/checkpoint.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-)
checkpoint/checkpoint.c +2 -2
@@ -642,9 +642,9 @@ static int init_checkpoint_ctx(struct ckpt_ctx *ctx, pid_t pid)return 0 ; } -int do_checkpoint (struct ckpt_ctx *ctx,pid_t pid) +long do_checkpoint (struct ckpt_ctx *ctx,pid_t pid) { -int ret; +long ret; ret =init_checkpoint_ctx (ctx, pid);if (ret <0 )
checkpoint/restart.c +4 -4
@@ -819,10 +819,10 @@ static int do_restore_coord(struct ckpt_ctx *ctx, pid_t pid)return ret; } -static int restore_retval (void ) +static long restore_retval (void ) {struct pt_regs *regs =task_pt_regs (current); -int ret; +long ret;/* * For the restart, we entered the kernel via sys_restart(),
@@ -867,9 +867,9 @@ static int restore_retval(void)return ret; } -int do_restart (struct ckpt_ctx *ctx,pid_t pid) +long do_restart (struct ckpt_ctx *ctx,pid_t pid) { -int ret; +long ret;if (ctx) ret =do_restore_coord (ctx, pid);
checkpoint/sys.c +2 -2
@@ -284,7 +284,7 @@ void ckpt_ctx_put(struct ckpt_ctx *ctx) SYSCALL_DEFINE3(checkpoint, pid_t, pid, int, fd, unsigned long, flags) {struct ckpt_ctx *ctx; -int ret; +long ret;if (flags & ~CHECKPOINT_USER_FLAGS )return -EINVAL ;
@@ -319,7 +319,7 @@ SYSCALL_DEFINE3(checkpoint, pid_t, pid, int, fd, unsigned long, flags) SYSCALL_DEFINE3(restart, pid_t, pid, int, fd, unsigned long, flags) {struct ckpt_ctx *ctx =NULL ; -int ret; +long ret;/* no flags for now */ if (flags & ~RESTART_USER_FLAGS )
include/linux/checkpoint.h +2 -2
@@ -106,8 +106,8 @@ extern int ckpt_obj_insert(struct ckpt_ctx *ctx, void *ptr, int objref,extern void ckpt_ctx_get (struct ckpt_ctx *ctx);extern void ckpt_ctx_put (struct ckpt_ctx *ctx); -extern int do_checkpoint (struct ckpt_ctx *ctx,pid_t pid); -extern int do_restart (struct ckpt_ctx *ctx,pid_t pid); +extern long do_checkpoint (struct ckpt_ctx *ctx,pid_t pid); +extern long do_restart (struct ckpt_ctx *ctx,pid_t pid);/* task */ extern int ckpt_activate_next (struct ckpt_ctx *ctx);
Signature · 1 line
1.6.1