diff options
| author | 2019-07-31 14:30:09 -0700 | |
|---|---|---|
| committer | 2019-07-31 14:30:09 -0700 | |
| commit | 453168b476e22ddba1e30cde3a7171f24d7187a4 (patch) | |
| tree | d16de0ee594e973f5daeb45aefad01de4c68c325 | |
| parent | 7eda031afe6828c538e41275ce4bba02d7950dea (diff) | |
| parent | 41da314c01d10d40b3e43d4645d7619285a107c7 (diff) | |
Merge "Revert "Revert "libbinder: vendor binder has a different header""" into stage-aosp-master am: b33106b2cf am: f37db00295
am: 41da314c01
Change-Id: I0a795a55a31b72b637225b114cb0503cffa4bbfa
| -rw-r--r-- | libs/binder/Parcel.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 20d22954e5..55374306f3 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -494,6 +494,12 @@ void Parcel::updateWorkSourceRequestHeaderPosition() const { } } +#ifdef __ANDROID_VNDK__ +constexpr int32_t kHeader = B_PACK_CHARS('V', 'N', 'D', 'R'); +#else +constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T'); +#endif + // Write RPC headers. (previously just the interface token) status_t Parcel::writeInterfaceToken(const String16& interface) { @@ -502,6 +508,7 @@ status_t Parcel::writeInterfaceToken(const String16& interface) updateWorkSourceRequestHeaderPosition(); writeInt32(threadState->shouldPropagateWorkSource() ? threadState->getCallingWorkSourceUid() : IPCThreadState::kUnsetWorkSource); + writeInt32(kHeader); // currently the interface identification token is just its name as a string return writeString16(interface); } @@ -559,6 +566,12 @@ bool Parcel::enforceInterface(const String16& interface, updateWorkSourceRequestHeaderPosition(); int32_t workSource = readInt32(); threadState->setCallingWorkSourceUidWithoutPropagation(workSource); + // vendor header + int32_t header = readInt32(); + if (header != kHeader) { + ALOGE("Expecting header 0x%x but found 0x%x. Mixing copies of libbinder?", kHeader, header); + return false; + } // Interface descriptor. const String16 str(readString16()); if (str == interface) { |