[CRIU] Dumping BPF Map Data

Abhishek Vijeev abhishek.vijeev at gmail.com
Tue May 12 11:00:53 MSK 2020


Hi,

I'd like to follow up on my previous email. I haven't been able to make
progress on this
front, and would appreciate any pointers to help me dump the data of BPF
maps.

Thank you,
Abhishek Vijeev.

On Sun, May 3, 2020 at 5:56 PM Abhishek Vijeev <abhishek.vijeev at gmail.com>
wrote:

> Hi,
>
> I've been working on enabling CRIU to c/r BPF map files. The following PR
> reads
> information about BPF maps from procfs, dumps it and creates new maps with
> the
> same parameters upon restoration:
>
> https://github.com/checkpoint-restore/criu/pull/1044
>
> For my next goal, I'd like to c/r the data stored in these maps. However,
> the BPF
> system call does not provide an interface to retrieve all data stored in
> BPF maps
> without prior information about the data stored.
>
> I shall now describe the problem I'm faced with. Let's take the example of
> a BPF
> map that stores key-value pairs in the form of a hash table. Here are its
> contents:
>
> Key            Value
>   a                  1
>   b                  2
>   c                  3
>
> To extract all data stored in this map, I must iterate through all
> key-value pairs using
> BPF_MAP_GET_NEXT_KEY, starting with a lookup key that doesn't exist in the
> map.
> (i.e. anything other than 'a', 'b' or 'c'). Given that I don't know the
> data type of the
> keys or the contents of the map, how must I generate a key that doesn't
> exist in the
> map? It is important that the lookup key is not present in the map because
> in that
> case, I will only be able to iterate through keys that occur after this
> lookup key. For
> example, using 'b' as the lookup key would miss out the first key-value
> pair ('a'->1).
>
> I'm looking for guidance to solve this problem, and would appreciate any
> help.
>
> Thank you,
> Abhishek Vijeev.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20200512/f11df956/attachment.html>


More information about the CRIU mailing list