From 15a54e18f4904b24fdb68ce3ae2ac91ac499b305 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 12 Dec 2024 11:36:41 +0800 Subject: [PATCH 1/5] qos adapt cross_plateform Signed-off-by: liuyuxiu --- services/src/qos_interface.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index 4caa882..c230a42 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -27,7 +27,10 @@ #include #include "concurrent_task_log.h" + +#if !defined(CROSS_PLATFORM) #include "concurrent_task_utils.h" +#endif static int TrivalOpenRtgNode(void) { @@ -62,14 +65,17 @@ int EnableRtg(bool flag) if (fd < 0) { return fd; } +#if !defined(CROSS_PLATFORM) fdsan_exchange_owner_tag(fd, 0, GetAddrTag(static_cast(&fd))); +#endif int ret = ioctl(fd, CMD_ID_SET_ENABLE, &enableData); if (ret < 0) { CONCUR_LOGE("set rtg config enable failed."); } - +#if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); +#endif return 0; }; @@ -87,7 +93,9 @@ int QosApplyForOther(unsigned int level, int tid) if (fd < 0) { return fd; } +#if !defined(CROSS_PLATFORM) fdsan_exchange_owner_tag(fd, 0, GetAddrTag(static_cast(&fd))); +#endif struct QosCtrlData data; data.level = level; @@ -98,7 +106,9 @@ int QosApplyForOther(unsigned int level, int tid) if (ret < 0) { CONCUR_LOGE("[Interface] task %{public}d apply qos failed, errno = %{public}d", tid, errno); } +#if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); +#endif return ret; } @@ -108,7 +118,9 @@ int QosLeave(void) if (fd < 0) { return fd; } +#if !defined(CROSS_PLATFORM) fdsan_exchange_owner_tag(fd, 0, GetAddrTag(static_cast(&fd))); +#endif struct QosCtrlData data; data.type = static_cast(QosManipulateType::QOS_LEAVE); @@ -118,7 +130,9 @@ int QosLeave(void) if (ret < 0) { CONCUR_LOGE("[Interface] task %{public}d leave qos failed, errno = %{public}d", gettid(), errno); } +#if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); +#endif return ret; } @@ -128,7 +142,9 @@ int QosLeaveForOther(int tid) if (fd < 0) { return fd; } +#if !defined(CROSS_PLATFORM) fdsan_exchange_owner_tag(fd, 0, GetAddrTag(static_cast(&fd))); +#endif struct QosCtrlData data; data.type = static_cast(QosManipulateType::QOS_LEAVE); @@ -138,7 +154,9 @@ int QosLeaveForOther(int tid) if (ret < 0) { CONCUR_LOGE("[Interface] task %{public}d leave qos failed, errno = %{public}d", tid, errno); } +#if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); +#endif return ret; } @@ -148,13 +166,17 @@ int QosPolicySet(const struct QosPolicyDatas* policyDatas) if (fd < 0) { return fd; } +#if !defined(CROSS_PLATFORM) fdsan_exchange_owner_tag(fd, 0, GetAddrTag(static_cast(&fd))); +#endif int ret = ioctl(fd, QOS_CTRL_POLICY_OPERATION, policyDatas); if (ret < 0) { CONCUR_LOGE("[Interface] set qos policy failed, errno = %{public}d", errno); } +#if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); +#endif return ret; } @@ -170,7 +192,9 @@ int QosGetForOther(int tid, int& level) if (fd < 0) { return fd; } +#if !defined(CROSS_PLATFORM) fdsan_exchange_owner_tag(fd, 0, GetAddrTag(static_cast(&fd))); +#endif struct QosCtrlData data; data.type = static_cast(QosManipulateType::QOS_GET); @@ -182,7 +206,8 @@ int QosGetForOther(int tid, int& level) CONCUR_LOGE("[Interface] task %{public}d get qos failed, errno = %{public}d", tid, errno); } level = data.qos; - +#if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); +#endif return ret; } \ No newline at end of file -- Gitee From 34b576a5e1ebd36282687c43261ddd00c540c7ce Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 12 Dec 2024 13:44:22 +0800 Subject: [PATCH 2/5] qos FDSAN adapt cross_plateform Signed-off-by: liuyuxiu --- common/src/concurrent_task_utils.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/src/concurrent_task_utils.cpp b/common/src/concurrent_task_utils.cpp index 82df7b7..4cbf5b6 100644 --- a/common/src/concurrent_task_utils.cpp +++ b/common/src/concurrent_task_utils.cpp @@ -21,8 +21,10 @@ uint64_t GetAddrTag(void* addr) { uint64_t tag = 0; +#if !defined(CROSS_PLATFORM) if (addr != nullptr) { tag = fdsan_create_owner_tag(FDSAN_OWNER_TYPE_FILE, (uint64_t)addr); } +#endif return tag; } \ No newline at end of file -- Gitee From 186febbc2e97ee436abc731a8407cd9455d35ef4 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 12 Dec 2024 15:03:32 +0800 Subject: [PATCH 3/5] qos FDSAN adapt cross_plateform Signed-off-by: liuyuxiu --- services/src/qos_interface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index c230a42..22c6031 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -76,6 +76,7 @@ int EnableRtg(bool flag) #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); #endif + close(fd); return 0; }; @@ -109,6 +110,7 @@ int QosApplyForOther(unsigned int level, int tid) #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); #endif + close(fd); return ret; } @@ -133,6 +135,7 @@ int QosLeave(void) #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); #endif + close(fd) return ret; } @@ -157,6 +160,7 @@ int QosLeaveForOther(int tid) #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); #endif + close(fd); return ret; } @@ -177,6 +181,7 @@ int QosPolicySet(const struct QosPolicyDatas* policyDatas) #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); #endif + close(fd); return ret; } @@ -209,5 +214,6 @@ int QosGetForOther(int tid, int& level) #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); #endif + close(fd); return ret; } \ No newline at end of file -- Gitee From 929f65613ebf53ee061d7ddde598e338f844cf77 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 12 Dec 2024 15:10:37 +0800 Subject: [PATCH 4/5] qos FDSAN adapt cross_platform Signed-off-by: liuyuxiu --- services/src/qos_interface.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index 22c6031..19b7840 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -75,8 +75,9 @@ int EnableRtg(bool flag) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#endif +#elif close(fd); +#endif return 0; }; @@ -109,8 +110,9 @@ int QosApplyForOther(unsigned int level, int tid) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#endif +#elif close(fd); +#endif return ret; } @@ -134,8 +136,9 @@ int QosLeave(void) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#endif +#elif close(fd) +#endif return ret; } @@ -159,8 +162,9 @@ int QosLeaveForOther(int tid) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#endif +#elif close(fd); +#endif return ret; } @@ -180,8 +184,9 @@ int QosPolicySet(const struct QosPolicyDatas* policyDatas) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#endif +#elif close(fd); +#endif return ret; } @@ -213,7 +218,8 @@ int QosGetForOther(int tid, int& level) level = data.qos; #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#endif +#elif close(fd); +#endif return ret; } \ No newline at end of file -- Gitee From 82c0406fa6ef0b95617d1b5b5f80dbf73af09743 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Fri, 13 Dec 2024 10:20:56 +0800 Subject: [PATCH 5/5] qos FDSAN adapt cross_plateform Signed-off-by: liuyuxiu --- services/src/qos_interface.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index 19b7840..25e2694 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -75,7 +75,7 @@ int EnableRtg(bool flag) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#elif +#else close(fd); #endif @@ -110,7 +110,7 @@ int QosApplyForOther(unsigned int level, int tid) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#elif +#else close(fd); #endif return ret; @@ -136,8 +136,8 @@ int QosLeave(void) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#elif - close(fd) +#else + close(fd); #endif return ret; } @@ -162,7 +162,7 @@ int QosLeaveForOther(int tid) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#elif +#else close(fd); #endif return ret; @@ -184,7 +184,7 @@ int QosPolicySet(const struct QosPolicyDatas* policyDatas) } #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#elif +#else close(fd); #endif return ret; @@ -218,7 +218,7 @@ int QosGetForOther(int tid, int& level) level = data.qos; #if !defined(CROSS_PLATFORM) fdsan_close_with_tag(fd, GetAddrTag(static_cast(&fd))); -#elif +#else close(fd); #endif return ret; -- Gitee