]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
x86, ptrace, mm: fix double-free on race
authorMarkus Metzger <markus.t.metzger@intel.com>
Wed, 11 Feb 2009 14:10:27 +0000 (15:10 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 11 Feb 2009 14:44:20 +0000 (15:44 +0100)
commit9f339e7028e2855717af3193c938f9960ad13b38
tree76e0e9181f4ee2b324742d517518e837d5c250bf
parent06eb23b1ba39c61ee5d5faeb42a097635693e370
x86, ptrace, mm: fix double-free on race

Ptrace_detach() races with __ptrace_unlink() if the traced task is
reaped while detaching. This might cause a double-free of the BTS
buffer.

Change the ptrace_detach() path to only do the memory accounting in
ptrace_bts_detach() and leave the buffer free to ptrace_bts_untrace()
which will be called from __ptrace_unlink().

The fix follows a proposal from Oleg Nesterov.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/ptrace.c
include/linux/mm.h
mm/mlock.c