[CRIU] BPF Data Dump

Abhishek Vijeev abhishek.vijeev at gmail.com
Tue Jun 30 18:44:57 MSK 2020


Hi,

I'm looking for advice on dumping BPF map data.

The data stored in maps is represented as key-value pairs. While
dumping this data, CRIU doesn't
know the data types of these key-value pairs. I therefore think it is
not feasible to define a protobuf
message for these key-value pairs (since we don't know the data type).

Consequently, I'm exploring the option of dumping this data in binary
format to a protobuf image
(similar to what's done for pipes' data). I will define the format of
this protobuf message to
include the number of bytes that contain keys and values as follows:

message bpfmap_data_entry {
     required uint32 map_id           = 1;
     required uint32 keys_bytes     = 2;
     required uint32 values_bytes  = 3;
}

During restore, I will read in 'keys_bytes' bytes to a buffer and
'values_bytes' bytes to another
buffer. I would then be able to populate the BPF map with the data
using bpf_map_update_batch( ).

I look forward to hearing your opinions, and also whether there are
alternative approaches to
achieve this.

Thank you,
Abhishek Vijeev.


More information about the CRIU mailing list