freebsd-dev/sys/arm/include
Olivier Houchard b21a1da537 Close a race.
The RAS implementation would set the end address, then the start
address.  These were used by the kernel to restart a RAS sequence if
it was interrupted.  When the thread switching code ran, it would
check these values and adjust the PC and clear them if it did.

However, there's a small flaw in this scheme.  Thread T1, sets the end
address and gets preempted.  Thread T2 runs and also does a RAS
operation.  This resets end to zero.  Thread T1 now runs again and
sets start and then begins the RAS sequence, but is preempted before
the RAS sequence executes its last instruction.  The kernel code that
would ordinarily restart the RAS sequence doesn't because the PC isn't
between start and 0, so the PC isn't set to the start of the sequence.
So when T1 is resumed again, it is at the wrong location for RAS to
produce the correct results.  This causes the wrong results for the
atomic sequence.

The window for the first race is 3 instructions.  The window for the
second race is 5-10 instructions depending on the atomic operation.
This makes this failure fairly rare and hard to reproduce.

Mutexs are implemented in libthr using atomic operations.  When the
above race would occur, a lock could get stuck locked, causing many
downstream problems, as you might expect.

Also, make sure to reset the start and end address when doing a syscall, or
a malicious process could set them before doing a syscall.

Reviewed by: imp, ups (thanks guys)
Pointy hat to:	cognet
MFC After:	3 days
2007-12-02 12:49:28 +00:00
..
_bus.h
_inttypes.h
_limits.h Move MINSIGSTKSZ from <machine/signal.h> to <machine/_limits.h> and rename 2005-08-20 16:44:41 +00:00
_stdint.h
_types.h Switch to a 64bit time_t, while it's not a big problem to do so. 2006-05-15 00:17:27 +00:00
armreg.h Merge definitions for ARM9E, ARM10 and ARM11 processors from p4 (which 2007-10-18 05:06:58 +00:00
asm.h Define _ARM_ARCH_5E too, so that we know if pld/strd/ldrd are available. 2007-10-13 12:04:10 +00:00
asmacros.h Close a race. 2007-12-02 12:49:28 +00:00
atomic.h Close a race. 2007-12-02 12:49:28 +00:00
blockio.h
bootconfig.h Remove __P 2007-03-21 03:28:16 +00:00
bus_dma.h - Add bounce pages for arm, largely based on the i386 implementation. 2007-01-17 00:53:05 +00:00
bus.h correct bus space unmap prototype 2006-11-19 23:46:50 +00:00
clock.h First part of a little cleanup in the calendar/timezone/RTC handling. 2006-10-02 12:59:59 +00:00
cpu.h Clean out sysctl machdep.* related defines. 2006-05-11 17:29:25 +00:00
cpuconf.h __CPU_XSCALE_PXA2XX -> CPU_XSCALE_PXA2X0 2007-11-01 10:01:15 +00:00
cpufunc.h Merge support from p4 (from NetBSD) for arm9e and arm10, arm11 cores. Not 2007-10-18 05:33:06 +00:00
db_machdep.h Define BYTE_MSF if we're compiling a big endian kernel, so that DDB can 2006-07-27 11:41:37 +00:00
disassem.h
elf.h PR: 2006-10-04 21:37:10 +00:00
endian.h In __bswap16_var(), make sure the 16 upper bits are cleared; while 2007-09-09 11:58:38 +00:00
exec.h
fiq.h
float.h
floatingpoint.h
fp.h
frame.h Tweak how the MD code calls the fooclock() methods some. Instead of 2005-12-22 22:16:09 +00:00
gdb_machdep.h Add remote GDB bits for arm. 2006-07-14 00:50:51 +00:00
ieee.h
ieeefp.h
in_cksum.h MFp4: Forget the asm inlined version of in_cksum_hdr(). It doesn't work if 2006-03-09 23:33:59 +00:00
intr.h The iop34x has 128 interrupts. 2007-06-16 15:03:33 +00:00
katelib.h
kdb.h Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
limits.h
machdep.h
md_var.h - Add bounce pages for arm, largely based on the i386 implementation. 2007-01-17 00:53:05 +00:00
memdev.h
metadata.h
mutex.h
param.h By popular demand, move __HAVE_ACPI and __PCI_REROUTE_INTERRUPT into 2006-01-09 06:05:57 +00:00
pcb.h
pcpu.h - PCPU_ADD is no longer spelled with LAZY_ in the middle. 2007-06-06 23:23:47 +00:00
pmap.h Properly handle supersections. 2007-07-27 14:45:04 +00:00
pmc_mdep.h MFP4: 2005-06-09 19:45:09 +00:00
proc.h
profile.h Use __mcount() instead of _mcount() to reduce diffs with NetBSD. 2007-05-19 16:20:37 +00:00
psl.h
pte.h Fix the cache mode description. 2007-07-27 14:45:33 +00:00
ptrace.h
reg.h
reloc.h
resource.h
runq.h
setjmp.h
sf_buf.h Rewrite ARM_USE_SMALL_ALLOC so that instead of the current behavior, it maps 2006-08-08 20:59:38 +00:00
sigframe.h
signal.h Move MINSIGSTKSZ from <machine/signal.h> to <machine/_limits.h> and rename 2005-08-20 16:44:41 +00:00
smp.h
stdarg.h Use __builtin_va_start instead of __builtin_stdarg_start. GCC4 obsoletes 2006-09-21 01:37:02 +00:00
swi.h
sysarch.h
trap.h
ucontext.h
undefined.h Remove __P 2007-03-21 03:28:16 +00:00
utrap.h
vmparam.h Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00