<div dir="ltr"><div>With the help of bcc tools I figured out the following list of capabilities to run hello world application</div><div><br></div><div>sudo setcap cap_ipc_lock,cap_sys_admin,cap_dac_override,cap_dac_read_search,cap_sys_rawio+ep ./dpdk-helloworld<br></div><div><br></div><div>BCC toolkit is full of useful utils.</div><div><br></div><div>My 50 cents to finish the subject. The reason for zeroing out the mapping for the unprivileged user is stated in doc and it is :-</div><div><br></div><div>from <a href="https://www.kernel.org/doc/Documentation/vm/pagemap.txt">https://www.kernel.org/doc/Documentation/vm/pagemap.txt</a><br></div><div><br></div><div><pre style="color:rgb(0,0,0);white-space:pre-wrap"> Starting from
4.2 the PFN field is zeroed if the user does not have CAP_SYS_ADMIN.
Reason: information about PFNs helps in exploiting Rowhammer vulnerability.</pre><pre style="color:rgb(0,0,0);white-space:pre-wrap">"</pre></div><div><br></div>Thanks again for the help.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 2, 2022 at 5:31 PM Dmitry Kozlyuk <<a href="mailto:dmitry.kozliuk@gmail.com">dmitry.kozliuk@gmail.com</a>> 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">2022-09-01 22:26 (UTC+0300), Dmitry Kozlyuk:<br>
> 2022-09-01 17:42 (UTC+0300), Dmitry Kozlyuk:<br>
> > Theoretically, one can enumerate all capabilities, give all capabilities<br>
> > except one to the binary, try to run it, and notice which capability removal<br>
> > leads to a failure. However, `setcap "all=ep $capa-ep" ./binary`<br>
> > did not give the correct answer to me (why?), so I did it semi-manually. <br>
> <br>
> Aha! CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH are not orthogonal:<br>
> they both allow bypassing file read permission check.<br>
> <br>
> I have a working script here: ...<br>
<br>
Apparently, a better alternative is already out there:<br>
<br>
<a href="https://github.com/iovisor/bcc/blob/master/tools/capable_example.txt" rel="noreferrer" target="_blank">https://github.com/iovisor/bcc/blob/master/tools/capable_example.txt</a><br>
</blockquote></div>