1

I'm writing a simple kernel module and it seems on the newest kernel versions (I've tried 5.8, 5.10, 6.0) functions like kallsyms_lookup_name and kallsyms_on_each_symbol are no longer exported, meaning they can't be accessed through kallsyms.h. So, how do I access the list containing all the kernel symbols and their addresses from the kernel module? What's the best approach?

I'm able to find them with a shell command sudo cat /proc/kallsyms/ but now I wanna be able to do that from the k.o. Any suggestions?

  • grep  KALLSYMS in your kernel .config file. If CONFIG_KALLSYMS and CONFIG_KALLSYMS_ALL are not set then set them and rebuild your kernel. – MC68020 Nov 01 '22 at 14:15
  • @MC68020 that won’t help — as explained in the question, the symbol lookup functions aren’t accessible from kernel modules any more. See [this comment](https://unix.stackexchange.com/questions/654555/calling-linux-kernel-methods-from-a-kernel-module/654564#comment1230670_654564) for discussion, and [the linked Q&A](https://unix.stackexchange.com/q/643206/86440) for some ideas of workarounds. – Stephen Kitt Nov 01 '22 at 14:22

0 Answers0