about summary refs log tree commit diff
path: root/arch/i386/atomic.h
Commit message (Collapse)AuthorAgeFilesLines
* fix missing earlyclobber flag in i386 a_ctz_64 asmRich Felker2015-09-091-1/+1
| | | | | | | | | this error was only found by reading the code, but it seems to have been causing gcc to produce wrong code in malloc: the same register was used for the output and the high word of the input. in principle this could have caused an infinite loop searching for an available bin, but in practice most x86 models seem to implement the "undefined" result of the bsf instruction as "unchanged".
* fix missing synchronization in atomic store on i386 and x86_64Rich Felker2015-07-281-1/+1
| | | | | | | | | | | | | | | | | despite being strongly ordered, the x86 memory model does not preclude reordering of loads across earlier stores. while a plain store suffices as a release barrier, we actually need a full barrier, since users of a_store subsequently load a waiter count to determine whether to issue a futex wait, and using a stale count will result in soft (fail-to-wake) deadlocks. these deadlocks were observed in malloc and possible with stdio locks and other libc-internal locking. on i386, an atomic operation on the caller's stack is used as the barrier rather than performing the store itself using xchg; this avoids the need to read the cache line on which the store is being performed. mfence is used on x86_64 where it's always available, and could be used on i386 with the appropriate cpu model checks if it's shown to perform better.
* fix inconsistency in a_and and a_or argument types on x86[_64]Rich Felker2015-05-201-4/+4
| | | | | | conceptually, and on other archs, these functions take a pointer to int, but in the i386, x86_64, and x32 versions of atomic.h, they took a pointer to void instead.
* add explicit barrier operation to internal atomic.h APIRich Felker2014-10-101-0/+5
|
* clean up unused and inconsistent atomics in arch dirsRich Felker2014-07-271-23/+0
| | | | | | | | | | | the a_cas_l, a_swap_l, a_swap_p, and a_store_l operations were probably used a long time ago when only i386 and x86_64 were supported. as other archs were added, support for them was inconsistent, and they are obviously not in use at present. having them around potentially confuses readers working on new ports, and the type-punning hacks and inconsistent use of types in their definitions is not a style I wish to perpetuate in the source tree, so removing them seems appropriate.
* security hardening: ensure suid programs have valid stdin/out/errRich Felker2011-08-231-0/+5
| | | | | | | | | | | this behavior (opening fds 0-2 for a suid program) is explicitly allowed (but not required) by POSIX to protect badly-written suid programs from clobbering files they later open. this commit does add some cost in startup code, but the availability of auxv and the security flag will be useful elsewhere in the future. in particular auxv is needed for static-linked vdso support, which is still waiting to be committed (sorry nik!)
* add word-sized ctz function to atomic.hRich Felker2011-04-271-2/+8
| | | | | | strictly speaking this and a few other ops should be factored into asm.h or the file should just be renamed to asm.h, but whatever. clean it up someday.
* optimize contended normal mutex case; add int compare-and-swap atomicRich Felker2011-03-171-0/+7
|
* move arch-specific internal headers into placeRich Felker2011-02-151-0/+110