Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
From: "Irfan Ullah (울라 이르판)" <irfan@dke.khu.ac.kr>
To: kernelnewbies@kernelnewbies.org
Subject: Kernel Module with multiple source files not initializing
Date: Fri, 25 Oct 2019 18:14:42 +0900
Message-ID: <CA+mB8Oz1Hu82nk2vbinhpOQW8uasp7_b8CFNf2jNovqP==OH6A@mail.gmail.com> (raw)

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

Dear All,
I have developed a kernel module consists of one source file that sends and
receives  message to the user space.  I have spitted the source code in two
files, and now I  am trying to develop kernel module from these source
files. After compiling and linking without any problems, I insmod the
module but I didn’t see any of the printk() I wrote, in fact, the module
can be inserted and removed, but it does nothing. Code is in the attached
file zipped file.
I tried many things , e.g.,  link <https://paguilar.org/?p=7>1, link2
<https://www.linuxquestions.org/questions/linux-kernel-70/kernel-module-with-multiple-source-files-not-initializing-886190/>,
and link3
<https://android.googlesource.com/kernel/msm/+/android-msm-dory-3.10-kitkat-wear/Documentation/kbuild/modules.txt>
etc.
but nothings worked out.
I also used *nm* to inspect the module, but, as expected, there was no
signs of "__init and __exit" functions can in the output.
                                 U __alloc_skb
00000000000001c0 T create_socket
0000000000000030 T data_update
                                 U __fentry__
                                 U fortify_panic
0000000000000000 r __func__.5058
                                 U init_net
0000000000000000 t kernel_space_receiver
0000000000000080 T kernel_space_sender
                                  U memcpy
0000000000000038 r __module_depends
0000000000000008 D msg_size
                                 U msleep
                                 U __netlink_kernel_create
                                 U netlink_kernel_release
                                 U netlink_unicast
0000000000000078 B nlh
                                 U __nlmsg_put
0000000000000080 B nl_sk
0000000000000000 r _note_6
0000000000000004 D pid
                                 U printk
0000000000000000 D res
0000000000000000 B s_data
0000000000000070 B skb_out
                                  U __stack_chk_fail
                                  U strlen
0000000000000000 D __this_module
0000000000000000 r __UNIQUE_ID_license381
000000000000004d r __UNIQUE_ID_name240
0000000000000041 r __UNIQUE_ID_retpoline241
0000000000000010 r __UNIQUE_ID_srcversion242
0000000000000068 r __UNIQUE_ID_vermagic239
--------------------
*Following is the output of some useful commands:*
-------------------------------------------------
*ssd@ssd:~/Desktop/Kernel_User_comm$ ls*
Makefile  netlink_kernel_module.c  netlink_kernel_space.c
 netlink_kernel_space.h  netlink_user_module.c
---------------------------------------------------
*ssd@ssd:~/Kernel_User_comm$ make --version*
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
-------------------------------------------------------
*ssd@ssd:~/Kernel_User_comm$ uname -r*
5.2.0-rc6
--------------------------------------------------------
Can you please help me: what's the problem/mistake I am doing?
Thank you very much.

-- 
*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: 5970 bytes --]

<div dir="ltr">Dear All,<div>I have developed a kernel module consists of one source file that sends and receives  message to the user space.  I have spitted the source code in two files, and now I  am trying to develop kernel module from these source files. After compiling and linking without any problems, I insmod the module but I didn’t see any of the printk() I wrote, in fact, the module can be inserted and removed, but it does nothing. Code is in the attached file zipped file.</div><div>I tried many things , e.g.,  <a href="https://paguilar.org/?p=7" target="_blank">link</a>1, <a href="https://www.linuxquestions.org/questions/linux-kernel-70/kernel-module-with-multiple-source-files-not-initializing-886190/" target="_blank">link2</a>, and <a href="https://android.googlesource.com/kernel/msm/+/android-msm-dory-3.10-kitkat-wear/Documentation/kbuild/modules.txt" target="_blank">link3</a> etc.  but nothings worked out. </div><div>I also used <i>nm</i> to inspect the module, but, as expected, there was no signs of &quot;__init and __exit&quot; functions can in the output. </div><font color="#a64d79">                             </font><font color="#741b47">    U __alloc_skb<br>00000000000001c0 T create_socket<br>0000000000000030 T data_update<br>                                 U __fentry__<br>                                 U fortify_panic<br>0000000000000000 r __func__.5058<br>                                 U init_net<br>0000000000000000 t kernel_space_receiver<br>0000000000000080 T kernel_space_sender<br>                                  U memcpy<br>0000000000000038 r __module_depends<br>0000000000000008 D msg_size<br>                                 U msleep<br>                                 U __netlink_kernel_create<br>                                 U netlink_kernel_release<br>                                 U netlink_unicast<br>0000000000000078 B nlh<br>                                 U __nlmsg_put<br>0000000000000080 B nl_sk<br>0000000000000000 r _note_6<br>0000000000000004 D pid<br>                                 U printk<br>0000000000000000 D res<br>0000000000000000 B s_data<br>0000000000000070 B skb_out<br>                                  U __stack_chk_fail<br>                                  U strlen<br>0000000000000000 D __this_module<br>0000000000000000 r __UNIQUE_ID_license381<br>000000000000004d r __UNIQUE_ID_name240<br>0000000000000041 r __UNIQUE_ID_retpoline241<br>0000000000000010 r __UNIQUE_ID_srcversion242<br>0000000000000068 r __UNIQUE_ID_vermagic239</font><div>--------------------</div><div><b>Following is the output of some useful commands:</b></div><div>-------------------------------------------------</div><div><b>ssd@ssd:~/Desktop/Kernel_User_comm$ ls</b><br><font color="#741b47">Makefile  netlink_kernel_module.c  netlink_kernel_space.c  netlink_kernel_space.h  netlink_user_module.c</font><br></div><div>---------------------------------------------------</div><div><b>ssd@ssd:~/Kernel_User_comm$ make --version</b><br><font color="#741b47">GNU Make 4.1<br>Built for x86_64-pc-linux-gnu<br>Copyright (C) 1988-2014 Free Software Foundation, Inc.<br>License GPLv3+: GNU GPL version 3 or later &lt;<a href="http://gnu.org/licenses/gpl.html" target="_blank">http://gnu.org/licenses/gpl.html</a>&gt;<br>This is free software: you are free to change and redistribute it.<br>There is NO WARRANTY, to the extent permitted by law.</font><br></div><div>-------------------------------------------------------</div><div><b>ssd@ssd:~/Kernel_User_comm$ uname -r</b><br><font color="#741b47">5.2.0-rc6</font><br></div><div>--------------------------------------------------------</div><div>Can you please help me: what&#39;s the problem/mistake I am doing?</div><div>Thank you very much.</div><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>

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

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

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

             reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  9:14 Irfan Ullah (울라 이르판) [this message]
2019-10-25 16:15 ` Abu Rasheda
2019-10-27  7:11   ` Irfan Ullah (울라 이르판)
2019-10-27  8:43 ` Bernd Petrovitsch
2019-10-28  9:43   ` Irfan Ullah (울라 이르판)
2019-10-28 10:04     ` Bernd Petrovitsch
2019-10-29  8:30       ` Irfan Ullah (울라 이르판)
2019-11-05 16:52 ` Aruna Hewapathirane
2019-11-07  1:50   ` Irfan Ullah (울라 이르판)

Reply instructions:

You may reply publically 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+mB8Oz1Hu82nk2vbinhpOQW8uasp7_b8CFNf2jNovqP==OH6A@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

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