0

I wanted to add a function lets say foo to my program my_pgm.c. I used it by extern foo();

When I run Makefile to run my_pgm.c it went fine, but as it is not there in /proc/kallsym while doing insmod my_pgm.ko it throws errror.

insmod: ERROR: could not insert module my_pgm.ko: Unknown symbol in module

In dmesg it prints like Unknown symbol my_pgm (err 0)

foo defined as part of another file. I took the function pointer foo from there using nm another_file.ko. I wanted to insert this pointer entry into /proc/kallsyms

My question is can we modify /proc/kallsyms? If so how to modify it?(If I edit the file and override it then also changes are not reflecting when I reopen the file)

satyaGolladi
  • 180
  • 13
  • You should probably supply a MCVE. I am not following the declarations you are trying to describe. Also see [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – jww Aug 28 '18 at 11:42
  • 1
    Modifying `/proc/kallsyms` would be a terrible idea. Instead, make sure that your kernel module `my_pgm` is compiled with accessible **definition** of the function `foo()`. If the function is defined in other kernel module (say, `my_foo`), the simplest way would be compiling both modules (`my_pgm` and `my_foo`) in the single Makefile. Note, that kernel modules cannot call functions, defined in *user space* programs. – Tsyvarev Aug 28 '18 at 18:20

0 Answers0