title: Get full process path from pid in kernel linux
body: <p>I'm building custom kernel linux for my device (like embeded device). I want to log all information of kill system call. So I modify code in kill system call and get pid to kill. But I can't get full process path for it, I have just get full path of current process.
  This is my code to get process path from pid.</p>
  
  <pre><code>long GetProcessPathFromPid(const pid_t p_id, char* pszProcessPath, int iSize)
  {
      struct task_struct *task = NULL;
      struct pid *pid_struct = NULL;
      struct mm_struct *mm = NULL;
      //struct file *exe_file = NULL;
      //char buf[256] = {0};
      //char *result = ERR_PTR(-ENOENT);
      //int iResultLength = 0;
  
      pid_struct = find_get_pid(p_id);
      if (pid_struct == NULL)
      {
          printk("Fail to find_get_pid.\n");
      }
      task = pid_task(pid_struct, PIDTYPE_PID);                               // Get task_struct
      if (task == NULL) 
      {
          printk("Fail to pid_task.\n");
      }
      mm = get_task_mm(task);                                                // Get mm of task_struct
      mmput(mm);
  
      printk("Finish hook kill process\n.");
      return 0;                                              // Get mm of task_struct
  }
  </code></pre>
  
  <p>And this is error when I update firmware:</p>
  
  <pre><code>Call Trace:
  [&lt;8042971c&gt;] printk+0x24/0x30
  [&lt;800c37c8&gt;] GetProcessPathFromPid+0x38/0x88
  [&lt;800c3b60&gt;] LogKillProcess+0x64/0xf4
  [&lt;800443d4&gt;] sys_kill+0x30/0x1d8
  [&lt;800354b0&gt;] do_wait+0x11c/0x220
  [&lt;8042e234&gt;] wait_for_completion_killable+0x18/0x30
  [&lt;80043a3c&gt;] set_current_blocked+0x30/0x48
  [&lt;80533210&gt;] repair_env_string+0x0/0x94
  [&lt;8003664c&gt;] sys_wait4+0x80/0xfc
  [&lt;800344d8&gt;] child_wait_callback+0x0/0x8c
  [&lt;80533210&gt;] repair_env_string+0x0/0x94
  [&lt;8001b59c&gt;] stack_done+0x20/0x40
  [&lt;800b07a8&gt;] sys_close+0x0/0x158
  [&lt;80533210&gt;] repair_env_string+0x0/0x94
  
  
  Call Trace:
  [&lt;8042fe88&gt;] _raw_spin_lock+0x10/0x3c
  [&lt;8002ef68&gt;] get_task_mm+0x20/0x7c
  [&lt;800c37c8&gt;] GetProcessPathFromPid+0x38/0x88
  [&lt;800c3b60&gt;] LogKillProcess+0x64/0xf4
  [&lt;800443d4&gt;] sys_kill+0x30/0x1d8
  [&lt;8001b59c&gt;] stack_done+0x20/0x40
  
  
  Code: 24630001  af830014  3c020001 &lt;c0830000&gt; 00622821  e0850000  10a0fffc  00032c02  3063ffff 
  pe=GPON
  
  ---[ end trace aee100dae37dfc66 ]---
  note: init[1] exited with preempt_count 1
  FinWLmngr Daeish hook kill process
  .mon is running
   !!!!   PLL locked !!!!!!     !!!!   RX CDR locked !!!!!!     !!!!   TX CDR locked !!!!!!    GPON BEN Calibration Done 
  GPON SerDes Initialization Sequence Done 
  Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
  </code></pre>
  
  <p>Can you help me? Thanks!</p>