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
Merge remote-tracking branch 'cm/gingerbread' into gingerbread