tech:snapshot_de_process_avec_criu
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:snapshot_de_process_avec_criu [2025/10/28 15:10] – Jean-Baptiste | tech:snapshot_de_process_avec_criu [2026/06/02 15:03] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Snapshot de process avec criu | ||
| + | |||
| + | Voir | ||
| + | |||
| + | * Podman | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * checkpointctl | ||
| + | |||
| + | Voir aussi : | ||
| + | * kcarectl / KernelCare | ||
| + | |||
| + | Critmux | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Semblable à http:// | ||
| + | |||
| + | http:// | ||
| + | |||
| + | |||
| + | ## CRIU avec Docker tmux | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | Démo ici : https:// | ||
| + | |||
| + | ~~~bash | ||
| + | docker run -t -i --privileged --name critmux jpetazzo/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker stop critmux | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker start critmux ; docker attach critmux | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Brouillon | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | wget http:// | ||
| + | sha256sum criu_1.6.1-1_amd64.deb | ||
| + | ~~~ | ||
| + | |||
| + | Le nombre en hexadécimal retourné par `sha256sum` doit être le même que celui figurant sur la page | ||
| + | https:// | ||
| + | |||
| + | ~~~ | ||
| + | 78c1acc0fa73e7b7843945f314802760c485557a927f9f886489d0ccb823fc87 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | dpki -i criu_1.6.1-1_amd64.deb | ||
| + | apt-get -f install | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | # mkdir checkpoint | ||
| + | # criu dump -D checkpoint -t $(pgrep iceweasel) --file-locks | ||
| + | Error (sk-inet.c: | ||
| + | Error (cr-dump.c: | ||
| + | Error (cr-dump.c: | ||
| + | ~~~ | ||
| + | |||
| + | On compile newns (voir http:// | ||
| + | |||
| + | ~~~c | ||
| + | #define _GNU_SOURCE | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | #define STACK_SIZE (8 * 4096) | ||
| + | |||
| + | static int ac; | ||
| + | static char **av; | ||
| + | static int ns_exec(void *_arg) | ||
| + | { | ||
| + | int fd; | ||
| + | |||
| + | fd = open(" | ||
| + | if (fd >= 0) { | ||
| + | close(0); | ||
| + | dup2(fd, 1); | ||
| + | dup2(fd, 2); | ||
| + | close(fd); | ||
| + | } | ||
| + | |||
| + | setsid(); | ||
| + | execvp(av[1], | ||
| + | return 1; | ||
| + | } | ||
| + | |||
| + | int main(int argc, char **argv) | ||
| + | { | ||
| + | void *stack; | ||
| + | int ret; | ||
| + | pid_t pid; | ||
| + | |||
| + | ac = argc; | ||
| + | av = argv; | ||
| + | |||
| + | stack = mmap(NULL, STACK_SIZE, PROT_WRITE | PROT_READ, | ||
| + | MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS, | ||
| + | if (stack == MAP_FAILED) { | ||
| + | fprintf(stderr, | ||
| + | exit(1); | ||
| + | } | ||
| + | pid = clone(ns_exec, | ||
| + | CLONE_NEWPID | CLONE_NEWIPC | SIGCHLD, NULL); | ||
| + | if (pid < 0) { | ||
| + | fprintf(stderr, | ||
| + | exit(1); | ||
| + | } | ||
| + | return 0; | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | gcc newns.c -o newns | ||
| + | mv newns / | ||
| + | chmod +x / | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | $ newns iceweasel | ||
| + | clone() failed: Operation not permitted | ||
| + | ~~~ | ||
| + | |||
| + | Voir https:// | ||
| + | |||
| + | J'ai essayé : Sans succès ! | ||
| + | ~~~bash | ||
| + | echo 1 > / | ||
| + | echo 1 > / | ||
| + | ~~~ | ||
| + | |||
| + | Analysons | ||
| + | ~~~ | ||
| + | $ strace newns 2>&1 | grep -i clone | ||
| + | clone(child_stack=0x7f105164fff0, | ||
| + | write(2, " | ||
| + | ~~~ | ||
| + | |||
