From 3085a47ebb695dd95271a7db2aa0d181d69c1f4d Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 26 Dec 2018 13:59:23 -0800 Subject: 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 --- libs/binder/Parcel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libs/binder/Parcel.cpp') diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index ca6a97debb..9f8c40876e 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -215,7 +215,7 @@ status_t flatten_binder(const sp& /*proc*/, } if (binder != nullptr) { - IBinder *local = binder->localBinder(); + BBinder *local = binder->localBinder(); if (!local) { BpBinder *proxy = binder->remoteBinder(); if (proxy == nullptr) { @@ -227,6 +227,9 @@ status_t flatten_binder(const sp& /*proc*/, 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(local->getWeakRefs()); obj.cookie = reinterpret_cast(local); -- cgit v1.2.3-59-g8ed1b