summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2019-07-30 09:43:38 -0700
committer android-build-merger <android-build-merger@google.com> 2019-07-30 09:43:38 -0700
commitd16600efb63b404a8af5372d5fa6b0424d3d8ce6 (patch)
tree83f3a13ec805c4001ea20d2d0e0b700c81cac6ef
parent1e85909354fa0b334bc34d7ab0293528ea2d1b33 (diff)
parent055fc41eb8688713a0fa328ea79bf0b4aa9c98bf (diff)
Merge "libbinder: vendor binder has a different header" into stage-aosp-master am: 3ccd1b65c8 am: 4a43a522ef
am: 055fc41eb8 Change-Id: Ic3d4824d344922c9cf423d900e51664dd84c7f73
-rw-r--r--libs/binder/Parcel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 85822efa09..d5ad8c864a 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -590,6 +590,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)
{
@@ -598,6 +604,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);
}
@@ -655,6 +662,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) {