[CRIU] Cannot restore from regular user when RPC service running as root

Pavel Emelyanov xemul at parallels.com
Tue Jan 20 06:39:31 PST 2015


On 01/20/2015 05:13 PM, Jason L. Turner wrote:
> Hi Pavel, Ruslan
> 
> I do not receive any segfault messages in the recent output from dmesg after my program has run.  

Hm... OK, so we do know that the only task we restore has threads, all
threads get to the stage where they print "Restored" and then criu cannot
attach to them. I.e. they die somewhere in between. I can imagine the only
place in restorer code that can fail there.

Can you apply this patch and check for the restore.log again?

diff --git a/pie/restorer.c b/pie/restorer.c
index c45892e..0391f23 100644
--- a/pie/restorer.c
+++ b/pie/restorer.c
@@ -211,9 +211,13 @@ static int restore_creds(CredsEntry *ce)

 static inline int restore_pdeath_sig(struct thread_restore_args *ta)
 {
-       if (ta->pdeath_sig)
-               return sys_prctl(PR_SET_PDEATHSIG, ta->pdeath_sig, 0, 0, 0);
-       else
+       if (ta->pdeath_sig) {
+               int ret;
+
+               ret = sys_prctl(PR_SET_PDEATHSIG, ta->pdeath_sig, 0, 0, 0);
+               pr_info("%ld: restored pdeath sig %d = %d\n", sys_getpid(), ta->pdeath_sig, ret);
+               return ret;
+       } else
                return 0;
 }

@@ -1170,6 +1174,8 @@ long __export_restore_task(struct task_restore_args *args)

        restore_finish_stage(CR_STATE_RESTORE_CREDS);

+       pr_info("%ld, Final stage: %ld\n", sys_getpid(), ret);
+
        if (ret)
                BUG();


The spaces might get screwed up, so the -l option to patch command might help.

Thanks,
Pavel



More information about the CRIU mailing list