linux-sg2042/arch/avr32
Haavard Skinnemoen 325d6f5593 avr32: Fix OCD refcounting bug
Iff the parent has TIF_DEBUG set, _and_ clone_flags includes
CLONE_PTRACE we should set the TIF_DEBUG flag for the child and
increment the ocd refcount. Otherwise, the TIF_DEBUG flag must be
unset.

Currently, the child inherits TIF_DEBUG from the parent before
copy_thread is called, so TIF_DEBUG may be already be set before we
determine whether the child is supposed to inherit debugging
capabilities from the parent or not. This means that ocd_enable()
won't increment the refcount, because TIF_DEBUG is already set, and
that TIF_DEBUG will be set for processes that aren't being debugged.

This leads to a refcounting asymmetry, which may show up as

------------[ cut here ]------------
Badness at arch/avr32/kernel/ocd.c:73
PC is at ocd_disable+0x34/0x60
LR is at put_lock_stats+0xa/0x20

as reported by David Brownell. Happens when strace'ing a process that
forks a new child process, e.g. "strace mount -tjffs2 mtd1 /mnt", and
subsequently killing the child process (e.g. "umount /mnt".)

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2008-02-27 14:23:53 +01:00
..
boards avr32: Use correct config symbol in atstk1004 board code 2008-02-13 14:44:06 +01:00
boot [PATCH] AVR32: Minor Makefile cleanup 2006-10-25 20:26:32 -07:00
configs [AVR32] ATNGW100: Update defconfig 2008-01-25 08:31:43 +01:00
kernel avr32: Fix OCD refcounting bug 2008-02-27 14:23:53 +01:00
lib read_current_timer() cleanups 2008-02-06 10:41:02 -08:00
mach-at32ap Basic PWM driver for AVR32 and AT91 2008-02-08 09:22:38 -08:00
mm avr32: Fix broken pte dump code in do_page_fault() 2008-02-13 14:44:04 +01:00
oprofile [AVR32] Oprofile support 2008-01-25 08:31:40 +01:00
Kconfig ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
Kconfig.debug [AVR32] Include instrumentation menu 2008-01-25 08:31:40 +01:00
Makefile [AVR32] Add support for AT32AP7001 and AT32AP7002 2008-01-25 08:31:41 +01:00