Skip to content

Commit

Permalink
criu: collect BPF map files for restoration
Browse files Browse the repository at this point in the history
    This commit helps CRIU recognize, collect and set-up the
    information for BPF map files during the restoration phase.
    CRIU can now successfully dump information obtained about BPF map
    files from procfs and restore these maps with the same parameters.

    Source files modified:

    * files.c - function collect_one_file() now recognizes file
    descriptors for BPF map files (type FD_TYPES__BPFMAP) and sets up
    the appropriate handlers

    * cr-restore.c - added 'bpfmap_cinfo' to array 'cinfos_files',
    so that a call to function collect_images() would now also
    collect BPF map files

Signed-off-by: Abhishek Vijeev <[email protected]>
  • Loading branch information
abhishekvijeev committed May 19, 2020
1 parent b0cd049 commit c6b6700
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions criu/cr-restore.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#include "string.h"
#include "memfd.h"
#include "timens.h"
#include "bpfmap.h"

#include "parasite-syscall.h"
#include "files-reg.h"
Expand Down Expand Up @@ -295,6 +296,7 @@ static struct collect_image_info *cinfos_files[] = {
&fanotify_mark_cinfo,
&ext_file_cinfo,
&memfd_cinfo,
&bpfmap_cinfo,
};

/* These images are required to restore namespaces */
Expand Down
3 changes: 3 additions & 0 deletions criu/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__MEMFD:
ret = collect_one_file_entry(fe, fe->memfd->id, &fe->memfd->base, &memfd_cinfo);
break;
case FD_TYPES__BPFMAP:
ret = collect_one_file_entry(fe, fe->bpf->id, &fe->bpf->base, &bpfmap_cinfo);
break;
}

return ret;
Expand Down

0 comments on commit c6b6700

Please sign in to comment.