<div dir="ltr"><div>Hi Puneet,<br><br>Thanks for your interest in the Klever verification framework.<br><br>To verify your separate driver you should do the following steps:<br>1) First, be sure that you have some kernel version sources files to compile your driver with. It is better to choose versions of Linux in between 3.14 and 4.6.7. It is possible to check a driver with a newer version of the Linux kernel but it will require additional steps. Both the driver and Kernel should be configured and compiled for x86_64 architecture preferably.<br><br>2) Install the Klever framework according to this manual: <a href="https://klever.readthedocs.io/en/latest/deploy.html">https://klever.readthedocs.io/en/latest/deploy.html</a><br>(!) Klever will need a lot of computational resources to run, so avoid installing it on a laptop. If your driver is an open source we can even give you access to a virtual machine with Klever to try it.<br><br>3) Before trying to verify your own driver just ensure that all is installed correctly. To do that open localhost:8998, log in as manager:manager and try to solve a preexisting verification job there. If all goes smoothly, go to the next step.<br><br>4) Prepare a build base for your driver. To do that just configure the kernel and your driver and build it with a prefix command:<br><br> clade-intercept <your compilation command>"<br><br>(An example: clade-intercept make -j8 M=drivers/net/usb)<br>Prepare the environment:<br> export PATH=$KLEVER_DEPLOY_DIR/klever-addons/CIF/bin/:$PATH<br>Where $KLEVER_DEPLOY_DIR is an absolute path to Klever installation directory. Run "cif --help" to be sure that path is correct.<br>Then run the second command to create the build base:<br> clade-all -p linux_kernel cmds.txt<br><br>After the command, you will have a directory named "clade". I refer to it as <clade dir> in the next steps below.<br><br>5. After Klever installation, you can build the kernel and create a build base.<br>a) Modify the configuration file that you have used for Klever installation and add there the following entry: "Klever Build Bases": ["<clade dir>"]<br>b) Run again installation command exactly as at installation but replace keyword "install" with "update"<br><br>6) That is almost all. Go to the web interface. Copy your test job, click "modify", choose job.json file and in the opened editor window set proper setting and identifiers of rules to check. You will need there to set fields "build base" as "clade", "requirements" as ["linux:memory safety"] (or add additional rules to check).<br><br>If you need an example write me back. <br><br></div>7) To uninstall Klever use installation command with command "uninstall" instead of "install". <br><div><br>Please, do not hesitate to write me back and ask questions.<br><br>Best,<br>Ilia Zakharov</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">чт, 27 июн. 2019 г. в 20:57, Puneet Gupta <<a href="mailto:PUNEETG@xilinx.com">PUNEETG@xilinx.com</a>>:<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 bgcolor="white" lang="EN-US">
<div class="gmail-m_1627042294443862642WordSection1">
<p class="MsoNormal"><span style="color:windowtext">Hi Alexey,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">Thanks for your mail.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">I have downloaded the klever package and managed to install it also by following the instructions given in the “local deployment” section.<u></u><u></u></span></p>
<p class="MsoNormal"><a href="https://buildmedia.readthedocs.org/media/pdf/klever/latest/klever.pdf" target="_blank">https://buildmedia.readthedocs.org/media/pdf/klever/latest/klever.pdf</a><span style="color:windowtext"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">Can you guide me how to run the klever tool on my kernel module? Is there any doc which I can follow in which step by step the instructions are given?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">Currently I have my kernel module as a tar.bz2 and I want to do static analysis on it.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">I tried running , <u></u><u></u></span></p>
<ul style="margin-top:0in" type="disc">
<li class="gmail-m_1627042294443862642MsoListParagraph" style="color:windowtext;margin-left:0in">
cd bridge<u></u><u></u></li><li class="gmail-m_1627042294443862642MsoListParagraph" style="color:windowtext;margin-left:0in">
python3 manage.py test<u></u><u></u></li></ul>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">I got the following error:<u></u><u></u></span></p>
<p class="MsoNormal"><i><span style="color:windowtext"> File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed<u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="color:windowtext"> File "/group/cdc_hd/members/puneetg/kernel_static_analysis/klever/klever-inst/klever/bridge/bridge/__init__.py", line 21, in <module><u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="color:windowtext"> from bridge.settings import DATABASES<u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="color:windowtext">ModuleNotFoundError: No module named 'bridge.settings'<u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span style="color:windowtext"><u></u> <u></u></span></i></p>
<p class="MsoNormal"><span style="color:windowtext">I can also see “linux-3.14.79.tar.xz” tar file in “build bases” directory. Shall I need to place my external module tar file in that directory and run some tests?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext">Puneet<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<div>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> Alexey Khoroshilov <<a href="mailto:khoroshilov@ispras.ru" target="_blank">khoroshilov@ispras.ru</a>>
<br>
<b>Sent:</b> Friday, June 21, 2019 9:16 PM<br>
<b>To:</b> Puneet Gupta <<a href="mailto:PUNEETG@xilinx.com" target="_blank">PUNEETG@xilinx.com</a>>; <a href="mailto:ldv-project@linuxtesting.org" target="_blank">ldv-project@linuxtesting.org</a><br>
<b>Subject:</b> Re: Queries in running the LDV.<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p><span style="font-size:12pt;font-family:"Arial",sans-serif;color:red">EXTERNAL EMAIL<u></u><u></u></span></p>
<div>
<div>
<p class="MsoNormal">Dear Puneet,<br>
<br>
It seems you use LDV Tools, but it was superseded by our newer KLEVER Framework [1,2].<br>
So, we suggest to use the newer tool.<br>
<br>
As for memory leak rule, we had a prototype of such rule in LDV Tools (104 [3]), but it was not maintained and it is not available in KLEVER. So, we suggest to check code against some memory safety rules ((KLEVER rule id: "linux:memory safety", please note
that string operations are not supported yet) or some Linux specific rules like mutex lock [4] or clock_enable/clock_disable [5].<br>
<br>
[1] <a href="http://linuxtesting.org/04-07-2018" target="_blank">http://linuxtesting.org/04-07-2018</a><br>
[2] <a href="https://forge.ispras.ru/projects/klever" target="_blank">https://forge.ispras.ru/projects/klever</a><br>
[3] <a href="https://forge.ispras.ru/issues/2735" target="_blank">https://forge.ispras.ru/issues/2735</a><br>
[4] <a href="https://forge.ispras.ru/issues/1940" target="_blank">https://forge.ispras.ru/issues/1940</a> (KLEVER rule ids: "linux:kernel:locking:mutex")
<br>
[5] <a href="https://forge.ispras.ru/issues/8785" target="_blank">https://forge.ispras.ru/issues/8785</a> (KLEVER rule ids: "linux:drivers:clk1", "linux:drivers:clk2")<br>
<br>
Best regards,<br>
Alexey Khoroshilov<br>
Linux Verification Center, ISPRAS<br>
<br>
<br>
On 21.06.2019 8:30, Puneet Gupta wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I am using LDV for running static analysis for my external driver.
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I have few questions :<u></u><u></u></p>
<ul style="margin-top:0in" type="disc">
<li class="gmail-m_1627042294443862642MsoListParagraph" style="margin-left:0in">The driver has many files to be compiled, but it seems the LDV is only reporting out the errors for the file which is mentioned in ‘obj-m’. How can I get result for all the files?<u></u><u></u></li><li class="gmail-m_1627042294443862642MsoListParagraph" style="margin-left:0in">What is meant by the error: “attempting to take field offset lock of expression priv@stop whose value is Top”. I am getting only these errors for my file.<u></u><u></u></li><li class="gmail-m_1627042294443862642MsoListParagraph" style="margin-left:0in">To test the LDV , I did kmalloc and didn’t freed the memory returned. But the output on the webpage is not showing an error for that memory leak. Have I need to pass some separate
rule for detecting the memory leaks?<u></u><u></u></li></ul>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I am using 32_7a rule for running the driver, as given in the example in the LDV standard doc.
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Puneet<u></u><u></u></p>
<p class="MsoNormal">This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient,
do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
<u></u><u></u></p>
</blockquote>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
_______________________________________________<br>
ldv-project mailing list<br>
<a href="mailto:ldv-project@linuxtesting.org" target="_blank">ldv-project@linuxtesting.org</a><br>
<a href="http://linuxtesting.org/cgi-bin/mailman/listinfo/ldv-project" rel="noreferrer" target="_blank">http://linuxtesting.org/cgi-bin/mailman/listinfo/ldv-project</a><br>
</blockquote></div>