]> git.baikalelectronics.ru Git - kernel.git/commit
tracehook: fix CLONE_PTRACE
authorRoland McGrath <roland@redhat.com>
Thu, 7 Aug 2008 23:55:03 +0000 (16:55 -0700)
committerRoland McGrath <roland@redhat.com>
Fri, 8 Aug 2008 00:18:47 +0000 (17:18 -0700)
commit23366ef8cef575745af98c3f07e0786fb7a15d59
tree066a66bd465741973879675b150f517032adcbfa
parentfec2e91bf98d7c52d82faca3cf5f484f1b874482
tracehook: fix CLONE_PTRACE

In the change in commit 4dac5baa6a80b239507620a9d09a66a208efa0da, I
overlooked two nits in the logic and this broke using CLONE_PTRACE
when PTRACE_O_TRACE* are not being used.

A parent that is itself traced at all but not using PTRACE_O_TRACE*,
using CLONE_PTRACE would have its new child fail to be traced.

A parent that is not itself traced at all that uses CLONE_PTRACE
(which should be a no-op in this case) would confuse the bookkeeping
and lead to a crash at exit time.

This restores the missing checks and fixes both failure modes.

Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Roland McGrath <roland@redhat.com>
include/linux/ptrace.h
include/linux/tracehook.h