• Naveen N. Rao's avatar
    powerpc: Enable execve syscall exit tracepoint · ec6d0dde
    Naveen N. Rao authored
    On execve[at], we are zero'ing out most of the thread register state
    including gpr[0], which contains the syscall number. Due to this, we
    fail to trigger the syscall exit tracepoint properly. Fix this by
    retaining gpr[0] in the thread register state.
    
    Before this patch:
      # tail /sys/kernel/debug/tracing/trace
    	       cat-123     [000] .....    61.449351: sys_execve(filename:
      7fffa6b23448, argv: 7fffa6b233e0, envp: 7fffa6b233f8)
    	       cat-124     [000] .....    62.428481: sys_execve(filename:
      7fffa6b23448, argv: 7fffa6b233e0, envp: 7fffa6b233f8)
    	      echo-125     [000] .....    65.813702: sys_execve(filename:
      7fffa6b23378, argv: 7fffa6b233a0, envp: 7fffa6b233b0)
    	      echo-125     [000] .....    65.822214: sys_execveat(fd: 0,
      filename: 1009ac48, argv: 7ffff65d0c98, envp: 7ffff65d0ca8, flags: 0)
    
    After this patch:
      # tail /sys/kernel/debug/tracing/trace
    	       cat-127     [000] .....   100.416262: sys_execve(filename:
      7fffa41b3448, argv: 7fffa41b33e0, envp: 7fffa41b33f8)
    	       cat-127     [000] .....   100.418203: sys_execve -> 0x0
    	      echo-128     [000] .....   103.873968: sys_execve(filename:
      7fffa41b3378, argv: 7fffa41b33a0, envp: 7fffa41b33b0)
    	      echo-128     [000] .....   103.875102: sys_execve -> 0x0
    	      echo-128     [000] .....   103.882097: sys_execveat(fd: 0,
      filename: 1009ac48, argv: 7fffd10d2148, envp: 7fffd10d2158, flags: 0)
    	      echo-128     [000] .....   103.883225: sys_execveat -> 0x0
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Tested-by: default avatarSumit Dubey2 <Sumit.Dubey2@ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20220609103328.41306-1-naveen.n.rao@linux.vnet.ibm.com
    ec6d0dde
process.c 58.5 KB