
#include <linux/kernel.h> 헤더를 추가한 후 함수 호출shost_printk부분 error message 출력 됨
int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work)
{
if (unlikely(!shost->work_q)) {
shost_printk(KERN_ERR, shost,
"ERROR: Scsi host '%s' attempted to queue scsi-work, "
"when no workqueue created.\n", shost->hostt->name);
dump_stack();
return -EINVAL;
}
return queue_work(shost->work_q, work);
}
rpi_kernel_debug_stat_set()
dump_stack() 함수 패치 코드
/kernel/fork.c
+ static int debug_kernel_thread = 1;
long _do_fork(unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size,
int __user *parent_tidptr, int __user *child_tidptr, unsigned long tls)
{
...
p = copy_process(clone_flags, stack_start, stack_size,
child_tidptr, NULL, trace, tls);
+
+ if (debug_kernel_thread) {
+ printk("[+][%s] process n", current->comm);
+ dump_stack();
+ }
/kernel/fork.c kernel version 5.4 이상
+ static int debug_kernel_thread = 1;
pid_t kernel_clone(struct kernel_clone_args *args)
{
...
p = copy_process(NULL, trace, NUMA_NO_NODE, args);
+
+ if (debug_kernel_thread) {
+ printk("[+][%s] process n", current->comm);
+ dump_stack();
+ }
Frame Pointer Register를 읽는다.ARM 아키텍처의 함수 호출 규약에 따라 Frame Pointer Register를 읽어서 함수 호출 내역을 추적하는 동작을 반복한다.커널 로그를 통해 리눅스 시스템에 대한 다양한 정보를 출력해준다.
The magic SysRq key is a key combination understood by the linux kernel, which allows the user to perform various low-level commands regardless of the system's state. It is often used to recover from freezes, or to reboot a computer without corrupting the filesystem.
<magic> > /proc/sysrq-triggerecho -h > /proc/sysrq-trigger
dmesg
