Two Problems: 1) LinuxKernelDebugHelper seg fault AND 2) KGDBoE build fails

Sysprogs forums Forums VisualKernel Two Problems: 1) LinuxKernelDebugHelper seg fault AND 2) KGDBoE build fails

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7239
    spkarjalainen
    Participant

    My setup: VisualKernal+VS2015  –> (build machine) Ubuntu machine with ‘buildroot’ custom toolchain –> (target/deployment machine) SAMA5 device connected via Ethernet, running the buildroot kernel + rootfs

    First point: VisualGDB  projects compile, run and debug perfectly with the above configuration.

    However, I keep running into problems with VisualKernel projects:

    1) I have setup the VisualKernel project along the lines of “Building a Linux Kernel module using a second machine” with changes as necessary for the custom buildroot toolchain, and then changing the debug method along the lines of the KGDBoE tutorial (i.e. using the default KGDBoE settings)

    2) The VisualKernel project compiles fine, and actually runs fine if I manually insmod it on the target SAMA5 device.

    3) However, when attempting to debug the project,

    3.1) Firstly,  the LinuxKernelDebugHelper module fails to load (“Cannot load LinuxKernelDebugHelper…” : segmentation fault)

    — Please see end of this post for associated /var/log/messages from SAMA5 target device.

    3.2) Secondly, continuing on from the above failure, VisualKernel attempts to build the KGDBoE module and this fails (“Cannot build kgdboe”)

    The important part of the returned log shown following my signoff.

    Can you please provide any guidance?

    —————— KGDBoE build failure relevant messages —————–

    /tmp/kgdboe-cc9dd9a2-4721-445a-835a-f8622b9a5cef/kgdboe_io.c: In function ‘force_single_cpu_mode’:
    /tmp/kgdboe-cc9dd9a2-4721-445a-835a-f8622b9a5cef/kgdboe_io.c:119:3: error: implicit declaration of function ‘cpu_down’ [-Werror=implicit-function-declaration]
    cpu_down(i);
    ^
    cc1: some warnings being treated as errors

    make[1]: *** [/tmp/kgdboe-cc9dd9a2-4721-445a-835a-f8622b9a5cef/kgdboe_io.o] Error 1

    make: *** [_module_/tmp/kgdboe-cc9dd9a2-4721-445a-835a-f8622b9a5cef] Error 2

    make: Leaving directory `/home/skield/buildroot-2015.08.1/output/build/linux-03329ca4cf6b94acc5c65b59b2d1f90fdeee0887′

    Cannot build kgdboe.

    ——————

    LinuxKernelDebugHelper logged messages (from /var/log/messages):

    Nov 17 11:44:52 mysama5 kern.alert kernel: Unable to handle kernel NULL pointer dereference at virtual address 00000010
    Nov 17 11:44:52 mysama5 kern.alert kernel: pgd = cdc98000
    Nov 17 11:44:52 mysama5 kern.alert kernel: [00000010] *pgd=2e62d831, *pte=00000000, *ppte=00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: Internal error: Oops: 17 [#1] PREEMPT ARM
    Nov 17 11:44:52 mysama5 kern.warn kernel: Modules linked in: LinuxKernelDebugHelper(O+)
    Nov 17 11:44:52 mysama5 kern.warn kernel: CPU: 0 PID: 737 Comm: insmod Tainted: G O 3.18.0 #1
    Nov 17 11:44:52 mysama5 kern.warn kernel: task: ce638800 ti: cdca6000 task.ti: cdca6000
    Nov 17 11:44:52 mysama5 kern.warn kernel: PC is at tracepoint_probe_register+0x1c/0x1c8
    Nov 17 11:44:52 mysama5 kern.warn kernel: LR is at tracepoint_probe_register+0x1c/0x1c8
    Nov 17 11:44:52 mysama5 kern.warn kernel: pc : [<c0078aa8>] lr : [<c0078aa8>] psr: 60000013
    Nov 17 11:44:52 mysama5 kern.warn kernel: sp : cdca7df8 ip : 00000001 fp : bf000820
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7e00: bf0007f8 bf000990 00000000 c06b8fa0 ce4ef680 bf002094 ce4ef680 c06b8fa0
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7e20: c06b8fa0 cdca6030 bf002000 c0008820 cdca7e30 cdca7e30 00000000 c06ccb98
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7e40: 00000000 cffaafa0 cfdf2000 00000000 00000001 cdc40548 00020000 c00a9360
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7e60: 00000001 00000001 cdc40548 0000001b ce4ef680 d0977000 00000002 0000001b
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7e80: ce4ef680 cdca7f58 00000001 bf00082c cdc40540 00000001 cdc40548 bf000868
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7ea0: bf000820 c00722cc bf00082c 00007fff c006f734 00000000 ce7f2b30 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7ec0: cdca7f58 bf00082c cdca6028 00000000 00000000 cdca7f60 cdca7f8c 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7ee0: ce4ef680 000002d2 ffffffff 000000d2 00000010 00000000 00000000 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7f20: 00000000 00000000 00000000 00000000 c000e724 0001adec b6ec9008 00084008
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7f40: 00000080 c000e724 cdca6000 00000000 00000000 c0072b74 d0977000 0001adec
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7f60: d098b3dc d098b1f1 d09919dc 000009a4 00000b14 00000000 00000000 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7f80: 00000030 00000031 00000017 0000001b 00000012 00000000 bee6edee 00084008
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7fa0: bee6eb08 c000e5a0 bee6edee 00084008 b6ec9008 0001adec 00084008 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7fc0: bee6edee 00084008 bee6eb08 00000080 0008269c 00000000 00000000 00000000
    Nov 17 11:44:52 mysama5 kern.emerg kernel: 7fe0: b6ef1ab1 bee6eb08 000165fd b6ef1ac0 00000030 b6ec9008 2fff6821 2fff6c21
    Nov 17 11:44:52 mysama5 kern.warn kernel: [<c0078aa8>] (tracepoint_probe_register) from [<bf002094>] (LinuxKernelDebugHelper_init+0x94/0x100 [LinuxKernelDebugHelper])
    Nov 17 11:44:52 mysama5 kern.warn kernel: [<bf002094>] (LinuxKernelDebugHelper_init [LinuxKernelDebugHelper]) from [<c0008820>] (do_one_initcall+0x8c/0x1c4)
    Nov 17 11:44:52 mysama5 kern.warn kernel: [<c0008820>] (do_one_initcall) from [<c00722cc>] (load_module+0x17d8/0x1fa4)
    Nov 17 11:44:52 mysama5 kern.warn kernel: [<c00722cc>] (load_module) from [<c0072b74>] (SyS_init_module+0xdc/0xf0)
    Nov 17 11:44:52 mysama5 kern.warn kernel: [<c0072b74>] (SyS_init_module) from [<c000e5a0>] (ret_fast_syscall+0x0/0x30)
    Nov 17 11:44:52 mysama5 kern.emerg kernel: Code: e1a05001 e34c006c e1a08002 eb10bfa5 (e5973010)
    Nov 17 11:44:52 mysama5 kern.warn kernel: —[ end trace 6412e329b9d89add ]—

    #7324
    support
    Keymaster

    Hi,

    KGDBoE usually does not work on ARM devices because their network drivers do not implement all the necessary interfaces.

    If you want to try it nonetheless, you can simply comment out the code calling the cpu_down() function, as it should be irrelevant on a single-core device. Otherwise, we generally advise using JTAG to debug kernel on embedded ARM boards.

    It is hard to say what causes the KernelDebugHelper to crash from your log, most likely some kernel modifications break some assumptions. Please try disabling the “build/install a custom kernel module for collecting module information faster” checkbox. This should eliminate the need to build KernelDebugHelper and use an alternative slower mechanism instead.

    #12625
    isotop
    Participant

    Hello.

    I had faced the same problems on SAMA5 development board with “kgdboe” module and I have found solution, which allows me to debug target with GDB.

    The issue was in that the wrapper “register_tracepoint_wrapper” makes a call to “kallsyms_lookup_name” with argument equal to “__tracepoint_netif_receive_skb”.
    But for some reason the symbol “__tracepoint_netif_receive_skb” is not present in the kernel symbol table. Due to symbol absence the function “kallsyms_lookup_name”
    returns NULL-pointer and “tracepoint_probe_register” tries to dereference NULL-pointer. Fortunately there is “__tracepoint_ptr_netif_receive_skb” symbol in kernel symbol
    table and it contains pointer to “__tracepoint_netif_receive_skb”.
    So the solution is to modify wrappers to next form:

    #define register_tracepoint_wrapper(tp, func, ctx) \
    tracepoint_probe_register(*(struct tracepoint **)kallsyms_lookup_name(“__tracepoint_ptr_” #tp), func, ctx)

    #define unregister_tracepoint_wrapper(tp, func, ctx) \
    tracepoint_probe_unregister(*(struct tracepoint **)kallsyms_lookup_name(“__tracepoint_ptr_” #tp), func, ctx)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.