make checkpoint a ptregs syscall as well
PATCH 1/1 make checkpoint a ptregs syscall as well
This is on top of the 64-bit patches which Oren posted on Dec 6, so it does not work with my cr-next branch or Oren's ckpt-v19-rc2, and s390 and powerpc will need corresponding patches.
Without this, restart of self-checkpoint fails (understandably) on the amd64 test system I'm borrowing.
I have not yet tested restart of checkpointed 32-bit program on 64-bit machine. Or for that matter a 32bit kernel.
Thanks, Nathan, for finding the problem! I should have guessed, based on my symptoms.
--- arch/x86/include/asm/syscalls.h | 3 +++ arch/x86/include/asm/unistd_64.h | 2 +- arch/x86/kernel/checkpoint_64.c | 10 ++++++++++ arch/x86/kernel/entry_32.S | 1 + arch/x86/kernel/entry_64.S | 2 ++ arch/x86/kernel/syscall_table_32.S | 2 +- checkpoint/sys.c | 5 ++--- include/linux/checkpoint.h | 2 ++ include/linux/syscalls.h | 2 -- 9 files changed, 22 insertions(+), 7 deletions(-)
arch/x86/include/asm/syscalls.h +3 -0
@@ -45,6 +45,7 @@ int sys_execve(struct pt_regs *);/* kernel/checkpoint_32.c */ #ifdef CONFIG_CHECKPOINT +long sys_checkpoint (struct pt_regs *);long sys_restart (struct pt_regs *);#endif
@@ -90,6 +91,8 @@ long sys_arch_prctl(int, unsigned long);/* kernel/checkpoint_64.c */ #ifdef CONFIG_CHECKPOINT +asmlinkage long sys_checkpoint (pid_t pid,int fd,unsigned long flags, +int logfd,struct pt_regs *regs);asmlinkage long sys_restart (pid_t pid,int fd,unsigned long flags,int logfd,struct pt_regs *regs);#endif
arch/x86/include/asm/unistd_64.h +1 -1
@@ -664,7 +664,7 @@ __SYSCALL(__NR_perf_event_open, sys_perf_event_open)#define __NR_eclone 299 __SYSCALL(__NR_eclone, stub_eclone)#define __NR_checkpoint 300 -__SYSCALL(__NR_checkpoint, sys_checkpoint) +__SYSCALL(__NR_checkpoint, stub_checkpoint)#define __NR_restart 301__SYSCALL (__NR_restart, stub_restart)
arch/x86/kernel/checkpoint_64.c +10 -0
@@ -22,6 +22,16 @@* sys_restart needs to access and modify the pt_regs structure to * restore the original state from the time of the checkpoint. */ +asmlinkage long sys_checkpoint (pid_t pid,int fd,unsigned long flags,int logfd, +struct pt_regs *regs) +{ +return do_sys_checkpoint (pid, fd, flags, logfd); +} + +/* +* sys_restart needs to access and modify the pt_regs structure to +* restore the original state from the time of the checkpoint. +*/ asmlinkage long sys_restart (pid_t pid,int fd,unsigned long flags,int logfd,struct pt_regs *regs) {
arch/x86/kernel/entry_32.S +1 -0
@@ -727,6 +727,7 @@ PTREGSCALL(rt_sigreturn) PTREGSCALL(vm86) PTREGSCALL(vm86old) #ifdef CONFIG_CHECKPOINT +PTREGSCALL(checkpoint) PTREGSCALL(restart) #endif
arch/x86/kernel/entry_64.S +2 -0
@@ -700,8 +700,10 @@ END(\label) PTREGSCALL stub_iopl, sys_iopl, %rsi PTREGSCALL stub_eclone, sys_eclone, %r8 #ifdef CONFIG_CHECKPOINT + PTREGSCALL stub_checkpoint, sys_checkpoint, %r8 PTREGSCALL stub_restart, sys_restart, %r8 #else + PTREGSCALL stub_checkpoint, sys_ni_syscall, %r8 PTREGSCALL stub_restart, sys_ni_syscall, %r8 #endif
arch/x86/kernel/syscall_table_32.S +1 -1
@@ -337,5 +337,5 @@ ENTRY(sys_call_table) .long sys_rt_tgsigqueueinfo /* 335 */ .long sys_perf_event_open .long ptregs_eclone - .long sys_checkpoint + .long ptregs_checkpoint .long ptregs_restart
checkpoint/sys.c +2 -3
@@ -605,7 +605,7 @@ int walk_task_subtree(struct task_struct *root,/* checkpoint/restart syscalls */ /** -* sys_checkpoint - checkpoint a container +* do_sys_checkpoint - checkpoint a container * @pid: pid of the container init(1) process * @fd: file to which dump the checkpoint image * @flags: checkpoint operation flags
@@ -614,8 +614,7 @@ int walk_task_subtree(struct task_struct *root,* Returns positive identifier on success, 0 when returning from restart * or negative value on error */ -SYSCALL_DEFINE4 (checkpoint, pid_t, pid, int, fd, - unsigned long, flags, int, logfd) +long do_sys_checkpoint (pid_t pid,int fd,unsigned long flags,int logfd) {struct ckpt_ctx *ctx;long ret;
include/linux/checkpoint.h +2 -0
@@ -60,6 +60,8 @@#define CKPT_LSM_INFO_LEN 200#define CKPT_LSM_STRING_MAX 1024 +extern long do_sys_checkpoint (pid_t pid,int fd,unsigned long flags, +int logfd);extern long do_sys_restart (pid_t pid,int fd,unsigned long flags,int logfd); extern int walk_task_subtree(struct task_struct *task,
include/linux/syscalls.h +0 -2
@@ -872,8 +872,6 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,asmlinkage long sys_ppoll (struct pollfd __user *,unsigned int ,struct timespec __user *,const sigset_t __user *,size_t ); -asmlinkage long sys_checkpoint (pid_t pid,int fd,unsigned long flags, -int logfd);int kernel_execve (const char *filename,char *const argv[],char *const envp[]);
Signature · 1 line
1.6.0.6
A message that is not in the archive (sent off-list or not yet received): 20100118203318.GA22903-r/[email protected]
... silly me -- I should have seen that when I fixed it for restart ! Added, thanks.
Oren.
Quoted 168 lines · Serge E. Hallyn
This is on top of the 64-bit patches which Oren posted on Dec 6, so it does not work with my cr-next branch or Oren's ckpt-v19-rc2, and s390 and powerpc will need corresponding patches.
Without this, restart of self-checkpoint fails (understandably) on the amd64 test system I'm borrowing.
I have not yet tested restart of checkpointed 32-bit program on 64-bit machine. Or for that matter a 32bit kernel.
Thanks, Nathan, for finding the problem! I should have guessed, based on my symptoms.
Signed-off-by Serge Hallyn <serue-r/[email protected]>--- arch/x86/include/asm/syscalls.h | 3 +++ arch/x86/include/asm/unistd_64.h | 2 +- arch/x86/kernel/checkpoint_64.c | 10 ++++++++++ arch/x86/kernel/entry_32.S | 1 + arch/x86/kernel/entry_64.S | 2 ++ arch/x86/kernel/syscall_table_32.S | 2 +- checkpoint/sys.c | 5 ++--- include/linux/checkpoint.h | 2 ++ include/linux/syscalls.h | 2 -- 9 files changed, 22 insertions(+), 7 deletions(-)arch/x86/include/asm/syscalls.h +3
-0@@ -45,6 +45,7 @@ int sys_execve(struct pt_regs *);/* kernel/checkpoint_32.c */ #ifdef CONFIG_CHECKPOINT +long sys_checkpoint (struct pt_regs *);long sys_restart (struct pt_regs *);#endif @@ -90,6 +91,8 @@ long sys_arch_prctl(int, unsigned long);/* kernel/checkpoint_64.c */ #ifdef CONFIG_CHECKPOINT +asmlinkage long sys_checkpoint (pid_t pid,int fd,unsigned long flags, +int logfd,struct pt_regs *regs);asmlinkage long sys_restart (pid_t pid,int fd,unsigned long flags,int logfd,struct pt_regs *regs);#endif arch/x86/include/asm/unistd_64.h +1
-1@@ -664,7 +664,7 @@ __SYSCALL(__NR_perf_event_open, sys_perf_event_open)#define __NR_eclone 299 __SYSCALL(__NR_eclone, stub_eclone)#define __NR_checkpoint 300 -__SYSCALL(__NR_checkpoint, sys_checkpoint) +__SYSCALL(__NR_checkpoint, stub_checkpoint)#define __NR_restart 301__SYSCALL (__NR_restart, stub_restart)arch/x86/kernel/checkpoint_64.c +10
-0@@ -22,6 +22,16 @@* sys_restart needs to access and modify the pt_regs structure to * restore the original state from the time of the checkpoint. */ +asmlinkage long sys_checkpoint (pid_t pid,int fd,unsigned long flags,int logfd, +struct pt_regs *regs) +{ +return do_sys_checkpoint (pid, fd, flags, logfd); +} + +/* +* sys_restart needs to access and modify the pt_regs structure to +* restore the original state from the time of the checkpoint. +*/ asmlinkage long sys_restart (pid_t pid,int fd,unsigned long flags,int logfd,struct pt_regs *regs) {arch/x86/kernel/entry_32.S +1
-0@@ -727,6 +727,7 @@ PTREGSCALL(rt_sigreturn) PTREGSCALL(vm86) PTREGSCALL(vm86old) #ifdef CONFIG_CHECKPOINT +PTREGSCALL(checkpoint) PTREGSCALL(restart) #endifarch/x86/kernel/entry_64.S +2
-0@@ -700,8 +700,10 @@ END(\label) PTREGSCALL stub_iopl, sys_iopl, %rsi PTREGSCALL stub_eclone, sys_eclone, %r8 #ifdef CONFIG_CHECKPOINT + PTREGSCALL stub_checkpoint, sys_checkpoint, %r8 PTREGSCALL stub_restart, sys_restart, %r8 #else + PTREGSCALL stub_checkpoint, sys_ni_syscall, %r8 PTREGSCALL stub_restart, sys_ni_syscall, %r8 #endifarch/x86/kernel/syscall_table_32.S +1
-1@@ -337,5 +337,5 @@ ENTRY(sys_call_table) .long sys_rt_tgsigqueueinfo /* 335 */ .long sys_perf_event_open .long ptregs_eclone - .long sys_checkpoint + .long ptregs_checkpoint .long ptregs_restartcheckpoint/sys.c +2
-3@@ -605,7 +605,7 @@ int walk_task_subtree(struct task_struct *root,/* checkpoint/restart syscalls */ /** -* sys_checkpoint - checkpoint a container +* do_sys_checkpoint - checkpoint a container * @pid: pid of the container init(1) process * @fd: file to which dump the checkpoint image * @flags: checkpoint operation flags @@ -614,8 +614,7 @@ int walk_task_subtree(struct task_struct *root,* Returns positive identifier on success, 0 when returning from restart * or negative value on error */ -SYSCALL_DEFINE4 (checkpoint, pid_t, pid, int, fd, - unsigned long, flags, int, logfd) +long do_sys_checkpoint (pid_t pid,int fd,unsigned long flags,int logfd) {struct ckpt_ctx *ctx;long ret;include/linux/checkpoint.h +2
-0@@ -60,6 +60,8 @@#define CKPT_LSM_INFO_LEN 200#define CKPT_LSM_STRING_MAX 1024 +extern long do_sys_checkpoint (pid_t pid,int fd,unsigned long flags, +int logfd);extern long do_sys_restart (pid_t pid,int fd,unsigned long flags,int logfd); extern int walk_task_subtree(struct task_struct *task,include/linux/syscalls.h +0
-2@@ -872,8 +872,6 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,asmlinkage long sys_ppoll (struct pollfd __user *,unsigned int ,struct timespec __user *,const sigset_t __user *,size_t ); -asmlinkage long sys_checkpoint (pid_t pid,int fd,unsigned long flags, -int logfd);int kernel_execve (const char *filename,char *const argv[],char *const envp[]);