getCallingSid: get calling security context
This call gets the security context of the calling process when
requested.
Bug: 121035042
Test: boot
Change-Id: Ia8a4c0cb4a9c86dcc0d3b7583014237f879a3074
Merged-In: Ia8a4c0cb4a9c86dcc0d3b7583014237f879a3074
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index ca6a97d..9f8c408 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -215,7 +215,7 @@
}
if (binder != nullptr) {
- IBinder *local = binder->localBinder();
+ BBinder *local = binder->localBinder();
if (!local) {
BpBinder *proxy = binder->remoteBinder();
if (proxy == nullptr) {
@@ -227,6 +227,9 @@
obj.handle = handle;
obj.cookie = 0;
} else {
+ if (local->isRequestingSid()) {
+ obj.flags |= FLAT_BINDER_FLAG_TXN_SECURITY_CTX;
+ }
obj.hdr.type = BINDER_TYPE_BINDER;
obj.binder = reinterpret_cast<uintptr_t>(local->getWeakRefs());
obj.cookie = reinterpret_cast<uintptr_t>(local);