I am trying to build kgdboe according to the following tutorial. I am running Ubuntu 20.04 with an updated kernel 5.9.0 as I needed a driver which was not available in stock kernel. I updated the kernel by downloading the headers, modules and kernel image .deb packages and installing them manually. My uname -r output is 5.9.0-050900-generic. When I try to build the module with make -C /lib/modules/$(uname -r)/build M=$(pwd), I get the error:

ERROR: modpost: "__module_address" [/home/ipc/Downloads/kgdboe/kgdboe.ko] undefined!

I have also manually downloaded complete Linux kernel source tree from GIT and checked out 5.9.0. If I make this module with path in make command pointing to the full source tree, the module buids. But since the module magic version and uname -r output doesn't match, I am unable to insert the module even with modprobe -f.

My question is, why am I not able to build with only the linux headers? Am I missing some step that prepares the headers folder for building modules? I am trying to find a way of building this module against the kernel headers or if I could update the version magic of built module (5.9.0) to uname -r output.

  • No luck with kernel 5.7.10 . ..... OK are kernels 3.10.x , 4.18.0 . ...... The code is not updated for 5.7 up → Please read from line 7 : github.com/sysprogs/kgdboe : "Added support for kernels up to 5.7.0". Commented Jul 5, 2021 at 18:33
  • @KnudLarsen Linux kernel seems to have many recent changes about limiting use of module symbols. I was able to build the kgbdoe module by manually exporting __module_address symbol and rebuilding kernel, which was unexported in this patch. Next step is to find and provide address of kallsyms_lookup_name to the kgdboe module, which is probably also something which was unexported.
    – Hamzahfrq
    Commented Jul 5, 2021 at 21:00

1 Answer 1


(Sorry for crappy editing)

KGBoE is not compatible with Linux kernel > v5.7.0 (see link). I had to patch the Linux kernel and KGDBoE source code to get KGDBoE to work as following:

  1. Export the missing symbols again in Kernel, that were unexported in recent kernel builds:

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c

index 4fb15fa96734..4669f3cfb55b 100644
--- a/kernel/kallsyms.c

+++ b/kernel/kallsyms.c
@@ -176,6 +176,7 @@ unsigned long kallsyms_lookup_name(const char *name)
        return module_kallsyms_lookup_name(name);
 int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
                                      unsigned long),
diff --git a/kernel/module.c b/kernel/module.c
index 1c5cff34d9f2..cd07a842bdb2 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4517,7 +4517,7 @@ struct module *__module_address(unsigned long addr)
        return mod;
  1. Disable KGDBoE Module parameter kallsyms_lookup_name_address by commenting the following:

    in file kgdboe_main.c

    //uint64_t kallsyms_lookup_name_address; //module_param(kallsyms_lookup_name_address, ullong, 0444);

    static int __init kgdboe_init(void) { // if (!kallsyms_lookup_name_address) // { // printk(KERN_ERR "kgdboe: this kernel version requires specifying the address of kallsyms_lookup_name explicitly. Please append 'kallsyms_lookup_name_address=0x...' to insmod command line.\n"); // return -EINVAL; // }

    in file tracewrapper.h: //extern uint64_t kallsyms_lookup_name_address; //#define kallsyms_lookup_name ((unsigned long(*)(const char *))kallsyms_lookup_name_address)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .