diff options
author | forkbomb <keepcalm444@gmail.com> | 2015-12-03 20:34:15 +1100 |
---|---|---|
committer | forkbomb <keepcalm444@gmail.com> | 2015-12-04 15:42:51 +1100 |
commit | 53602ffde5527c476a1d7d39da12ecd7f58917f4 (patch) | |
tree | e349599c788442837cb608a13ecd2259ad9f9c23 /libs/binder | |
parent | 8c39282e31603b1b594ff1381f2c11e5863c2bbe (diff) | |
download | frameworks_native-53602ffde5527c476a1d7d39da12ecd7f58917f4.zip frameworks_native-53602ffde5527c476a1d7d39da12ecd7f58917f4.tar.gz frameworks_native-53602ffde5527c476a1d7d39da12ecd7f58917f4.tar.bz2 |
libbinder: allow devices to disable ashmem size tracking
The addition of ashmem size tracking can lead to parcel objects
overwriting other values on the stack in old binary blobs.
Change-Id: Ida52cec851a6f9d5a57c8f9130a5875c03dcb094
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/Parcel.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 7a4ddc4..ba41f0f 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -922,9 +922,9 @@ status_t Parcel::writeBlob(size_t len, bool mutableCopy, WritableBlob* outBlob) ALOGV("writeBlob: write to ashmem"); int fd = ashmem_create_region("Parcel Blob", len); if (fd < 0) return NO_MEMORY; - +#ifndef DISABLE_ASHMEM_TRACKING mBlobAshmemSize += len; - +#endif int result = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE); if (result < 0) { status = result; @@ -1890,7 +1890,9 @@ void Parcel::initState() mFdsKnown = true; mAllowFds = true; mOwner = NULL; +#ifndef DISABLE_ASHMEM_TRACKING mBlobAshmemSize = 0; +#endif } void Parcel::scanForFds() const @@ -1910,7 +1912,11 @@ void Parcel::scanForFds() const size_t Parcel::getBlobAshmemSize() const { +#ifndef DISABLE_ASHMEM_TRACKING return mBlobAshmemSize; +#else + return 0; +#endif } // --- Parcel::Blob --- |