<div dir="ltr">Well I think that a function or system call semantics replacement facility would be useful to unit testers everywhere. It would be benign of course, requiring that the unit testing framework request of the kernel that it replace the kernel facilities specified prior to the test, and automatically replace them afterward. So, this isn&#39;t anything akin to doing anything malicious, it requires user cooperation in order to hook. It&#39;s not like something forcibly done. I&#39;m thinking of an intel pin for kernel level code.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 20, 2015 at 3:45 PM, Greg KH <span dir="ltr">&lt;<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Feb 20, 2015 at 03:26:40PM -0500, Kenneth Adam Miller wrote:<br>
&gt; Thanks for your expedient answer!<br>
&gt;<br>
&gt; So, I was discussing an alternative to mocking; function hooking. But in a<br>
&gt; benign way. Is there any way to, at runtime replace the functionality of code<br>
&gt; in order that you specify what it does for any given kernel function?<br>
<br>
</span>Not really, but there are some hacks you can do if you _really_ know<br>
what you are doing.<br>
<br>
Hint, don&#39;t do this, just write &quot;normal&quot; tests for your kernel code, we<br>
have lots of them already in the source tree, look in tools/selftests/.<br>
<br>
Best of luck,<br>
<br>
greg k-h<br>
</blockquote></div><br></div>