From e2175d592d2ba4b815a88a3e7e91560d09106483 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 22 Jun 2024 17:08:34 +0800 Subject: [PATCH 01/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: I692915f678c96dbed78af60fd758cf042fa3bddd --- frameworks/native/src/sensor_agent_proxy.cpp | 4 +-- .../native/src/sensor_service_client.cpp | 6 ++-- services/include/sensor_service_stub.h | 4 +++ services/src/sensor_service_stub.cpp | 32 +++++++++++++++---- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 10cb66b6..14f17c5e 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -84,8 +84,8 @@ int32_t SensorAgentProxy::CreateSensorDataChannel() return ERR_OK; } CHKPR(dataChannel_, INVALID_POINTER); - auto ret = dataChannel_->CreateSensorDataChannel(std::bind(&SensorAgentProxy::HandleSensorData, - this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), nullptr); + auto ret = dataChannel_->CreateSensorDataChannel([this] (SensorEvent *events, int32_t num, void *data) + {this->HandleSensorData(events, num, data);}, nullptr); if (ret != ERR_OK) { SEN_HILOGE("Create data channel failed, ret:%{public}d", ret); return ret; diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index a2f02e9c..fee35a13 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -429,7 +429,7 @@ void SensorServiceClient::ReceiveMessage(const char *buf, size_t size) #ifdef OHOS_BUILD_ENABLE_RUST ReadClientPackets(circBuf_.streamBufferPtr_.get(), this, OnPacket); #else - OnReadPackets(circBuf_, std::bind(&SensorServiceClient::HandleNetPacke, this, std::placeholders::_1)); + OnReadPackets(circBuf_, [this] (NetPacket &pkt) {this->HandleNetPacke(pkt);}); #endif // OHOS_BUILD_ENABLE_RUST } @@ -508,8 +508,8 @@ int32_t SensorServiceClient::CreateSocketChannel() { std::lock_guard channelLock(channelMutex_); if (dataChannel_->AddFdListener(GetFd(), - std::bind(&SensorServiceClient::ReceiveMessage, this, std::placeholders::_1, std::placeholders::_2), - std::bind(&SensorServiceClient::Disconnect, this)) != ERR_OK) { + [this] (const char *buf, size_t size) {this->ReceiveMessage(buf, size);}, + [this] {this->Disconnect();})!= ERR_OK) { Close(); SEN_HILOGE("Add fd listener failed, fd:%{public}d", GetFd()); return ERROR; diff --git a/services/include/sensor_service_stub.h b/services/include/sensor_service_stub.h index 3166c6de..b40c614d 100644 --- a/services/include/sensor_service_stub.h +++ b/services/include/sensor_service_stub.h @@ -30,6 +30,10 @@ public: virtual ~SensorServiceStub(); virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + int32_t _VirtualFuncA(MessageParcel &data, MessageParcel &reply, MessageOption &option); + int32_t _VirtualFuncB(MessageParcel &data, MessageParcel &reply, MessageOption &option); + virtual int32_t VirtualFuncA(); + virtual int32_t VirtualFuncB(int32_t slotId, bool voicMailMsgResult); private: DISALLOW_COPY_AND_MOVE(SensorServiceStub); diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index b4a692a3..6257bd29 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -84,17 +84,37 @@ int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M SEN_HILOGE("Client and service descriptors are inconsistent"); return OBJECT_NULL; } - auto itFunc = baseFuncs_.find(code); - if (itFunc != baseFuncs_.end()) { - auto memberFunc = itFunc->second; - if (memberFunc != nullptr) { - return (this->*memberFunc)(data, reply); - } + switch (code) { + case 1:{ + return this->_VirtualFuncA(data, reply, option); + }break; + case 2:{ + return this->_VirtualFuncB(data, reply, option); + }break; } SEN_HILOGD("No member func supporting, applying default process"); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } + +int32_t SensorServiceStub::_VirtualFuncA(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + this->VirtualFuncA(); + return 0; +} + +int32_t SensorServiceStub::_VirtualFuncB(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + this->VirtualFuncB(1,false); + return 0; +} +int32_t SensorServiceStub::VirtualFuncA() { + SEN_HILOGE("SensorServiceStub::VirtualFuncA"); + return 0; +} +int32_t SensorServiceStub::VirtualFuncB(int32_t slotId, bool voicMailMsgResult) { + SEN_HILOGE("SensorServiceStub::VirtualFuncB"); + return 0; +} + bool SensorServiceStub::IsSystemServiceCalling() { const auto tokenId = IPCSkeleton::GetCallingTokenID(); -- Gitee From 417772b965ec766c4605f31fb03d972f54211b02 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Mon, 24 Jun 2024 16:16:02 +0800 Subject: [PATCH 02/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: If8673f05b598ec7fbf8f2b39af479ca5e1a478c6 --- services/include/sensor_service_stub.h | 4 -- services/src/sensor_service_stub.cpp | 69 ++++++++++++++++---------- 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/services/include/sensor_service_stub.h b/services/include/sensor_service_stub.h index b40c614d..3166c6de 100644 --- a/services/include/sensor_service_stub.h +++ b/services/include/sensor_service_stub.h @@ -30,10 +30,6 @@ public: virtual ~SensorServiceStub(); virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - int32_t _VirtualFuncA(MessageParcel &data, MessageParcel &reply, MessageOption &option); - int32_t _VirtualFuncB(MessageParcel &data, MessageParcel &reply, MessageOption &option); - virtual int32_t VirtualFuncA(); - virtual int32_t VirtualFuncB(int32_t slotId, bool voicMailMsgResult); private: DISALLOW_COPY_AND_MOVE(SensorServiceStub); diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 6257bd29..2d3e1dde 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -85,34 +85,51 @@ int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M return OBJECT_NULL; } switch (code) { - case 1:{ - return this->_VirtualFuncA(data, reply, option); - }break; - case 2:{ - return this->_VirtualFuncB(data, reply, option); - }break; + case static_cast(SensorInterfaceCode::ENABLE_SENSOR): { + return SensorEnableInner(data, reply); + } + case static_cast(SensorInterfaceCode::DISABLE_SENSOR): { + return SensorDisableInner(data, reply); + } + case static_cast(SensorInterfaceCode::GET_SENSOR_LIST): { + return GetAllSensorsInner(data, reply); + } + case static_cast(SensorInterfaceCode::TRANSFER_DATA_CHANNEL): { + return CreateDataChannelInner(data, reply); + } + case static_cast(SensorInterfaceCode::DESTROY_SENSOR_CHANNEL): { + return DestroyDataChannelInner(data, reply); + } + case static_cast(SensorInterfaceCode::SUSPEND_SENSORS): { + return SuspendSensorsInner(data, reply); + } + case static_cast(SensorInterfaceCode::RESUME_SENSORS): { + return ResumeSensorsInner(data, reply); + } + case static_cast(SensorInterfaceCode::GET_ACTIVE_INFO_LIST): { + return GetActiveInfoListInner(data, reply); + } + case static_cast(SensorInterfaceCode::CREATE_SOCKET_CHANNEL): { + return CreateSocketChannelInner(data, reply); + } + case static_cast(SensorInterfaceCode::DESTROY_SOCKET_CHANNEL): { + return DestroySocketChannelInner(data, reply); + } + case static_cast(SensorInterfaceCode::ENABLE_ACTIVE_INFO_CB): { + return EnableActiveInfoCBInner(data, reply); + } + case static_cast(SensorInterfaceCode::DISABLE_ACTIVE_INFO_CB): { + return DisableActiveInfoCBInner(data, reply); + } + case static_cast(SensorInterfaceCode::RESET_SENSORS): { + return ResetSensorsInner(data, reply); + } + default: { + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } } SEN_HILOGD("No member func supporting, applying default process"); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - - -int32_t SensorServiceStub::_VirtualFuncA(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - this->VirtualFuncA(); - return 0; -} - -int32_t SensorServiceStub::_VirtualFuncB(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - this->VirtualFuncB(1,false); - return 0; -} -int32_t SensorServiceStub::VirtualFuncA() { - SEN_HILOGE("SensorServiceStub::VirtualFuncA"); - return 0; -} -int32_t SensorServiceStub::VirtualFuncB(int32_t slotId, bool voicMailMsgResult) { - SEN_HILOGE("SensorServiceStub::VirtualFuncB"); - return 0; + return ERR_OK; } bool SensorServiceStub::IsSystemServiceCalling() -- Gitee From d4fc7604d743828732d1726e952d42f5b5cba803 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 29 Jun 2024 11:12:45 +0800 Subject: [PATCH 03/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: I582d233127e887d37a433692182eb40f6a115ebe --- services/include/sensor_service_stub.h | 1 + services/src/sensor_service_stub.cpp | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/services/include/sensor_service_stub.h b/services/include/sensor_service_stub.h index 3166c6de..72943483 100644 --- a/services/include/sensor_service_stub.h +++ b/services/include/sensor_service_stub.h @@ -48,6 +48,7 @@ private: ErrCode DisableActiveInfoCBInner(MessageParcel &data, MessageParcel &reply); ErrCode ResetSensorsInner(MessageParcel &data, MessageParcel &reply); bool IsSystemServiceCalling(); + int32_t BypassCfiProtection(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); bool IsSystemCalling(); std::unordered_map baseFuncs_; }; diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 2d3e1dde..1484b96e 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -74,16 +74,9 @@ SensorServiceStub::~SensorServiceStub() baseFuncs_.clear(); } -int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, - MessageOption &option) +int32_t SensorServiceStub::BypassCfiProtection(uint32_t code, MessageParcel &data, MessageParcel &reply, + MessageOption &option) { - SEN_HILOGD("Begin, cmd:%{public}u", code); - std::u16string descriptor = SensorServiceStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - SEN_HILOGE("Client and service descriptors are inconsistent"); - return OBJECT_NULL; - } switch (code) { case static_cast(SensorInterfaceCode::ENABLE_SENSOR): { return SensorEnableInner(data, reply); @@ -128,6 +121,19 @@ int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } } + return ERR_OK; +} +int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, + MessageOption &option) +{ + SEN_HILOGD("Begin, cmd:%{public}u", code); + std::u16string descriptor = SensorServiceStub::GetDescriptor(); + std::u16string remoteDescriptor = data.ReadInterfaceToken(); + if (descriptor != remoteDescriptor) { + SEN_HILOGE("Client and service descriptors are inconsistent"); + return OBJECT_NULL; + } + Cfi(code, data, reply, option); SEN_HILOGD("No member func supporting, applying default process"); return ERR_OK; } -- Gitee From 8cde92e1ead1ace347590a530ab6198c6119c723 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 29 Jun 2024 11:14:26 +0800 Subject: [PATCH 04/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: Ic955c626f40518d5b2e31ddd03e56e8b59786190 --- services/include/sensor_service_stub.h | 1 - 1 file changed, 1 deletion(-) diff --git a/services/include/sensor_service_stub.h b/services/include/sensor_service_stub.h index 72943483..79f9b7ca 100644 --- a/services/include/sensor_service_stub.h +++ b/services/include/sensor_service_stub.h @@ -50,7 +50,6 @@ private: bool IsSystemServiceCalling(); int32_t BypassCfiProtection(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); bool IsSystemCalling(); - std::unordered_map baseFuncs_; }; } // namespace Sensors } // namespace OHOS -- Gitee From 58c6276dd4c63f7a0cebf7b1e422e61f32f32e54 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 29 Jun 2024 16:33:51 +0800 Subject: [PATCH 05/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: I3832528e5380103033366952309ba34f522284fa --- services/include/sensor_service_stub.h | 1 - services/src/sensor_service_stub.cpp | 44 +++----------------------- 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/services/include/sensor_service_stub.h b/services/include/sensor_service_stub.h index 79f9b7ca..0a5d33fa 100644 --- a/services/include/sensor_service_stub.h +++ b/services/include/sensor_service_stub.h @@ -33,7 +33,6 @@ public: private: DISALLOW_COPY_AND_MOVE(SensorServiceStub); - using SensorBaseFunc = ErrCode (SensorServiceStub::*)(MessageParcel &data, MessageParcel &reply); ErrCode SensorEnableInner(MessageParcel &data, MessageParcel &reply); ErrCode SensorDisableInner(MessageParcel &data, MessageParcel &reply); ErrCode GetAllSensorsInner(MessageParcel &data, MessageParcel &reply); diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 1484b96e..1534dc7d 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -37,44 +37,11 @@ namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -SensorServiceStub::SensorServiceStub() -{ - CALL_LOG_ENTER; - baseFuncs_[static_cast(SensorInterfaceCode::ENABLE_SENSOR)] = - &SensorServiceStub::SensorEnableInner; - baseFuncs_[static_cast(SensorInterfaceCode::DISABLE_SENSOR)] = - &SensorServiceStub::SensorDisableInner; - baseFuncs_[static_cast(SensorInterfaceCode::GET_SENSOR_LIST)] = - &SensorServiceStub::GetAllSensorsInner; - baseFuncs_[static_cast(SensorInterfaceCode::TRANSFER_DATA_CHANNEL)] = - &SensorServiceStub::CreateDataChannelInner; - baseFuncs_[static_cast(SensorInterfaceCode::DESTROY_SENSOR_CHANNEL)] = - &SensorServiceStub::DestroyDataChannelInner; - baseFuncs_[static_cast(SensorInterfaceCode::SUSPEND_SENSORS)] = - &SensorServiceStub::SuspendSensorsInner; - baseFuncs_[static_cast(SensorInterfaceCode::RESUME_SENSORS)] = - &SensorServiceStub::ResumeSensorsInner; - baseFuncs_[static_cast(SensorInterfaceCode::GET_ACTIVE_INFO_LIST)] = - &SensorServiceStub::GetActiveInfoListInner; - baseFuncs_[static_cast(SensorInterfaceCode::CREATE_SOCKET_CHANNEL)] = - &SensorServiceStub::CreateSocketChannelInner; - baseFuncs_[static_cast(SensorInterfaceCode::DESTROY_SOCKET_CHANNEL)] = - &SensorServiceStub::DestroySocketChannelInner; - baseFuncs_[static_cast(SensorInterfaceCode::ENABLE_ACTIVE_INFO_CB)] = - &SensorServiceStub::EnableActiveInfoCBInner; - baseFuncs_[static_cast(SensorInterfaceCode::DISABLE_ACTIVE_INFO_CB)] = - &SensorServiceStub::DisableActiveInfoCBInner; - baseFuncs_[static_cast(SensorInterfaceCode::RESET_SENSORS)] = - &SensorServiceStub::ResetSensorsInner; -} +SensorServiceStub::SensorServiceStub() {} -SensorServiceStub::~SensorServiceStub() -{ - CALL_LOG_ENTER; - baseFuncs_.clear(); -} +SensorServiceStub::~SensorServiceStub() {} -int32_t SensorServiceStub::BypassCfiProtection(uint32_t code, MessageParcel &data, MessageParcel &reply, +int32_t SensorServiceStub::BypassOnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { switch (code) { @@ -121,8 +88,8 @@ int32_t SensorServiceStub::BypassCfiProtection(uint32_t code, MessageParcel &dat return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } } - return ERR_OK; } + int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -133,9 +100,8 @@ int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M SEN_HILOGE("Client and service descriptors are inconsistent"); return OBJECT_NULL; } - Cfi(code, data, reply, option); SEN_HILOGD("No member func supporting, applying default process"); - return ERR_OK; + return BypassOnRemoteRequest(code, data, reply, option); } bool SensorServiceStub::IsSystemServiceCalling() -- Gitee From f16d616162a222372038f8928b382248d85487b4 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 29 Jun 2024 17:10:18 +0800 Subject: [PATCH 06/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: Ia62ae16e662ed9114a16ba6e7b21c885ea73938e --- services/src/sensor_service_stub.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 1534dc7d..e86d5a5f 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -41,7 +41,7 @@ SensorServiceStub::SensorServiceStub() {} SensorServiceStub::~SensorServiceStub() {} -int32_t SensorServiceStub::BypassOnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, +int32_t SensorServiceStub::ProcessRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { switch (code) { @@ -88,6 +88,7 @@ int32_t SensorServiceStub::BypassOnRemoteRequest(uint32_t code, MessageParcel &d return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } } + SEN_HILOGD("No member func supporting, applying default process"); } int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, @@ -100,8 +101,7 @@ int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M SEN_HILOGE("Client and service descriptors are inconsistent"); return OBJECT_NULL; } - SEN_HILOGD("No member func supporting, applying default process"); - return BypassOnRemoteRequest(code, data, reply, option); + return ProcessRemoteRequest(code, data, reply, option); } bool SensorServiceStub::IsSystemServiceCalling() -- Gitee From 3ad7595c85226c9c2ba03c1f45e73b3d131e3ea1 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 29 Jun 2024 17:12:47 +0800 Subject: [PATCH 07/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: Idc86797c710effd7959f55a9995b07503f2c0b36 --- services/include/sensor_service_stub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/include/sensor_service_stub.h b/services/include/sensor_service_stub.h index 0a5d33fa..c799965d 100644 --- a/services/include/sensor_service_stub.h +++ b/services/include/sensor_service_stub.h @@ -47,7 +47,7 @@ private: ErrCode DisableActiveInfoCBInner(MessageParcel &data, MessageParcel &reply); ErrCode ResetSensorsInner(MessageParcel &data, MessageParcel &reply); bool IsSystemServiceCalling(); - int32_t BypassCfiProtection(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + int32_t ProcessRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); bool IsSystemCalling(); }; } // namespace Sensors -- Gitee From 0f465de138435bfaa1a4ecde13cfd348c3d19c79 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Sat, 29 Jun 2024 17:57:02 +0800 Subject: [PATCH 08/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: I50be8cc4cffb1a652a3c05c6c3aef531a13b2f85 --- frameworks/native/src/sensor_agent_proxy.cpp | 2 +- services/src/sensor_service_stub.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 14f17c5e..4ff2430b 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -85,7 +85,7 @@ int32_t SensorAgentProxy::CreateSensorDataChannel() } CHKPR(dataChannel_, INVALID_POINTER); auto ret = dataChannel_->CreateSensorDataChannel([this] (SensorEvent *events, int32_t num, void *data) - {this->HandleSensorData(events, num, data);}, nullptr); + { this->HandleSensorData(events, num, data); }, nullptr); if (ret != ERR_OK) { SEN_HILOGE("Create data channel failed, ret:%{public}d", ret); return ret; diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index e86d5a5f..8d07287a 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -85,10 +85,10 @@ int32_t SensorServiceStub::ProcessRemoteRequest(uint32_t code, MessageParcel &da return ResetSensorsInner(data, reply); } default: { + SEN_HILOGD("No member func supporting, applying default process"); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } } - SEN_HILOGD("No member func supporting, applying default process"); } int32_t SensorServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, -- Gitee From 7007301d6508829379405c79d839ca5e7af3cb2b Mon Sep 17 00:00:00 2001 From: cff-gite Date: Mon, 1 Jul 2024 10:44:42 +0800 Subject: [PATCH 09/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: Ifffe110c7ebbd269a12c9086f1c6443e99141c83 --- frameworks/native/src/sensor_service_client.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index fee35a13..7d6ceeec 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -429,7 +429,7 @@ void SensorServiceClient::ReceiveMessage(const char *buf, size_t size) #ifdef OHOS_BUILD_ENABLE_RUST ReadClientPackets(circBuf_.streamBufferPtr_.get(), this, OnPacket); #else - OnReadPackets(circBuf_, [this] (NetPacket &pkt) {this->HandleNetPacke(pkt);}); + OnReadPackets(circBuf_, [this] (NetPacket &pkt) { this->HandleNetPacke(pkt); }); #endif // OHOS_BUILD_ENABLE_RUST } @@ -508,8 +508,8 @@ int32_t SensorServiceClient::CreateSocketChannel() { std::lock_guard channelLock(channelMutex_); if (dataChannel_->AddFdListener(GetFd(), - [this] (const char *buf, size_t size) {this->ReceiveMessage(buf, size);}, - [this] {this->Disconnect();})!= ERR_OK) { + [this] (const char *buf, size_t size) { this->ReceiveMessage(buf, size); }, + [this] { this->Disconnect(); })!= ERR_OK) { Close(); SEN_HILOGE("Add fd listener failed, fd:%{public}d", GetFd()); return ERROR; -- Gitee From 212a2ef48cb0e21fafe8bfcba3fd390a7348469c Mon Sep 17 00:00:00 2001 From: cff-gite Date: Mon, 1 Jul 2024 15:16:14 +0800 Subject: [PATCH 10/10] sensor bypass cfi protection rectification Signed-off-by: cff-gite Change-Id: I7cdde2727e7b523bb55ac9df448fde164ab2f1ec --- frameworks/native/src/sensor_agent_proxy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 4ff2430b..9695f45c 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -84,8 +84,9 @@ int32_t SensorAgentProxy::CreateSensorDataChannel() return ERR_OK; } CHKPR(dataChannel_, INVALID_POINTER); - auto ret = dataChannel_->CreateSensorDataChannel([this] (SensorEvent *events, int32_t num, void *data) - { this->HandleSensorData(events, num, data); }, nullptr); + auto ret = dataChannel_->CreateSensorDataChannel([this] (SensorEvent *events, int32_t num, void *data) { + this->HandleSensorData(events, num, data); + }, nullptr); if (ret != ERR_OK) { SEN_HILOGE("Create data channel failed, ret:%{public}d", ret); return ret; -- Gitee