If the callback passed to forEach tries to remove the element it was passed,
there's a use-after-free of the entry pointer in forEach.
Change-Id: Ia364b4775c9c55780b23f683b30cbff511b7f944
Signed-off-by: Dima Zavin <dima@android.com>
Backport Iee1ca9b7defd6
This now passes:
$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner
(which tests setting and re-reading back system properties in a loop)
This patch depends on I110b653a which moves property setting
from libcutils into bionic.
Bug: 3511230
Change-Id: I145e642bd13079677017bb64e361e176fc73b810
Ext4 filesystems like to be unmounted before rebooting. The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2). This adds a new
function to libcutils called android_reboot(). By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only. Then it will call
reboot(2) as directed by the other parameters. This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.
Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
This now passes:
$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner
(which tests setting and re-reading back system properties in a loop)
This patch depends on I110b653a which moves property setting
from libcutils into bionic.
Bug: 3511230
Change-Id: Iee1ca9b7defd6060510a01f40fbe63ba4c96eb8d
This change moves the ARM definitions into GCC extended inline
assembler. In addition, the same set of x86 definitions are now
shared among all x86 targets.
Change-Id: I6e5aa3a413d0af2acbe5d32994983d35a01fdcb3
Added new atomic functions, renamed some old ones. Some #defines have
been added for backward compatibility.
Merged the pre- and post-ARMv6 implementations into a single file.
Renamed the semi-private __android_membar_full_smp to USE_SCREAMING_CAPS
since that's more appropriate for a macro.
Added lots of comments.
Note Mac OS X primitives have not been tested.
Change-Id: If827260750aeb61ad5c2b760e30658e29dbb26f2
Added atomic-inline.h. Added a platform-specific memory barrier call
there.
Added android_atomic_acquire_cmpxchg() and android_atomic_release_store().
Not tested on Mac OS X or SH.
Added memory barrier calls to linux-x86 atomics. Mac OS X has barrier
functions already. sh isn't really SMP-ready. linux-arm needs work
(to be done in a separate change).
Updated the makefile to make the SMP state visible to the code here.
Note that host binaries are NOT built with SMP enabled; while our hosts
are very likely SMP, it's not worth figuring out e.g. whether it's okay
to use the SSE2 mfence instruction or have to use something else. We
haven't had barriers enabled in host tools before, so there's probably
no need to stat now.
Removed quasiatomic 64-bit calls (now part of Dalvik).
Change-Id: I49e5e6c8abe70f304cdedb9d7b8e6e65f8925815
Re-use the file descriptor to change the cgroups. There's a fast path
in the kernel for the case where the value's already uncahnged. Also,
this is okay because the kernel ignores the write offset. This is
essentially a ioctl-ish/datagram interface, despite being a fd we're
writing to.
This reduces Dalvik->Dalvik void/void Binder calls on Sapphire from
~1.2 to ~0.8 ms. This is a bit slower than the ~0.7 ms we get
avoiding the write altogether.
strace confirms:
[pid 1557] ioctl(21, 0xc0186201 <unfinished ...>
[pid 1556] <... ioctl resumed> , 0x45399cd0) = 0
[pid 1556] write(22, "1556", 4) = 4
[pid 1556] ioctl(21, 0xc0186201 <unfinished ...>
[pid 1555] <... ioctl resumed> , 0x45299cd0) = 0
[pid 1555] write(22, "1555", 4) = 4
[pid 1555] ioctl(21, 0xc0186201 <unfinished ...>
[pid 1554] <... ioctl resumed> , 0x45199cd0) = 0
[pid 1554] write(22, "1554", 4) = 4
BUG=2660235
Change-Id: Ia9f9e1d5b792eaebc9560f89931faf6df0cf9c0d
- use static /dev/cpuctl filenames, rather than sprintf() on the fly
- use a custom formatter instead of sprintf() for the tid number
This is a simplified version of Dan's original
Ifc9c81f74fe65f0695ead53b30194bc6adf00da0 to be less risky for Froyo.
Bug: 2660235
Change-Id: I744bbc2ec01fd2569612c814a497df40a933b622
This routine allows creating a contiguous mspace from raw mapped memory.
In turn, this will enable preallocation of the 3 heap spaces, which will help
remembered sets and zygote/app checks given pointer values.
POSIX seems to have chosen open_memstream() over the BSD variant. We
want something for Dalvik that will work on both GNU/Linux and Android,
so this is open_memstream() implemented in terms of BSD funopen().
For Windows there's just a stub that calls abort().
I'm putting this in libcutils since it seems inappropriate for bionic
(which provides the BSD alternatives) but isn't Dalvik-specific.
Merge commit 'f95837a1e13c9b63bfe0b0f95f00ec0d72ba2e74'
* commit 'f95837a1e13c9b63bfe0b0f95f00ec0d72ba2e74':
system: sched_policy: Don't return an error when the thread we're trying to move exits on us
Merge commit 'cf9f442ef336d4fb6300318a3137b23a4697e048' into eclair-mr2-plus-aosp
* commit 'cf9f442ef336d4fb6300318a3137b23a4697e048':
system: sched_policy: Don't return an error when the thread we're trying to move exits on us
Merge commit '9fdf607c20f9610e442baa87cac5479c98f9d200'
* commit '9fdf607c20f9610e442baa87cac5479c98f9d200':
cutils: make set_process_name set kernel thread name as well
Merge commit 'b63747d4d9d2e26c90a5310c996210e722159d04' into eclair-mr2-plus-aosp
* commit 'b63747d4d9d2e26c90a5310c996210e722159d04':
cutils: make set_process_name set kernel thread name as well
Merge commit '525fb03e18f9b08651e3d8abb262d70c3482b405'
* commit '525fb03e18f9b08651e3d8abb262d70c3482b405':
cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground
Merge commit '58e50f80307577268ecb6b86aa97236e008a9aa0' into eclair-mr2-plus-aosp
* commit '58e50f80307577268ecb6b86aa97236e008a9aa0':
cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground