libcutils: Fix race issues in mspace_usable_size

There is race issue in mspace_usable_size which was used in dalvik.
Which makes mspace_usable_size return size 4 bytes less than real
size.

original Id: Ic07f4b4532e35671822b560a631bf0377fdc3204
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>

picked from
https://android-review.googlesource.com/#/c/34270/
Security fix for CVE-2011-3874

This commit is a port of the patch supplied to issue 21681 in AOSP. It
fixes the zergrush security problem. I had to slightly modify the patch
applied by google.

https://code.google.com/p/android/issues/detail?id=21681
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3874

This fixes issue 5910:
https://code.google.com/p/cyanogenmod/issues/detail?id=5910

Change-Id: Ic8f584f0a4bf4c0e05a209bc690b93a5363799cf
Improve exec command processing

- Make exec print out an error if execve() failed for some reason
- Pass init's environment, created by the export keywords, to the exec'd
  command, which is helpful when running shell scripts (for PATH) and/or
  am (for BOOTCLASSPATH) from an exec statement.
Make bootmenu provide its own full libreboot.
Merge "Security fix for CVE-2011-3874" into gingerbread
Merge "libcutils: Fix race issues in mspace_usable_size" into gingerbread
add 8K 16K 32K 64K and 128K pagesizes in bootimage

Ported from jellybean (was Change-Id: I4bc74ad6b0a473de68c906422bcd7eac00c89793)

http://review.cyanogenmod.org/33216

Signed-off-by: ChampionSwimmer <android@championswimmer.tk>
Signed-off-by: Michael Bestas <mikeioannina@gmail.com>

Change-Id: I0ed484560a6cb50387c3a8709f1d96990dc34184
Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_system_core into gingerbread