Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux driver phys_mem_access_prot undefined

I have a loadable module that is throwing a warning about phys_mem_access_prot when built under Ubuntu 9.10 (Linux 2.6.31-22-server).

[664] make -C /lib/modules/`uname -r`/build M=`pwd` 
make: Entering directory `/usr/src/linux-headers-2.6.31-22-server'
  LD      /home/chuck/dev/svd/built-in.o
  CC [M]  /home/chuck/dev/svd/svd.o
  LD [M]  /home/chuck/dev/svd/svd_drv.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "phys_mem_access_prot" [/home/chuck/dev/svd/svd_drv.ko] undefined!
  CC      /home/chuck/dev/svd/svd_drv.mod.o
  LD [M]  /home/chuck/dev/svd/svd_drv.ko
make: Leaving directory `/usr/src/linux-headers-2.6.31-22-server'

The function does show up in the System.map-2.6.31-22-server file

[667] grep phys_mem_access_prot /boot/System.map-2.6.31-22-server 
ffffffff8103fb40 T phys_mem_access_prot
ffffffff8103fb50 T phys_mem_access_prot_allowed

and the driver loads, so I'm confused as to why modpost is unhappy. Is this a problem because the kernel doesn't export the function with EXPORT_SYMBOL()?

like image 806
ctuffli Avatar asked May 07 '26 12:05

ctuffli


1 Answers

You've answered you own question! Any kernel function used by a module needs to be exported by one of the various EXPORT_SYMBOL() macros.

You'll also see problems if non-GPL modules need to use functions exported by EXPORT_SYMBOL_GPL.

like image 68
stsquad Avatar answered May 10 '26 09:05

stsquad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!