[CRIU] [PATCH] Moved sigact dump/restore code into separate file.

Pavel Tikhomirov snorcht at gmail.com
Thu Mar 19 17:16:20 MSK 2020


> From: Prakriti <prakritigoyal19 at gmail.com>
...
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index e5a82775..613dc1f8 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -68,6 +68,7 @@
>  #include "timerfd.h"
>  #include "action-scripts.h"
>  #include "shmem.h"
> +#include <compel/compel.h>

Please rebase on new criu-dev, there is no compel.h anymore. Better
send your patch as a pull request to
https://github.com/checkpoint-restore/criu/. Because currently
https://patchwork.criu.org/project/criu/series is not running zdtm for
patch-sets for some reason...

>  #include "aio.h"
>  #include "lsm.h"
>  #include "seccomp.h"
...
> +static int prepare_sigactions_from_core(TaskCoreEntry *tc)
> +{
> +       int sig, i;
> +
> +       if (tc->n_sigactions != SIGMAX - 2) {
> +               pr_err("Bad number of sigactions in the image (%d, want %d)\n",
> +                               (int)tc->n_sigactions, SIGMAX - 2);
> +               return -1;
> +       }
> +
> +       pr_info("Restore on-core sigactions for %d\n", vpid(current));
> +
> +       for (sig = 1, i = 0; sig <= SIGMAX; sig++) {
> +               int ret;
> +               SaEntry *e;
> +               bool sigaction_is_compat;
> +
> +               if (sig == SIGKILL || sig == SIGSTOP)
> +                       continue;
> +
> +               e = tc->sigactions[i++];
> +               sigaction_is_compat = e->has_compat_sigaction && e->compat_sigaction;
> +               if (sigaction_is_compat)
> +                       ret = restore_compat_sigaction(sig, e);
> +               else
> +                       ret = restore_native_sigaction(sig, e);
> +
> +               if (ret < 0)
> +                       return ret;
> +       }
> +
> +       return 0;
> +}

Lost space and lost comment.


> +static int restore_one_sigaction(int sig, struct cr_img *img, int pid)
> +{
> +       bool sigaction_is_compat;
> +       SaEntry *e;
> +       int ret = 0;
> +
> +       BUG_ON(sig == SIGKILL || sig == SIGSTOP);
> +
> +       ret = pb_read_one_eof(img, &e, PB_SIGACT);
> +       if (ret == 0) {
> +               if (sig != SIGMAX_OLD + 1) { /* backward compatibility */
> +                       pr_err("Unexpected EOF %d\n", sig);
> +                       return -1;
> +               }
> +               pr_warn("This format of sigacts-%d.img is deprecated\n", pid);
> +               return -1;
> +       }
> +       if (ret < 0)
> +               return ret;
> +
> +       sigaction_is_compat = e->has_compat_sigaction && e->compat_sigaction;
> +       if (sigaction_is_compat)
> +               ret = restore_compat_sigaction(sig, e);
> +       else
> +               ret = restore_native_sigaction(sig, e);
> +
> +       sa_entry__free_unpacked(e, NULL);
> +
> +       return ret;
> +}
> +
...


More information about the CRIU mailing list