<div dir="ltr">Hi Andrei,<div><br></div><div>I have created a draft pull request: <a href="https://github.com/checkpoint-restore/criu/pull/1044">https://github.com/checkpoint-restore/criu/pull/1044</a>.</div><div><br></div><div>I await your kind feedback.</div><div><br></div><div>Thank you,</div><div>Abhishek.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 23, 2020 at 1:32 PM Abhishek Vijeev &lt;<a href="mailto:abhishek.vijeev@gmail.com">abhishek.vijeev@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Andrei,<div><br></div><div>Thank you for your response.</div><div><br></div><div>I will take into account all your suggestions and submit a consolidated pull request </div><div>with these changes after implementing a test for BPF map files.</div><div><br></div><div>Thank you,</div><div>Abhishek.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 23, 2020 at 8:58 AM Andrei Vagin &lt;<a href="mailto:avagin@gmail.com" target="_blank">avagin@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You need to implement a test for BPF map files.<br>
<br>
You can look at the existing tests as examples:<br>
<a href="https://github.com/checkpoint-restore/criu/tree/criu-dev/test/zdtm/static" rel="noreferrer" target="_blank">https://github.com/checkpoint-restore/criu/tree/criu-dev/test/zdtm/static</a><br>
<br>
Thanks,<br>
Andrei<br>
<br>
On Wed, Apr 22, 2020 at 12:57:41AM +0530, Abhishek Vijeev wrote:<br>
&gt; ---<br>
&gt;  criu/proc_parse.c        | 81 ++++++++++++++++++++++++++++++++++++++++<br>
&gt;  images/bpfmap-file.proto |  6 +--<br>
&gt;  2 files changed, 84 insertions(+), 3 deletions(-)<br>
&gt; <br>
&gt; diff --git a/criu/proc_parse.c b/criu/proc_parse.c<br>
&gt; index 4a22700a..46d6afd6 100644<br>
&gt; --- a/criu/proc_parse.c<br>
&gt; +++ b/criu/proc_parse.c<br>
&gt; @@ -1683,6 +1683,73 @@ nodata:<br>
&gt;       goto parse_err;<br>
&gt;  }<br>
&gt;  <br>
&gt; +static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf)<br>
&gt; +{<br>
&gt; +     /*<br>
&gt; +      * Format is<br>
&gt; +      * map_type: 3<br>
&gt; +      * key_size: 4<br>
&gt; +      * value_size: 4<br>
&gt; +      * max_entries: 4<br>
&gt; +      * map_flags: 0x0<br>
&gt; +      * memlock: 4096<br>
&gt; +      * map_id: 10<br>
&gt; +      * frozen: 0<br>
&gt; +      */<br>
&gt; +<br>
&gt; +     if (sscanf(str, &quot;map_type: %u&quot;, &amp;bpf-&gt;map_type) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;key_size: %u&quot;, &amp;bpf-&gt;key_size) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;value_size: %u&quot;, &amp;bpf-&gt;value_size) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;max_entries: %u&quot;, &amp;bpf-&gt;max_entries) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;map_flags: %lu&quot;, &amp;bpf-&gt;map_flags) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;memlock: %lu&quot;, &amp;bpf-&gt;memlock) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;map_id: %u&quot;, &amp;bpf-&gt;map_id) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +<br>
&gt; +     str = breadline(f);<br>
&gt; +     if (IS_ERR_OR_NULL(str))<br>
&gt; +             goto nodata;<br>
&gt; +     if (sscanf(str, &quot;frozen: %d&quot;, &amp;bpf-&gt;frozen) != 1)<br>
&gt; +             goto parse_err;<br>
&gt; +     return 0;<br>
&gt; +<br>
&gt; +parse_err:<br>
&gt; +     return -1;<br>
&gt; +nodata:<br>
&gt; +     pr_err(&quot;No data left in proc file while parsing bpfmap\n&quot;);<br>
&gt; +     goto parse_err;<br>
&gt; +}<br>
&gt; +<br>
&gt;  #define fdinfo_field(str, field)     !strncmp(str, field&quot;:&quot;, sizeof(field))<br>
&gt;  <br>
&gt;  static int parse_file_lock_buf(char *buf, struct file_lock *fl,<br>
&gt; @@ -2015,6 +2082,20 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg)<br>
&gt;                       entry_met = true;<br>
&gt;                       continue;<br>
&gt;               }<br>
&gt; +             if (fdinfo_field(str, &quot;map_type&quot;)) {<br>
&gt; +<br>
&gt; +                     BpfmapFileEntry *bpf = arg;<br>
&gt; +<br>
&gt; +                     if (type != FD_TYPES__BPFMAP)<br>
&gt; +                             goto parse_err;<br>
&gt; +<br>
&gt; +                     ret = parse_bpfmap(&amp;f, str, bpf);<br>
&gt; +                     if (ret)<br>
&gt; +                             goto parse_err;<br>
&gt; +<br>
&gt; +                     entry_met = true;<br>
&gt; +                     continue;<br>
&gt; +             }<br>
&gt;       }<br>
&gt;  <br>
&gt;       exit_code = 0;<br>
&gt; diff --git a/images/bpfmap-file.proto b/images/bpfmap-file.proto<br>
&gt; index a21c032c..9f0b8593 100644<br>
&gt; --- a/images/bpfmap-file.proto<br>
&gt; +++ b/images/bpfmap-file.proto<br>
&gt; @@ -15,9 +15,9 @@ message bpfmap_file_entry {<br>
&gt;      required uint32     max_entries = 10;<br>
&gt;  <br>
&gt;      optional sint32          mnt_id  = 11 [default = -1];<br>
&gt; -    optional uint64     map_flags   = 12;<br>
&gt; -    optional uint64     memlock = 13;<br>
&gt; -    optional bool       frozen  = 14;<br>
&gt; +    required uint64     map_flags   = 12;<br>
&gt; +    required uint64     memlock = 13;<br>
&gt; +    required bool       frozen  = 14;<br>
&gt;  <br>
&gt;  <br>
&gt;  }<br>
&gt; \ No newline at end of file<br>
&gt; -- <br>
&gt; 2.17.1<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; CRIU mailing list<br>
&gt; <a href="mailto:CRIU@openvz.org" target="_blank">CRIU@openvz.org</a><br>
&gt; <a href="https://lists.openvz.org/mailman/listinfo/criu" rel="noreferrer" target="_blank">https://lists.openvz.org/mailman/listinfo/criu</a><br>
</blockquote></div>
</blockquote></div>