<div dir="ltr">Hello Aruna,<div><br></div><div>Thanks a lot for your help.</div><div>I'm aware that a single kernel module will accomplish syscall interception.</div><div>In fact, I submitted my solution to the interviewers. Here's my source code:</div><div><br></div><div><a href="https://github.com/Ajinkya-Veritas/Test-Module/blob/master/testmod.c">https://github.com/Ajinkya-Veritas/Test-Module/blob/master/testmod.c</a><br></div><div><br></div><div>However, the interviewer had done a weird scenario where he created two modules from same code.</div><div>(mod1 and mod2) So obviously, they would intercept same system call.</div><div>After loading those modules and unloading them in same order caused panic, which I described in detail</div><div>initially.</div><div>My goal is to avoid panic, but couldn't find out how.</div><div><br></div><div>Thanks,</div><div>Ajinkya.</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 8, 2017 at 11:36 PM, Aruna Hewapathirane <span dir="ltr"><<a href="mailto:aruna.hewapathirane@gmail.com" target="_blank">aruna.hewapathirane@gmail.com</a>></span> wrote:<br><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">Hello Ajinkya,<br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Sat, Jul 8, 2017 at 12:14 PM, Greg KH <span dir="ltr"><<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_7012267879996735151gmail-">On Sat, Jul 08, 2017 at 09:38:52PM +0530, Ajinkya Surnis wrote:<br>
> Actually, this is not a college assignment. I'm a professional software<br>
> engineer who is completely new to kernel programming.<br></span></blockquote><div><br></div></span><div>Welcome to the world of kernel hacking and speaking the 'truth' and being 'honest' </div><div>does have it's benefits as you will see soon :)</div><span class="gmail-"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_7012267879996735151gmail-">
> I recently gave an interview to one cloud security firm. The interviewer gave<br>
> me this particular assignment, since this kind of functionality is needed in<br>
> their software.<br></span></blockquote><div><br></div></span><div>Wish you good luck with the job !</div><span class="gmail-"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_7012267879996735151gmail-">
> Now I'm aware that the approach I have (syscall interception) is wrong.<br>
> But I also need to find out alternate mechanism to achieve my goal.<br>
> I searched really hard, but got nothing.<br></span></blockquote><div><br></div></span><div>Go through the link below very carefully, you do not require two modules. One single module</div><div>that intercepts a syscall and does what you have to do.. please do pay careful attention to the comments </div><div>within the code!</div><div><br></div><div><a href="https://github.com/jvns/kernel-module-fun/blob/master/rickroll.c" target="_blank">https://github.com/jvns/<wbr>kernel-module-fun/blob/master/<wbr>rickroll.c</a></div><span class="gmail-"><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_7012267879996735151gmail-">
<br>
</span>So it's a programming test to get a job? That's worse than trying to<br>
cheat on an exam, as it would mean that I pass the test, not you :(<br></blockquote></span><div><br>Though I agree 110% with gregkh 'I' also have been where Ajinkya is coming from so many times. </div><div>I have been there, done that too many times to walk away now so.. I understand the man's pain and frustration. </div><div>So against my better judgement I have given him something if he studies carefully will help him to do what its is he must. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
good luck!<br>
<div class="gmail-m_7012267879996735151gmail-HOEnZb"><div class="gmail-m_7012267879996735151gmail-h5"><br>
greg k-h<br>
<br></div></div></blockquote><div><br></div><div>Greg, he told us the plain truth and all he wants is some guidance. If I am out of line you can bust me as usual on IRC ! How is telling the simple and plain 'truth' equate to 'cheating" ? Duhh...</div><div><br></div><div>Good luck, hope this helps - Aruna</div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-m_7012267879996735151gmail-HOEnZb"><div class="gmail-m_7012267879996735151gmail-h5">
______________________________<wbr>_________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.or<wbr>g</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.or<wbr>g/mailman/listinfo/kernelnewbi<wbr>es</a><br>
</div></div></blockquote></div><br></div></div>
</blockquote></div><br></div></div>