diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-07-12 11:05:38 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@android.com> | 2010-07-15 13:18:05 -0700 |
commit | 5b747191ff8ad43a54d41faf50436271d1d7fcc8 (patch) | |
tree | b55016fca3367035e4d9109bd9ee509b250bd23f /libs | |
parent | 727de40c6bc7c6521a0542ea9def5d5c7b1c5e06 (diff) | |
download | frameworks_base-5b747191ff8ad43a54d41faf50436271d1d7fcc8.zip frameworks_base-5b747191ff8ad43a54d41faf50436271d1d7fcc8.tar.gz frameworks_base-5b747191ff8ad43a54d41faf50436271d1d7fcc8.tar.bz2 |
StrictMode: gather and return violating stacks in Binder replies
Now, when Thread A has a strict mode policy in effect and does a
Binder call to Thread B (most likely in another process), the strict
mode policy is passed along, but with the GATHER penalty bit set which
overrides other policies and instead gathers all offending stack
traces to a threadlocal which are then written back in the Parcel's
reply header.
Change-Id: I7d4497032a0609b37b1a2a15855f5c929ba0584d
Diffstat (limited to 'libs')
-rw-r--r-- | libs/binder/Parcel.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index bed893a..60babad 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -51,6 +51,9 @@ // Note: must be kept in sync with android/os/StrictMode.java's PENALTY_GATHER #define STRICT_MODE_PENALTY_GATHER 0x100 +// Note: must be kept in sync with android/os/Parcel.java's EX_HAS_REPLY_HEADER +#define EX_HAS_REPLY_HEADER -128 + // XXX This can be made public if we want to provide // support for typed data. struct small_flat_data @@ -959,7 +962,15 @@ wp<IBinder> Parcel::readWeakBinder() const int32_t Parcel::readExceptionCode() const { int32_t exception_code = readAligned<int32_t>(); - // TODO: skip over the response header here, once that's in. + if (exception_code == EX_HAS_REPLY_HEADER) { + int32_t header_size = readAligned<int32_t>(); + // Skip over fat responses headers. Not used (or propagated) in + // native code + setDataPosition(dataPosition() + header_size); + // And fat response headers are currently only used when there are no + // exceptions, so return no error: + return 0; + } return exception_code; } |