• Sven Schnelle's avatar
    ptrace: fix clearing of JOBCTL_TRACED in ptrace_unfreeze_traced() · de2a3477
    Sven Schnelle authored
    CI reported the following splat while running the strace testsuite:
    
      WARNING: CPU: 1 PID: 3570031 at kernel/ptrace.c:272 ptrace_check_attach+0x12e/0x178
      CPU: 1 PID: 3570031 Comm: strace Tainted: G           OE     5.19.0-20220624.rc3.git0.ee819a77d4e7.300.fc36.s390x #1
      Hardware name: IBM 3906 M04 704 (z/VM 7.1.0)
      Call Trace:
       [<00000000ab4b645a>] ptrace_check_attach+0x132/0x178
      ([<00000000ab4b6450>] ptrace_check_attach+0x128/0x178)
       [<00000000ab4b6cde>] __s390x_sys_ptrace+0x86/0x160
       [<00000000ac03fcec>] __do_syscall+0x1d4/0x200
       [<00000000ac04e312>] system_call+0x82/0xb0
      Last Breaking-Event-Address:
       [<00000000ab4ea3c8>] wait_task_inactive+0x98/0x190
    
    This is because JOBCTL_TRACED is set, but the task is not in TASK_TRACED
    state. Caused by ptrace_unfreeze_traced() which does:
    
    	task->jobctl &= ~TASK_TRACED
    
    but it should be:
    
    	task->jobctl &= ~JOBCTL_TRACED
    
    Fixes: 31cae1ea ("sched,signal,ptrace: Rework TASK_TRACED, TASK_STOPPED state")
    Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
    Tested-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
    Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Kees Cook <keescook@chromium.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    de2a3477
ptrace.c 36.9 KB