diff --git a/ipc/native/src/core/include/ipc_process_skeleton.h b/ipc/native/src/core/include/ipc_process_skeleton.h index f362f28dc8b5e868f46e1944acfba50daf28c1d0..dce6cfaf141b5e9bdf34a8fb783f3f0a1a6e1de0 100755 --- a/ipc/native/src/core/include/ipc_process_skeleton.h +++ b/ipc/native/src/core/include/ipc_process_skeleton.h @@ -200,7 +200,7 @@ private: IPCProcessSkeleton(); static IPCProcessSkeleton *instance_; static std::mutex procMutex_; - std::shared_mutex mutex_; + std::recursive_mutex mutex_; std::shared_mutex rawDataMutex_; std::map> objects_; std::map isContainStub_; diff --git a/ipc/native/src/core/source/ipc_process_skeleton.cpp b/ipc/native/src/core/source/ipc_process_skeleton.cpp index ef9a066f68fc959e0039162f22d6486086c32d28..c9a72d5f4c0bace7a2df12055aa4cd55f3369090 100755 --- a/ipc/native/src/core/source/ipc_process_skeleton.cpp +++ b/ipc/native/src/core/source/ipc_process_skeleton.cpp @@ -126,7 +126,7 @@ IRemoteObject *IPCProcessSkeleton::FindOrNewObject(int handle) IRemoteObject *remoteObject = nullptr; std::u16string descriptor = MakeHandleDescriptor(handle); { - std::unique_lock lockGuard(mutex_); + std::lock_guard lock(mutex_); remoteObject = QueryObjectInner(descriptor); if (remoteObject == nullptr) { @@ -232,7 +232,7 @@ bool IPCProcessSkeleton::IsContainsObject(IRemoteObject *object) bool IPCProcessSkeleton::DetachObject(IRemoteObject *object) { - std::unique_lock lockGuard(mutex_); + std::lock_guard lock(mutex_); // If it fails, clear it in the destructor. (void)isContainStub_.erase(object); @@ -246,7 +246,7 @@ bool IPCProcessSkeleton::DetachObject(IRemoteObject *object) bool IPCProcessSkeleton::AttachObject(IRemoteObject *object) { - std::unique_lock lockGuard(mutex_); + std::lock_guard lock(mutex_); return AttachObjectInner(object); } @@ -269,7 +269,7 @@ IRemoteObject *IPCProcessSkeleton::QueryObject(const std::u16string &descriptor) return nullptr; } - std::shared_lock lockGuard(mutex_); + std::lock_guard lock(mutex_); return QueryObjectInner(descriptor); } diff --git a/ipc/native/src/mock/source/binder_invoker.cpp b/ipc/native/src/mock/source/binder_invoker.cpp index 23c52969d5ee1b1368d075de8ed6daa9389accf4..f88b17b004ff5191a1e72fa734bf0930e923332c 100755 --- a/ipc/native/src/mock/source/binder_invoker.cpp +++ b/ipc/native/src/mock/source/binder_invoker.cpp @@ -249,7 +249,10 @@ int BinderInvoker::TranslateStub(binder_uintptr_t cookie, binder_uintptr_t ptr, sptr BinderInvoker::GetSAMgrObject() { - return nullptr; + IPCProcessSkeleton *current = IPCProcessSkeleton::GetCurrent(); + if (current != nullptr) { + return current->GetRegistryObject(); + } } #endif diff --git a/services/dbinder/dbinder_service/src/socket/dbinder_remote_listener.cpp b/services/dbinder/dbinder_service/src/socket/dbinder_remote_listener.cpp index b9f753a84ea6d03c191194beeb16f4c96afa0ef7..a4f25e8218b566ad494be8234964b09e5b9f5691 100755 --- a/services/dbinder/dbinder_service/src/socket/dbinder_remote_listener.cpp +++ b/services/dbinder/dbinder_service/src/socket/dbinder_remote_listener.cpp @@ -120,7 +120,7 @@ std::shared_ptr DBinderRemoteListener::OpenSoftbusSession(const std::st int DBinderRemoteListener::OnSessionOpened(std::shared_ptr session) { DBINDER_LOGI("peer session is open"); - if (session->GetPeerUid() != getuid() || session->GetPeerSessionName() != PEER_SESSION_NAME) { + if (session->GetPeerSessionName() != PEER_SESSION_NAME) { DBINDER_LOGE("invalid session name, peer session name = %{public}s", session->GetPeerSessionName().c_str()); return -DBINDER_SERVICE_WRONG_SESSION; }