Skip to content

Commit

Permalink
criu: collect BPF map files for restoration
Browse files Browse the repository at this point in the history
    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

    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.

Signed-off-by: Abhishek Vijeev <[email protected]>
  • Loading branch information
abhishekvijeev committed Apr 30, 2020
1 parent fc33047 commit e5703e6
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 "memfd.h"
#include "string.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 e5703e6

Please sign in to comment.