Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
* Getting netlink socket creation returns NULL in the kernel
@ 2019-10-16  4:54 Irfan Ullah (울라 이르판)
  2019-10-16 14:29 ` Valdis Klētnieks
  0 siblings, 1 reply; 4+ messages in thread
From: Irfan Ullah (울라 이르판) @ 2019-10-16  4:54 UTC (permalink / raw)
  To: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 1763 bytes --]

Dear All,
I am trying to implement prefetching using machine learning in the kernel.
I need some data from the kernel directly. In this regard I have got very
useful comment that

> Don't do that (directly).  Pass the data to userspace via netlink or
debugfs or shared
memory or other means, and have userspace handle it.

      I am trying to pass data to the kernel space using netlink.
Following this
link <https://gist.github.com/arunk-s/c897bb9d75a6c98733d6>, I have
developed kernel space, and user space programs.  Kernel and user space
programs working perfectly when I load and run these modules from the
terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp”
respectively.  But, when I try to use kernel program  (directly as a header
file #include "kernelmodule.h") with the kernel original file that is
“vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in nl_sk
= netlink_kernel_create(&init_net, NETLINK_USER, &cfg);) .  I call  user
defined function, i.e., create_socket(unsigned long int addr) of
kernelmodule.h from handle_ept_voilation() in vmx.c.
handle_ept_voilation()  is called when ept fault occurs in case of virtual
machine.
Furthermore,  I have observed one weird behaviour: if I put 1-3 seconds
sleep just before the socket creating statement , then it works just during
booting of my virtual machine, after successful boot I get the same socket
NULL error.
Thank you for your help.



-- 
*Best Regards,*


*Mr. Irfan Ullah*
PhD Candidate
Data and Knowledge Engineering(DKE) Lab
Department of Computer Science and Engineering
Kyung Hee University, South Korea.
 +82-010-591-51651 <+82%2010-3877-8867>
  sahibzada.iu@gmail.com
 sahibzada_irfanullah

[-- Attachment #1.2: Type: text/html, Size: 3721 bytes --]

<div dir="ltr">Dear All,<div>I am trying to implement prefetching using machine learning in the kernel. I need some data from the kernel directly. In this regard I have got very useful comment that </div><div><br></div><div><div><font color="#741b47">&gt; Don&#39;t do that (directly).  Pass the data to userspace via netlink or debugfs or shared<br></font></div><font color="#741b47">memory or other means, and have userspace handle it. </font><font color="#a64d79"> </font></div><div><br></div><div>      I am trying to pass data to the kernel space using netlink. Following <a href="https://gist.github.com/arunk-s/c897bb9d75a6c98733d6">this link</a>, I have developed kernel space, and user space programs.  Kernel and user space programs working perfectly when I load and run these modules from the terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp” respectively.  But, when I try to use kernel program  (directly as a header file #include &quot;kernelmodule.h&quot;) with the kernel original file that is “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in nl_sk = netlink_kernel_create(&amp;init_net, NETLINK_USER, &amp;cfg);) .  I call  user defined function, i.e., create_socket(unsigned long int addr) of kernelmodule.h from handle_ept_voilation() in vmx.c. 

handle_ept_voilation()  is called when ept fault occurs in case of virtual machine.<br></div><div>Furthermore,  I have observed one weird behaviour: if I put 1-3 seconds sleep just before the socket creating statement , then it works just during booting of my virtual machine, after successful boot I get the same socket NULL error. </div><div>Thank you for your help.</div><div>  <br></div><div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><b style="color:rgb(39,78,19)">Best Regards,</b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div dir="ltr"><b style="color:rgb(39,78,19)">Mr. Irfan Ullah</b><br></div><div dir="ltr"><font color="#666666">PhD Candidate<br></font><div><font color="#666666">Data and Knowledge Engineering(DKE) Lab</font></div><div><font color="#666666">Department of Computer Science and Engineering</font></div><div><font color="#666666">Kyung Hee University, South Korea.</font></div><div><img src="http://teedayusa.com/media/wysiwyg/telephone_icon.gif" style="font-family:arial,sans-serif;font-size:12.8px"><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><span style="font-family:arial,sans-serif;font-size:12.8px"><font color="#000000"><a href="tel:+82%2010-3877-8867" value="+821038778867" style="color:rgb(17,85,204)" target="_blank">+82-010-591-51651</a></font></span></div><div><div style="font-family:arial,sans-serif;font-size:12.8px"><img src="http://www.letsplaydodgeball.com/ndo/templates/dj-sport01/images/system/emailButton.png" style="font-size:12.8px"><span style="font-size:12.8px"><font color="#000000">  </font></span><span style="font-size:12.8px"><font color="#000000"><a href="mailto:sahibzada.iu@gmail.com" style="color:rgb(17,85,204)" target="_blank">sahibzada.iu@gmail.com</a></font></span></div><div><font face="arial, sans-serif"><span style="font-size:12.8px"><img src="https://docs.google.com/uc?export=download&amp;id=0B1-dY3m3XHQnOFBOM0NSODNoUUU&amp;revid=0B1-dY3m3XHQnUmp1c0ZWTGovR2pYbGZCenlOU29DY3ByQU5RPQ" style="font-size:12.8px"></span></font><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><font face="arial, sans-serif"><span style="font-size:12.8px">sahibzada_irfanullah</span></font></div></div></div></div></div></div></div>

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Getting netlink socket creation returns NULL in the kernel
  2019-10-16  4:54 Getting netlink socket creation returns NULL in the kernel Irfan Ullah (울라 이르판)
@ 2019-10-16 14:29 ` Valdis Klētnieks
  2019-10-17  6:23   ` Irfan Ullah (울라 이르판)
  0 siblings, 1 reply; 4+ messages in thread
From: Valdis Klētnieks @ 2019-10-16 14:29 UTC (permalink / raw)
  To: Irfan Ullah (울라
	이르판)
  Cc: kernelnewbies

[-- Warning: decoded text below may be mangled --]
[-- Attachment #1.1: Type: text/plain; charset=us-ascii, Size: 680 bytes --]

On Wed, 16 Oct 2019 13:54:08 +0900, Irfan Ullah said:

> developed kernel space, and user space programs.  Kernel and user space
> programs working perfectly when I load and run these modules from the
> terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp”
> respectively.  But, when I try to use kernel program  (directly as a header
> file #include "kernelmodule.h") with the kernel original file that is
> “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in nl_sk

You're going to have to explain in more detail what you're doing, and possibly
share your code.  "when I try to use kernel program directly" doesn't make sense....


[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Getting netlink socket creation returns NULL in the kernel
  2019-10-16 14:29 ` Valdis Klētnieks
@ 2019-10-17  6:23   ` Irfan Ullah (울라 이르판)
  2019-10-22  8:31     ` Irfan Ullah (울라 이르판)
  0 siblings, 1 reply; 4+ messages in thread
From: Irfan Ullah (울라 이르판) @ 2019-10-17  6:23 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 3345 bytes --]

My actual goal is to develop kernel space and user space programs to
establish communication in which kernel should initiate the communication.
The kernel will send information (e.g., guest physical address from
handle_ept_violation() in vmx.c, finding the corresponding page of that
address, owner process (or if possible the application, i.e., VLC, open
office) of the page, process/application releasing the page) at run time to
the user space application.
I have written code  consists of three file i.e., netlink_kernel_module.c,
netlink_kernel_space.h, netlink_user_module.c.  "netlink_kernel_module.c"
contains just kernel loading/ unloading module functions i.e., __init
hello_init(), and _exit hello_exit().  "netlink_kernel_space.h" contains
all the rest of the kernel space code for sending/ receiving data while
 "netlink_user_module.c" contains the user space application code for
sending/receiving data.

*During development and testing* I use  "netlink_kernel_module.c" to load
and unload kernel module, in which the "__init hello_init()" just call the
"create_socket(int data)" defined in  "netlink_kernel_space.h" with the
data which I want to pass to the user space program. And my code works
perfectly in this way.

*But, To get the required data from the kernel in real time*, I include  "
netlink_kernel_space.h " in kernel file i.e., vmx.c and call the
"create_socket(int data)"  from the handle_ept_voilation() defined in vmx.c
<https://elixir.bootlin.com/linux/latest/source/arch/x86/kvm/vmx/vmx.c#L5079>
after
line#5098. I compile, and install the kernel, and reboot the system (and
thus I don't need  "netlink_kernel_module.c"  because I don't load/unload
the kernel module but include  "netlink_kernel_space.h"  in the vmx.c by
using #include "netlink_kernel_space.h").  But, I am getting “NULL” while
creating socket (nl_sk = NULL in nl_sk = netlink_kernel_create(&init_net,
NETLINK_USER, &cfg);). Here code also shows weird behaviour. If I put 1-3
seconds sleep just before the socket creating statement, then it works just
during booting of the virtual machine, after successful boot I get the same
socket NULL error. Please find the code in the attachment..
Thank you very much.

On Wed, Oct 16, 2019 at 11:29 PM Valdis Klētnieks <valdis.kletnieks@vt.edu>
wrote:

> On Wed, 16 Oct 2019 13:54:08 +0900, Irfan Ullah said:
>
> > developed kernel space, and user space programs.  Kernel and user space
> > programs working perfectly when I load and run these modules from the
> > terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp”
> > respectively.  But, when I try to use kernel program  (directly as a
> header
> > file #include "kernelmodule.h") with the kernel original file that is
> > “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in
> nl_sk
>
> You're going to have to explain in more detail what you're doing, and
> possibly
> share your code.  "when I try to use kernel program directly" doesn't make
> sense....
>
>

-- 
*Best Regards,*


*Mr. Irfan Ullah*
PhD Candidate
Data and Knowledge Engineering(DKE) Lab
Department of Computer Science and Engineering
Kyung Hee University, South Korea.
 +82-010-591-51651 <+82%2010-3877-8867>
  sahibzada.iu@gmail.com
 sahibzada_irfanullah

[-- Attachment #1.2: Type: text/html, Size: 5610 bytes --]

<div dir="ltr"><div>My actual goal is to develop kernel space and user space programs to establish communication in which kernel should initiate the communication. The kernel will send information (e.g., guest physical address from handle_ept_violation() in vmx.c, finding the corresponding page of that address, owner process (or if possible the application, i.e., VLC, open office) of the page, process/application releasing the page) at run time to the user space application. </div><div>I have written code  consists of three file i.e., netlink_kernel_module.c, netlink_kernel_space.h, netlink_user_module.c.  &quot;netlink_kernel_module.c&quot; contains just kernel loading/ unloading module functions i.e., __init hello_init(), and _exit hello_exit().  &quot;netlink_kernel_space.h&quot; contains all the rest of the kernel space code for sending/ receiving data while   &quot;netlink_user_module.c&quot; contains the user space application code for sending/receiving data. </div><div><br></div><div><b>During development and testing</b> I use  &quot;netlink_kernel_module.c&quot; to load and unload kernel module, in which the &quot;__init hello_init()&quot; just call the &quot;create_socket(int data)&quot; defined in  &quot;netlink_kernel_space.h&quot;

with the data which I want to pass to the user space program. And my code works perfectly in this way. </div><div><br></div><div><b>But, To get the required data from the kernel in real time</b>, I include  &quot;

netlink_kernel_space.h

&quot; in kernel file i.e., vmx.c and call the  &quot;create_socket(int data)&quot;  from the <a href="https://elixir.bootlin.com/linux/latest/source/arch/x86/kvm/vmx/vmx.c#L5079" target="_blank">handle_ept_voilation() defined in vmx.c</a> after line#5098. I compile, and install the kernel, and reboot the system (and thus I don&#39;t need  

&quot;netlink_kernel_module.c&quot;  because I don&#39;t load/unload the kernel module but include 

&quot;netlink_kernel_space.h&quot;  in the vmx.c by using #include &quot;netlink_kernel_space.h&quot;).  But, I am getting “NULL” while creating socket (nl_sk = NULL in nl_sk = netlink_kernel_create(&amp;init_net, NETLINK_USER, &amp;cfg);). Here code also shows weird behaviour. If I put 1-3 seconds sleep just before the socket creating statement, then it works just during booting of the virtual machine, after successful boot I get the same socket NULL error. Please find the code in the attachment..</div><div>Thank you very much.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 16, 2019 at 11:29 PM Valdis Klētnieks &lt;<a href="mailto:valdis.kletnieks@vt.edu" target="_blank">valdis.kletnieks@vt.edu</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 16 Oct 2019 13:54:08 +0900, Irfan Ullah said:<br>
<br>
&gt; developed kernel space, and user space programs.  Kernel and user space<br>
&gt; programs working perfectly when I load and run these modules from the<br>
&gt; terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp”<br>
&gt; respectively.  But, when I try to use kernel program  (directly as a header<br>
&gt; file #include &quot;kernelmodule.h&quot;) with the kernel original file that is<br>
&gt; “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in nl_sk<br>
<br>
You&#39;re going to have to explain in more detail what you&#39;re doing, and possibly<br>
share your code.  &quot;when I try to use kernel program directly&quot; doesn&#39;t make sense....<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><b style="color:rgb(39,78,19)">Best Regards,</b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div dir="ltr"><b style="color:rgb(39,78,19)">Mr. Irfan Ullah</b><br></div><div dir="ltr"><font color="#666666">PhD Candidate<br></font><div><font color="#666666">Data and Knowledge Engineering(DKE) Lab</font></div><div><font color="#666666">Department of Computer Science and Engineering</font></div><div><font color="#666666">Kyung Hee University, South Korea.</font></div><div><img src="http://teedayusa.com/media/wysiwyg/telephone_icon.gif" style="font-family: arial, sans-serif; font-size: 12.8px;"><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><span style="font-family:arial,sans-serif;font-size:12.8px"><font color="#000000"><a href="tel:+82%2010-3877-8867" value="+821038778867" style="color:rgb(17,85,204)" target="_blank">+82-010-591-51651</a></font></span></div><div><div style="font-family:arial,sans-serif;font-size:12.8px"><img src="http://www.letsplaydodgeball.com/ndo/templates/dj-sport01/images/system/emailButton.png" style="font-size: 12.8px;"><span style="font-size:12.8px"><font color="#000000">  </font></span><span style="font-size:12.8px"><font color="#000000"><a href="mailto:sahibzada.iu@gmail.com" style="color:rgb(17,85,204)" target="_blank">sahibzada.iu@gmail.com</a></font></span></div><div><font face="arial, sans-serif"><span style="font-size:12.8px"><img src="https://docs.google.com/uc?export=download&amp;id=0B1-dY3m3XHQnOFBOM0NSODNoUUU&amp;revid=0B1-dY3m3XHQnUmp1c0ZWTGovR2pYbGZCenlOU29DY3ByQU5RPQ" style="font-size: 12.8px;"></span></font><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><font face="arial, sans-serif"><span style="font-size:12.8px">sahibzada_irfanullah</span></font></div></div></div></div></div>

[-- Attachment #2: Kernel_User_comm.zip --]
[-- Type: application/zip, Size: 7514 bytes --]

[-- Attachment #3: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Getting netlink socket creation returns NULL in the kernel
  2019-10-17  6:23   ` Irfan Ullah (울라 이르판)
@ 2019-10-22  8:31     ` Irfan Ullah (울라 이르판)
  0 siblings, 0 replies; 4+ messages in thread
From: Irfan Ullah (울라 이르판) @ 2019-10-22  8:31 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 4004 bytes --]

Still, I am stuck in the same problem, I have also used share memory, and
while(!nl_sk) but nothing work:(.
Can you please tell me what's the mistake I am doing?

On Thu, Oct 17, 2019 at 3:23 PM Irfan Ullah (울라 이르판) <irfan@dke.khu.ac.kr>
wrote:

> My actual goal is to develop kernel space and user space programs to
> establish communication in which kernel should initiate the communication.
> The kernel will send information (e.g., guest physical address from
> handle_ept_violation() in vmx.c, finding the corresponding page of that
> address, owner process (or if possible the application, i.e., VLC, open
> office) of the page, process/application releasing the page) at run time to
> the user space application.
> I have written code  consists of three file i.e., netlink_kernel_module.c,
> netlink_kernel_space.h, netlink_user_module.c.  "netlink_kernel_module.c"
> contains just kernel loading/ unloading module functions i.e., __init
> hello_init(), and _exit hello_exit().  "netlink_kernel_space.h" contains
> all the rest of the kernel space code for sending/ receiving data while
>  "netlink_user_module.c" contains the user space application code for
> sending/receiving data.
>
> *During development and testing* I use  "netlink_kernel_module.c" to load
> and unload kernel module, in which the "__init hello_init()" just call the
> "create_socket(int data)" defined in  "netlink_kernel_space.h" with the
> data which I want to pass to the user space program. And my code works
> perfectly in this way.
>
> *But, To get the required data from the kernel in real time*, I include
> " netlink_kernel_space.h " in kernel file i.e., vmx.c and call the
> "create_socket(int data)"  from the handle_ept_voilation() defined in
> vmx.c
> <https://elixir.bootlin.com/linux/latest/source/arch/x86/kvm/vmx/vmx.c#L5079> after
> line#5098. I compile, and install the kernel, and reboot the system (and
> thus I don't need  "netlink_kernel_module.c"  because I don't load/unload
> the kernel module but include  "netlink_kernel_space.h"  in the vmx.c by
> using #include "netlink_kernel_space.h").  But, I am getting “NULL” while
> creating socket (nl_sk = NULL in nl_sk = netlink_kernel_create(&init_net,
> NETLINK_USER, &cfg);). Here code also shows weird behaviour. If I put 1-3
> seconds sleep just before the socket creating statement, then it works just
> during booting of the virtual machine, after successful boot I get the same
> socket NULL error. Please find the code in the attachment..
> Thank you very much.
>
> On Wed, Oct 16, 2019 at 11:29 PM Valdis Klētnieks <valdis.kletnieks@vt.edu>
> wrote:
>
>> On Wed, 16 Oct 2019 13:54:08 +0900, Irfan Ullah said:
>>
>> > developed kernel space, and user space programs.  Kernel and user space
>> > programs working perfectly when I load and run these modules from the
>> > terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp”
>> > respectively.  But, when I try to use kernel program  (directly as a
>> header
>> > file #include "kernelmodule.h") with the kernel original file that is
>> > “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in
>> nl_sk
>>
>> You're going to have to explain in more detail what you're doing, and
>> possibly
>> share your code.  "when I try to use kernel program directly" doesn't
>> make sense....
>>
>>
>
> --
> *Best Regards,*
>
>
> *Mr. Irfan Ullah*
> PhD Candidate
> Data and Knowledge Engineering(DKE) Lab
> Department of Computer Science and Engineering
> Kyung Hee University, South Korea.
>  +82-010-591-51651 <+82%2010-3877-8867>
>   sahibzada.iu@gmail.com
>  sahibzada_irfanullah
>


-- 
*Best Regards,*


*Mr. Irfan Ullah*
PhD Candidate
Data and Knowledge Engineering(DKE) Lab
Department of Computer Science and Engineering
Kyung Hee University, South Korea.
 +82-010-591-51651 <+82%2010-3877-8867>
  sahibzada.iu@gmail.com
 sahibzada_irfanullah

[-- Attachment #1.2: Type: text/html, Size: 8106 bytes --]

<div dir="ltr">Still, I am stuck in the same problem, I have also used share memory, and while(!nl_sk) but nothing work:(.<div>Can you please tell me what&#39;s the mistake I am doing?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2019 at 3:23 PM Irfan Ullah (울라 이르판) &lt;<a href="mailto:irfan@dke.khu.ac.kr">irfan@dke.khu.ac.kr</a>&gt; wrote:<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 dir="ltr"><div>My actual goal is to develop kernel space and user space programs to establish communication in which kernel should initiate the communication. The kernel will send information (e.g., guest physical address from handle_ept_violation() in vmx.c, finding the corresponding page of that address, owner process (or if possible the application, i.e., VLC, open office) of the page, process/application releasing the page) at run time to the user space application. </div><div>I have written code  consists of three file i.e., netlink_kernel_module.c, netlink_kernel_space.h, netlink_user_module.c.  &quot;netlink_kernel_module.c&quot; contains just kernel loading/ unloading module functions i.e., __init hello_init(), and _exit hello_exit().  &quot;netlink_kernel_space.h&quot; contains all the rest of the kernel space code for sending/ receiving data while   &quot;netlink_user_module.c&quot; contains the user space application code for sending/receiving data. </div><div><br></div><div><b>During development and testing</b> I use  &quot;netlink_kernel_module.c&quot; to load and unload kernel module, in which the &quot;__init hello_init()&quot; just call the &quot;create_socket(int data)&quot; defined in  &quot;netlink_kernel_space.h&quot;

with the data which I want to pass to the user space program. And my code works perfectly in this way. </div><div><br></div><div><b>But, To get the required data from the kernel in real time</b>, I include  &quot;

netlink_kernel_space.h

&quot; in kernel file i.e., vmx.c and call the  &quot;create_socket(int data)&quot;  from the <a href="https://elixir.bootlin.com/linux/latest/source/arch/x86/kvm/vmx/vmx.c#L5079" target="_blank">handle_ept_voilation() defined in vmx.c</a> after line#5098. I compile, and install the kernel, and reboot the system (and thus I don&#39;t need  

&quot;netlink_kernel_module.c&quot;  because I don&#39;t load/unload the kernel module but include 

&quot;netlink_kernel_space.h&quot;  in the vmx.c by using #include &quot;netlink_kernel_space.h&quot;).  But, I am getting “NULL” while creating socket (nl_sk = NULL in nl_sk = netlink_kernel_create(&amp;init_net, NETLINK_USER, &amp;cfg);). Here code also shows weird behaviour. If I put 1-3 seconds sleep just before the socket creating statement, then it works just during booting of the virtual machine, after successful boot I get the same socket NULL error. Please find the code in the attachment..</div><div>Thank you very much.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 16, 2019 at 11:29 PM Valdis Klētnieks &lt;<a href="mailto:valdis.kletnieks@vt.edu" target="_blank">valdis.kletnieks@vt.edu</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 16 Oct 2019 13:54:08 +0900, Irfan Ullah said:<br>
<br>
&gt; developed kernel space, and user space programs.  Kernel and user space<br>
&gt; programs working perfectly when I load and run these modules from the<br>
&gt; terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp”<br>
&gt; respectively.  But, when I try to use kernel program  (directly as a header<br>
&gt; file #include &quot;kernelmodule.h&quot;) with the kernel original file that is<br>
&gt; “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in nl_sk<br>
<br>
You&#39;re going to have to explain in more detail what you&#39;re doing, and possibly<br>
share your code.  &quot;when I try to use kernel program directly&quot; doesn&#39;t make sense....<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><b style="color:rgb(39,78,19)">Best Regards,</b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div dir="ltr"><b style="color:rgb(39,78,19)">Mr. Irfan Ullah</b><br></div><div dir="ltr"><font color="#666666">PhD Candidate<br></font><div><font color="#666666">Data and Knowledge Engineering(DKE) Lab</font></div><div><font color="#666666">Department of Computer Science and Engineering</font></div><div><font color="#666666">Kyung Hee University, South Korea.</font></div><div><img src="http://teedayusa.com/media/wysiwyg/telephone_icon.gif" style="font-family: arial, sans-serif; font-size: 12.8px;"><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><span style="font-family:arial,sans-serif;font-size:12.8px"><font color="#000000"><a href="tel:+82%2010-3877-8867" value="+821038778867" style="color:rgb(17,85,204)" target="_blank">+82-010-591-51651</a></font></span></div><div><div style="font-family:arial,sans-serif;font-size:12.8px"><img src="http://www.letsplaydodgeball.com/ndo/templates/dj-sport01/images/system/emailButton.png" style="font-size: 12.8px;"><span style="font-size:12.8px"><font color="#000000">  </font></span><span style="font-size:12.8px"><font color="#000000"><a href="mailto:sahibzada.iu@gmail.com" style="color:rgb(17,85,204)" target="_blank">sahibzada.iu@gmail.com</a></font></span></div><div><font face="arial, sans-serif"><span style="font-size:12.8px"><img src="https://docs.google.com/uc?export=download&amp;id=0B1-dY3m3XHQnOFBOM0NSODNoUUU&amp;revid=0B1-dY3m3XHQnUmp1c0ZWTGovR2pYbGZCenlOU29DY3ByQU5RPQ" style="font-size: 12.8px;"></span></font><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><font face="arial, sans-serif"><span style="font-size:12.8px">sahibzada_irfanullah</span></font></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><b style="color:rgb(39,78,19)">Best Regards,</b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div><b style="color:rgb(39,78,19)"><br></b></div><div dir="ltr"><b style="color:rgb(39,78,19)">Mr. Irfan Ullah</b><br></div><div dir="ltr"><font color="#666666">PhD Candidate<br></font><div><font color="#666666">Data and Knowledge Engineering(DKE) Lab</font></div><div><font color="#666666">Department of Computer Science and Engineering</font></div><div><font color="#666666">Kyung Hee University, South Korea.</font></div><div><img src="http://teedayusa.com/media/wysiwyg/telephone_icon.gif" style="font-family: arial, sans-serif; font-size: 12.8px;"><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><span style="font-family:arial,sans-serif;font-size:12.8px"><font color="#000000"><a href="tel:+82%2010-3877-8867" value="+821038778867" style="color:rgb(17,85,204)" target="_blank">+82-010-591-51651</a></font></span></div><div><div style="font-family:arial,sans-serif;font-size:12.8px"><img src="http://www.letsplaydodgeball.com/ndo/templates/dj-sport01/images/system/emailButton.png" style="font-size: 12.8px;"><span style="font-size:12.8px"><font color="#000000">  </font></span><span style="font-size:12.8px"><font color="#000000"><a href="mailto:sahibzada.iu@gmail.com" style="color:rgb(17,85,204)" target="_blank">sahibzada.iu@gmail.com</a></font></span></div><div><font face="arial, sans-serif"><span style="font-size:12.8px"><img src="https://docs.google.com/uc?export=download&amp;id=0B1-dY3m3XHQnOFBOM0NSODNoUUU&amp;revid=0B1-dY3m3XHQnUmp1c0ZWTGovR2pYbGZCenlOU29DY3ByQU5RPQ" style="font-size: 12.8px;"></span></font><span style="font-family:arial,sans-serif;font-size:12.8px"> </span><font face="arial, sans-serif"><span style="font-size:12.8px">sahibzada_irfanullah</span></font></div></div></div></div></div>

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16  4:54 Getting netlink socket creation returns NULL in the kernel Irfan Ullah (울라 이르판)
2019-10-16 14:29 ` Valdis Klētnieks
2019-10-17  6:23   ` Irfan Ullah (울라 이르판)
2019-10-22  8:31     ` Irfan Ullah (울라 이르판)

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git