android_system_core/include
Hans Boehm 70a46d674a Fix memory order and race bugs in Refbase.h & RefBase.cpp
Convert to use std::atomic directly.

Consistently use relaxed ordering for increments, release ordering
for decrements, and an added acquire fence when the count goes to
zero.

Fix what looks like another race in attemptIncStrong:
It seems entirely possible that the final adjustment for
INITIAL_STRONG_VALUE would see e.g. INITIAL_STRONG_VALUE + 1,
since we could be running in the middle of another initial
increment.

Attempt to somewhat document what this actually does, and
what's expected from the client. Hide the documentation in
the .cpp file for now.

Remove a confusing redundant test in decWeak. OBJECT_LIFETIME_STRONG
and OBJECT_LIFETIME_WEAK are the only options, in spite of some
of the original comments.

It's conceivable that either of these issues has resulted in
actual crashes, though I would guess the probability is small.
It's hard enough to reason about this code without the bugs.

Bug: 28705989
Change-Id: I4107a56c3fc0fdb7ee17fc8a8f0dd7fb128af9d8
(cherry picked from commit e263e6c633)
2016-05-19 16:18:26 -07:00
..
android log: Fix warning with __USE_MINGW_ANSI_STDIO 2014-06-12 13:19:51 -07:00
backtrace Add error reporting mechanism for failing Unwind. 2016-03-10 14:14:43 -08:00
binderwrapper libbinderwrapper: Add BinderWrapper::GetOrCreateInstance() 2016-01-04 12:56:27 -08:00
cutils Create profiles folders 2016-02-19 13:42:37 +00:00
diskconfig diskconfig: Add missing include for loff_t 2012-07-23 16:11:59 -07:00
log liblog: add android_log_write_string8_len 2016-02-25 15:53:00 -08:00
memtrack Fix typos in comments 2015-04-20 10:10:33 -07:00
mincrypt Add support for ECDSA P-256 with SHA256 2013-10-09 17:04:50 -07:00
nativebridge LibNativeBridge: Version 2 2015-05-31 16:58:24 -07:00
netutils Remove a dead header (<netutils/dhcp.h>). 2016-05-18 14:22:15 -07:00
private Move canned_fs_config into libcutils 2016-04-07 22:44:00 -07:00
system graphics.h: Add android_hdr_t 2016-04-06 14:52:10 -07:00
sysutils Revert "Sigh, more vendors linking against hidden APIs." 2015-03-20 23:51:36 +00:00
usbhost libusbhost: add usb_device_reset 2016-01-13 16:01:42 -08:00
utils Fix memory order and race bugs in Refbase.h & RefBase.cpp 2016-05-19 16:18:26 -07:00
ziparchive libziparchive: ensure ReadAtOffset is atomic 2016-03-09 17:17:19 -08:00