[help] How to test kernel code that I wrote?

Louie Lu louie.lu at hopebaytech.com
Wed Aug 24 07:39:30 EDT 2016


2016-08-24 18:23 GMT+08:00 Nikolay Borisov <n.borisov.lkml at gmail.com>:
>
>
> On 08/24/2016 01:18 PM, Louie Lu wrote:
>> Hi everyone,
>>
>> I'm now reading *Unreliable Guide To Locking* which came from
>> kernelnewbies.org (https://kernelnewbies.org/Documents/Kernel-Docbooks)
>>
>> What I want to do is trying run the code that in this doc from 7.1 All
>> In User Context.
>>
>> In my knowing for kernel programming,
>> I'll need to compile the code to something like
>> `main.ko` then insert into kernel space using `insmod`.
>>
>> Here is the GitHub that I'm doing PoC code:
>> https://github.com/grapherd/unreliable_guide_to_locking
>>
>> My question is,
>> Is my knowing right?
>> and, how can I use the function in main.ko (e.g. cache_add).
>> I'm using these function by test.ko, is that a normal way to use it?
>>
>> in this doc have mention, there have hardirq, softirq.
>> How can I test it from these irq method?
>>
>
> You have to create some sort of an interface which utilizes those kernel
> function. That might be IOCTL or procfiles or debugfs or any other
> number of UM<=>KM interfaces.
>

Thanks for reply, I'm now looking for procfs example,

like this: http://www.tldp.org/LDP/lkmpg/2.6/html/x710.html
or this: https://kernelnewbies.org/Documents/Kernel-Docbooks?action=AttachFile&do=get&target=procfs-guide_2.6.29.pdf

But it seems that all this tutorial were deprecate,
since 3.10 change for proc_create_entry()

Are there any resource for procfs to leran?

thanks!.

Louie Lu.

>
>>
>> Thanks!
>> Louie Lu.
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>



More information about the Kernelnewbies mailing list