From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Fri, 20 Feb 2015 12:45:29 -0800 Subject: Kernel Mocking In-Reply-To: References: <20150220202427.GA23293@kroah.com> Message-ID: <20150220204529.GB23925@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, Feb 20, 2015 at 03:26:40PM -0500, Kenneth Adam Miller wrote: > Thanks for your expedient answer! > > So, I was discussing an alternative to mocking; function hooking. But in a > benign way. Is there any way to, at runtime replace the functionality of code > in order that you specify what it does for any given kernel function? Not really, but there are some hacks you can do if you _really_ know what you are doing. Hint, don't do this, just write "normal" tests for your kernel code, we have lots of them already in the source tree, look in tools/selftests/. Best of luck, greg k-h