I am working in an embedded Linux system, and now I want to trigger a core dump from within kernel by using send_sig(task, SIGSEGV, 1).
There is a process A having 10 threads, occasionally, there is a kernel oops occurred and at that time, one thread of A is the current process reported by kernel.
So I want to dump the core of the process A to find out what happened. So I did followings.
- Enable core dump in kernel configuration.
- Running
ulimit -c unlimitedin init script. echo '/mnt/core.%p.%e' > /proc/sys/kernel/core_pattern.- Changed the kernel oops codes to call
send_sig(task_A, SIGSEGV, 1)to sendSIGSEGVto the process A.
Then I tried to reproduce the kernel oops, and I found the log of Segmentation Fault from process A, but I did NOT see any core dumped in /mnt/.
If I changed the process A to access 0 of address, it can trigger a core dump correctly.
Why it failed to dump core from my kernel codes (the process A did is killed by SIGSEGV)? And how can I trigger a core-dump to capture the user space context in the case of kernel oops???