linux/arch
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
..
alpha ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
arm Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-02-10 14:09:44 -08:00
avr32 avr32: Fix OCD refcounting bug 2008-02-27 14:23:53 +01:00
blackfin ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
cris ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
frv ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
h8300 ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
ia64 Change pci_raw_ops to pci_raw_read/write 2008-02-10 12:52:46 -08:00
m32r ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
m68k ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
m68knommu ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
mips ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
mn10300 mn10300: add platform MTD support for the ASB2303 board 2008-02-08 09:22:30 -08:00
parisc ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
powerpc ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
ppc ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
s390 [S390] dynamic page tables. 2008-02-09 18:24:41 +01:00
sh ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
sparc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-02-09 23:28:26 -08:00
sparc64 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-02-09 23:28:26 -08:00
um uml: make mconsole_stack namespace-aware 2008-02-05 09:44:32 -08:00
v850 ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
x86 Change pci_raw_ops to pci_raw_read/write 2008-02-10 12:52:46 -08:00
xtensa ide: introduce HAVE_IDE 2008-02-09 10:46:40 +01:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig Move Kconfig.instrumentation to arch/Kconfig and init/Kconfig 2008-02-03 08:58:08 +01:00