From: "Irfan Ullah (울라 이르판)" <irfan@dke.khu.ac.kr>
To: kernelnewbies@kernelnewbies.org
Subject: Getting netlink socket creation returns NULL in the kernel
Date: Wed, 16 Oct 2019 13:54:08 +0900 [thread overview]
Message-ID: <CA+mB8OxW4zAHMY4qg_m0AzHc++jiyesNZLPAtsfMBz9XNRDJtg@mail.gmail.com> (raw)
[-- 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 --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next reply other threads:[~2019-10-16 4:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 4:54 Irfan Ullah (울라 이르판) [this message]
2019-10-16 14:29 ` Getting netlink socket creation returns NULL in the kernel Valdis Klētnieks
2019-10-17 6:23 ` Irfan Ullah (울라 이르판)
2019-10-22 8:31 ` Irfan Ullah (울라 이르판)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+mB8OxW4zAHMY4qg_m0AzHc++jiyesNZLPAtsfMBz9XNRDJtg@mail.gmail.com \
--to=irfan@dke.khu.ac.kr \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).