I know that kernel modules are practically part of the kernel since it gets loaded inside it. But I am not sure if it really gets all privileges the system has. Can it read/write code inside the kernel without segfaults, etc.? I want to use kernel module for unwinding the stack to kernel level to backtrace every function my program calls.

  • I think you are confuse about some terms on your question, you dont need a kernel module to unwinding the stack of a user process, you can do that with gdb or any other debugger. Regarding if you can have segfaults on your module the response is yes, you can crash the kernel if your module is not written properly
    – camp0
    Sep 10, 2019 at 12:48
  • > you can do that with gdb I have to backtrace kernel functions, does it still apply? When I mentioned segfaults, I implied unprivileged access, though
    – M. Kalter
    Sep 10, 2019 at 12:52
  • if you want to backtrace kernel functions use kgdb. In theory, if you are on the kernel space you have access to everything.
    – camp0
    Sep 10, 2019 at 13:09
  • ptrace(2) can be used to trace program calls. Does it apply to your case?
    – Lourenco
    Sep 11, 2019 at 2:16
  • you could be a bit more useful
    – M. Kalter
    Sep 11, 2019 at 8:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.