[CRIU] [PATCH 12/14] restore: set up a handler for collecting signals from zombies

Andrew Vagin avagin at parallels.com
Fri Jan 18 06:55:07 EST 2013


On Fri, Jan 18, 2013 at 03:43:16PM +0400, Andrew Vagin wrote:
> On Fri, Jan 18, 2013 at 03:37:48PM +0400, Andrew Vagin wrote:
> > On Fri, Jan 18, 2013 at 01:13:20PM +0400, Pavel Emelyanov wrote:
> > > On 01/18/2013 01:11 PM, Andrew Vagin wrote:
> > > > On Fri, Jan 18, 2013 at 12:04:11PM +0400, Pavel Emelyanov wrote:
> > > >>> @@ -40,6 +41,20 @@
> > > >>>  static struct task_entries *task_entries;
> > > >>>  static futex_t thread_inprogress;
> > > >>>  
> > > >>> +asm (								\
> > > >>> +	"nop\n"							\
> > > >>> +	".align 16\n"						\
> > > >>> +	"__cr_restore_rt:\n"					\
> > > >>> +	"       movq $"__stringify(__NR_rt_sigreturn)", %rax\n"	\
> > > >>> +	"       syscall"					\
> > > >>> +);
> > > >>
> > > >> What's this?
> > > > 
> > > > I copied this code from glibc. We need it, because glibc are not
> > > > avaliable in restorer.
> > > 
> > > Can we have it not in asm? Like
> > > 
> > > static void cr_restore_rt(void)
> > > {
> > > 	sys_sigreturn();
> > > }
> > > 
> > > with proper sigreturn declaration in syscall.def?
> > 
> > Looks like we can. Thanks
> Sorry, looks like we cannot;)

debug:
00000000000005b5 <cr_restore_rt>:                        
     5b5:       55                      push   %rbp 
     5b6:       48 89 e5                mov    %rsp,%rbp
     5b9:       e8 e2 35 00 00          callq  3ba0 <sys_rt_sigreturn>
     5be:       5d                      pop    %rbp      
     5bf:       c3                      retq    

w/o debug:
0000000000000470 <cr_restore_rt>:
     470:       e9 c7 2b 00 00          jmpq   303c <sys_rt_sigreturn>
     475:       66 66 2e 0f 1f 84 00    data32 nopw %cs:0x0(%rax,%rax,1)
     47c:       00 00 00 00 

The debug version changes registers, so my patch is correct.
> 
> make DEBUG=1
> bash -x test/zdtm.sh static/zombie00
> ...
> (00.046151) Error (cr-restore.c:905): 11847 exited, status=11
> 
> > > 
> > > >>
> > > >>> +extern void cr_restore_rt (void) asm ("__cr_restore_rt")
> > > >>> +			__attribute__ ((visibility ("hidden")));
> > > >>> +
> > > >>> +static void sigzombie_handler(int signal, siginfo_t *siginfo, void *data)
> > > >>> +{
> > > >>> +}
> > > >>> +
> > > >>>  static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
> > > >>>  {
> > > >>>  	char *r;
> > > > .
> > > > 
> > > 
> > > 


More information about the CRIU mailing list