Loading cmds/servicemanager/bctest.c +2 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ void *svcmgr_lookup(struct binder_state *bs, void *target, const char *name) struct binder_io msg, reply; bio_init(&msg, iodata, sizeof(iodata), 4); bio_put_uint32(&msg, 0); // strict mode header bio_put_string16_x(&msg, SVC_MGR_NAME); bio_put_string16_x(&msg, name); Loading @@ -37,7 +38,7 @@ int svcmgr_publish(struct binder_state *bs, void *target, const char *name, void struct binder_io msg, reply; bio_init(&msg, iodata, sizeof(iodata), 4); bio_put_uint32(&msg, 0); // strict mode header bio_put_string16_x(&msg, SVC_MGR_NAME); bio_put_string16_x(&msg, name); bio_put_obj(&msg, ptr); Loading cmds/servicemanager/service_manager.c +6 −1 Original line number Diff line number Diff line Loading @@ -193,6 +193,7 @@ int svcmgr_handler(struct binder_state *bs, uint16_t *s; unsigned len; void *ptr; uint32_t strict_policy; // LOGI("target=%p code=%d pid=%d uid=%d\n", // txn->target, txn->code, txn->sender_pid, txn->sender_euid); Loading @@ -200,8 +201,12 @@ int svcmgr_handler(struct binder_state *bs, if (txn->target != svcmgr_handle) return -1; // Equivalent to Parcel::enforceInterface(), reading the RPC // header with the strict mode policy mask and the interface name. // Note that we ignore the strict_policy and don't propagate it // further (since we do no outbound RPCs anyway). strict_policy = bio_get_uint32(msg); s = bio_get_string16(msg, &len); if ((len != (sizeof(svcmgr_id) / 2)) || memcmp(svcmgr_id, s, sizeof(svcmgr_id))) { fprintf(stderr,"invalid id %s\n", str8(s)); Loading include/binder/IPCThreadState.h +5 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,9 @@ public: int getCallingPid(); int getCallingUid(); void setStrictModePolicy(int32_t policy); int32_t getStrictModePolicy() const; int64_t clearCallingIdentity(); void restoreCallingIdentity(int64_t token); Loading Loading @@ -109,6 +112,7 @@ private: status_t mLastError; pid_t mCallingPid; uid_t mCallingUid; int32_t mStrictModePolicy; }; }; // namespace android Loading include/binder/Parcel.h +4 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,10 @@ public: bool hasFileDescriptors() const; // Writes the RPC header. status_t writeInterfaceToken(const String16& interface); // Parses the RPC header, returning true if the interface name // in the header matches the expected interface from the caller. bool enforceInterface(const String16& interface) const; bool checkInterface(IBinder*) const; Loading libs/binder/IPCThreadState.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -367,6 +367,16 @@ int64_t IPCThreadState::clearCallingIdentity() return token; } void IPCThreadState::setStrictModePolicy(int32_t policy) { mStrictModePolicy = policy; } int32_t IPCThreadState::getStrictModePolicy() const { return mStrictModePolicy; } void IPCThreadState::restoreCallingIdentity(int64_t token) { mCallingUid = (int)(token>>32); Loading Loading @@ -588,7 +598,8 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) } IPCThreadState::IPCThreadState() : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()) : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()), mStrictModePolicy(0) { pthread_setspecific(gTLS, this); clearCaller(); Loading Loading
cmds/servicemanager/bctest.c +2 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ void *svcmgr_lookup(struct binder_state *bs, void *target, const char *name) struct binder_io msg, reply; bio_init(&msg, iodata, sizeof(iodata), 4); bio_put_uint32(&msg, 0); // strict mode header bio_put_string16_x(&msg, SVC_MGR_NAME); bio_put_string16_x(&msg, name); Loading @@ -37,7 +38,7 @@ int svcmgr_publish(struct binder_state *bs, void *target, const char *name, void struct binder_io msg, reply; bio_init(&msg, iodata, sizeof(iodata), 4); bio_put_uint32(&msg, 0); // strict mode header bio_put_string16_x(&msg, SVC_MGR_NAME); bio_put_string16_x(&msg, name); bio_put_obj(&msg, ptr); Loading
cmds/servicemanager/service_manager.c +6 −1 Original line number Diff line number Diff line Loading @@ -193,6 +193,7 @@ int svcmgr_handler(struct binder_state *bs, uint16_t *s; unsigned len; void *ptr; uint32_t strict_policy; // LOGI("target=%p code=%d pid=%d uid=%d\n", // txn->target, txn->code, txn->sender_pid, txn->sender_euid); Loading @@ -200,8 +201,12 @@ int svcmgr_handler(struct binder_state *bs, if (txn->target != svcmgr_handle) return -1; // Equivalent to Parcel::enforceInterface(), reading the RPC // header with the strict mode policy mask and the interface name. // Note that we ignore the strict_policy and don't propagate it // further (since we do no outbound RPCs anyway). strict_policy = bio_get_uint32(msg); s = bio_get_string16(msg, &len); if ((len != (sizeof(svcmgr_id) / 2)) || memcmp(svcmgr_id, s, sizeof(svcmgr_id))) { fprintf(stderr,"invalid id %s\n", str8(s)); Loading
include/binder/IPCThreadState.h +5 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,9 @@ public: int getCallingPid(); int getCallingUid(); void setStrictModePolicy(int32_t policy); int32_t getStrictModePolicy() const; int64_t clearCallingIdentity(); void restoreCallingIdentity(int64_t token); Loading Loading @@ -109,6 +112,7 @@ private: status_t mLastError; pid_t mCallingPid; uid_t mCallingUid; int32_t mStrictModePolicy; }; }; // namespace android Loading
include/binder/Parcel.h +4 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,10 @@ public: bool hasFileDescriptors() const; // Writes the RPC header. status_t writeInterfaceToken(const String16& interface); // Parses the RPC header, returning true if the interface name // in the header matches the expected interface from the caller. bool enforceInterface(const String16& interface) const; bool checkInterface(IBinder*) const; Loading
libs/binder/IPCThreadState.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -367,6 +367,16 @@ int64_t IPCThreadState::clearCallingIdentity() return token; } void IPCThreadState::setStrictModePolicy(int32_t policy) { mStrictModePolicy = policy; } int32_t IPCThreadState::getStrictModePolicy() const { return mStrictModePolicy; } void IPCThreadState::restoreCallingIdentity(int64_t token) { mCallingUid = (int)(token>>32); Loading Loading @@ -588,7 +598,8 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) } IPCThreadState::IPCThreadState() : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()) : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()), mStrictModePolicy(0) { pthread_setspecific(gTLS, this); clearCaller(); Loading