LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-30-2012, 02:07 AM   #1
guppi278
LQ Newbie
 
Registered: Nov 2012
Posts: 5

Rep: Reputation: Disabled
Getting symbol version mismatch in the cdc_ether driver


Hi,
I am building a new loadable kernel module similar to usbnet.
i am reusing all the functionality of usbnet and and on top of that will have my own specific features ( for one of the demo project i am working at my organization).

i was able to create the module based on my code changes and was successfully able to run with a ECM based modem( which would use cdc_ether as minidriver).

But recently, i added some new functionality in the usbnet driver and when i load the module ,it loads successfully. However, as soon as i insert my ECM modem device, i start getting the following errors. On further debugging, its found that the below symbol errors are happening only when i include the following linux header files in usbnet.h

<linux/tcp.h>
<linux/udp.h>

i am not sure why the cdc_ether complains about the symbol version mismatch when i include the above two header files in my usbnet driver.
My makefile to build the module use the same kernel version which is installed. Compiler version also remains the same.

Can someone throw me some pointers as why this is happening and what's the solution to this?




[ 8949.900137] usb 2-1: new high speed USB device using ehci_hcd and address 22
[ 8950.084835] cdc_ether: disagrees about version of symbol usbnet_get_ethernet_addr
[ 8950.084845] cdc_ether: Unknown symbol usbnet_get_ethernet_addr (err -22)
[ 8950.085155] cdc_ether: disagrees about version of symbol usbnet_suspend
[ 8950.085162] cdc_ether: Unknown symbol usbnet_suspend (err -22)
[ 8950.085584] cdc_ether: disagrees about version of symbol usbnet_get_endpoints
[ 8950.085591] cdc_ether: Unknown symbol usbnet_get_endpoints (err -22)
[ 8950.086254] cdc_ether: disagrees about version of symbol usbnet_disconnect
[ 8950.086261] cdc_ether: Unknown symbol usbnet_disconnect (err -22)
[ 8950.086477] cdc_ether: disagrees about version of symbol usbnet_probe
[ 8950.086484] cdc_ether: Unknown symbol usbnet_probe (err -22)
[ 8950.086792] cdc_ether: disagrees about version of symbol usbnet_resume
[ 8950.086798] cdc_ether: Unknown symbol usbnet_resume (err -22)

Guppi
 
Old 12-01-2012, 01:12 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,350

Rep: Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331
Is everything built with the same kernel headers, glibc version & gcc version?

If so, trace the offending symbols in the header files and see if you can fond what's going on.
 
Old 12-02-2012, 02:34 PM   #3
guppi278
LQ Newbie
 
Registered: Nov 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
thanks business_kid for the reply.
Yes, i was able to figure out the root cause last week after further debugging, but still don't know the solution to this.

gcc and glibc version is same of the kernel as that of my module.
the reason i see those errors is because of difference in symbol versions of usbnet functions ( as imported by cdc_ether) in the generated Module.symvers of my usbnet module and that of /lib/modules/$(shell uname -r)/build/Module.symvers when i include <linux/udp.h> and <linux/tcp.h>

when i include </usr/include/linux/udp.h> in my module, then i DON'T see any errors.

there is BIG difference in code between /usr/include/linux/udp.h and /usr/src/linux-headers-`uname -r`/include/linux/udp.h ( which i downloaded based on current kernel installed). I can't use /usr/include/linux/udp.h since its missing lots of code which i want to use in my module.

to solve this i downloaded the linux source of the current installed kernel and re-compiled the kernel and then installed the kernel image + headers.When i re-compiled the kernel from the src, i checked that udp.h in the src is the latest and included all the functions that i needed.

But even after this i get the same errors as soon as i include <linux/udp.h> which is of course is being taken from linux source that i downloaded.


what's the solution to this?
 
Old 12-03-2012, 02:53 AM   #4
guppi278
LQ Newbie
 
Registered: Nov 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Just to clarify my question here.
it seems that when i compiled the kernel with the src ( which has the udp.h and tcp.h i wanted), it seems that it built usbnet module based on /usr/include/linux/udp.h( glib) instead of picking up the file from /usr/src/linux-headers-`uname -r`/include/linux/udp.h

my modified(customized) usbnet takes the src from /usr/src/linux-headers-`uname -r`/include/linux/udp.h
this is creating the symbol mismatch when i load cdc_ether with my customised usbnet.

does anyone know how can i compile the kernel and its internal modules purely based on /usr/src/linux-headers-`uname -r`/include/linux/udp.h
and NOT /usr/include/linux/udp.h
 
Old 12-03-2012, 03:36 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,350

Rep: Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331
I ran into this on lfs and hlfs back in the day.
gcc & glibc are the same - good. That leaves kernel headers. It is not unusual to see a different version of kernel headers from the kernel version in a distro. As the kernel updates, a new set of headers is rarely installed, and with good reason: You are open to this potentially awkward problem

You have traced it to /usr/include/linux/tcp.h. In your kernel source, there is another ~/include/linux/tcp.h. I would at least try that file from whatever kernel sources you have lying around.
 
Old 12-03-2012, 10:16 PM   #6
guppi278
LQ Newbie
 
Registered: Nov 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Taking a diff of </usr/include/linux/udp.h> and that of /usr/src/linux-headers-`uname -r`/include/linux/udp.h, it was noticed that the functions that I needed are defined under __KERNEL__

Question is:

When I compiled the kernel with the src, then the new udp.h and tcp.h is not taken into account in generating the usbnet symbols. Does anyone know why? If this because kernel compilation does not take into account ifdef __KERNEL__?
and only use /usr/include/linux/udp.h as its generic to all kernels?
 
Old 12-04-2012, 03:17 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,350

Rep: Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331
That's correct.
I'm definitely not the kernel expert here, but you have 2 commands to install the kernel headers
make headers_check which nowadays includes the obsolete command 'make headers_install'
This is described as a 'sanity check' on the headers, but actually bangs them in IIRC.

make headersdep some other checks - inclusion cycles?

Before those commands are run, the headers in the kernel are not 'fit for use.' After they are run, the headers are in /usr/include.
 
Old 12-04-2012, 01:09 PM   #8
guppi278
LQ Newbie
 
Registered: Nov 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi business_kid,
I was able to resolve the issue.
What i did is that i included the <linux/tcp.h> and <linux/udp.h> to the usbnet code of the kernel source of installed kernel.
I replaced /usr/include/linux/udp.h and tcp.h with the updated version from the kernel src.
I recompiled the kernel and installed.

Now when i compile my module with <linux/udp.h> and <linux/tcp.h>, i don't see the CRC errors.

One more solution i found was that one can disable the CRC check during "make menuconfig" for the loadable module.

the above two solutions are not the one that i wanted as my original thought was to make changes in usbnet module without re-compiling the kernel. seems like its not the case.
 
Old 12-05-2012, 10:17 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,350

Rep: Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331
Great! Mark this solved, then. Glad to help.
 
Old 12-06-2012, 08:31 AM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,668
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
I always follow a strict procedure:
  1. Make a permanent backup copy of the hidden-file ".config" as a named, un-hidden file in a directory of "/root."
  2. Temporarily rename that file.
  3. "make distclean"
  4. Rename the file back.
  5. The usual "make" sequence required.

"make distclean" removes everything, including the kernel config which is why I said save it. Then, everything is recompiled, and in so doing, you know that everything is done correctly.

Of course, I am using Gentoo, which is a source-based distribution, and that's one reason why I do so. You must by some means ensure that everything is compatible.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] OpenSSL version and libssl.so/libcrypto.so version mismatch pbidwell Linux - Software 3 08-11-2012 11:34 AM
ATI Driver Slackware 11.0 - StartX yields Xorg Version mismatch Old_Fogie Slackware 10 10-16-2006 12:12 PM
help, gcc version and kernel version mismatch akanitkar Linux - Newbie 1 05-06-2006 07:02 AM
Kernel version Source Version mismatch after recompile chuckleberry Linux - Software 1 06-20-2005 06:37 PM
Error "Kernel version mismatch" when nic driver will be loaded grubjo Linux - Networking 1 10-03-2003 04:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration