Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
9
Star
0
Fork
18
src-openEuler
/
libdb
Code
Issues
3
Pull Requests
0
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
SH_TAILQ_NEXT宏可能会导致潜在的死循环
Done
#I5D9LX
Bug
kouwq
Opened this issue
2022-06-21 10:05
src/dbinc/shqueue.h:264 宏SH_TAILQ_NEXT 可能会导致潜在的死循环 src/mp/mp_alloc.c:306 遍历buffer list ``` SH_TAILQ_FOREACH(current_bhp, &hp->hash_bucket, hq, __bh) { ``` src/dbinc/shqueue.h:316 ``` #define SH_TAILQ_FOREACH(var, head, field, type) \ for ((var) = SH_TAILQ_FIRST((head), type); \ (var) != NULL; \ (var) = SH_TAILQ_NEXT((var), field, type)) ``` src/dbinc/shqueue.h:264 ``` #define SH_TAILQ_NEXT(elm, field, type) \ ((elm)->field.stqe_next == -1 ? NULL : \ ((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next))) ``` 当(elm)->field.stqe_next为0时,src/mp/mp_alloc.c:306会因为遍历到的buffer还是其自身而陷入死循环, 应该在SH_TAILQ_NEXT宏内保证程序的健壮性,而不能期待调用点不去传入一个异常的值。 修改mp_alloc.c:306附件的代码,使某个buffer的field.stqe_next为0,很容易可以dummy出,程序陷入死循环的现象。
src/dbinc/shqueue.h:264 宏SH_TAILQ_NEXT 可能会导致潜在的死循环 src/mp/mp_alloc.c:306 遍历buffer list ``` SH_TAILQ_FOREACH(current_bhp, &hp->hash_bucket, hq, __bh) { ``` src/dbinc/shqueue.h:316 ``` #define SH_TAILQ_FOREACH(var, head, field, type) \ for ((var) = SH_TAILQ_FIRST((head), type); \ (var) != NULL; \ (var) = SH_TAILQ_NEXT((var), field, type)) ``` src/dbinc/shqueue.h:264 ``` #define SH_TAILQ_NEXT(elm, field, type) \ ((elm)->field.stqe_next == -1 ? NULL : \ ((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next))) ``` 当(elm)->field.stqe_next为0时,src/mp/mp_alloc.c:306会因为遍历到的buffer还是其自身而陷入死循环, 应该在SH_TAILQ_NEXT宏内保证程序的健壮性,而不能期待调用点不去传入一个异常的值。 修改mp_alloc.c:306附件的代码,使某个buffer的field.stqe_next为0,很容易可以dummy出,程序陷入死循环的现象。
Comments (
2
)
Sign in
to comment
Status
Done
Backlog
已挂起
Fixing
Confirmed
Done
Accepted
Canceled
Assignees
Not set
Labels
sig/Base-service
Not set
Projects
Unprojected
Unprojected
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (29)
Tags (24)
master
openEuler-24.03-LTS-Next
openEuler-24.03-LTS-SP1
openEuler-24.03-LTS-SP2
openEuler-24.03-LTS-SP3
openEuler-24.03-LTS
openEuler-24.09
openEuler-25.03
openEuler-25.09
openEuler-22.03-LTS-Next
openEuler-22.03-LTS-SP4
openEuler-22.03-LTS-SP1
openEuler-22.03-LTS-SP2
openEuler-22.03-LTS-SP3
openEuler-20.03-LTS-SP1
openEuler-20.03-LTS-SP3
openEuler-20.03-LTS-SP4
openEuler-22.03-LTS
openEuler-23.03
openEuler-23.09
openEuler-22.09
openEuler-21.03
openEuler-20.09
openEuler-20.03-LTS-Next
openEuler-20.03-LTS-SP2
openEuler-20.03-LTS
openEuler-21.09
openEuler1.0
openEuler1.0-base
openEuler-25.09-release
openEuler-24.03-LTS-SP2-release
openEuler-25.03-release
openEuler-24.03-LTS-SP1-release
openEuler-22.03-LTS-SP4-release
openEuler-24.09-release
openEuler-24.03-LTS-release
openEuler-22.03-LTS-SP3-release
openEuler-23.09-rc5
openEuler-22.03-LTS-SP1-release
openEuler-22.09-release
openEuler-22.09-rc5
openEuler-22.09-20220829
openEuler-22.03-LTS-20220331
openEuler-22.03-LTS-round5
openEuler-22.03-LTS-round3
openEuler-22.03-LTS-round2
openEuler-22.03-LTS-round1
openEuler-20.03-LTS-SP3-release
openEuler-20.03-LTS-SP2-20210624
openEuler-21.03-20210330
openEuler-20.03-LTS-20200606
openEuler-20.03-LTS-tag
openEuler-20.09-20200928
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(1)
1
https://gitee.com/src-openeuler/libdb.git
git@gitee.com:src-openeuler/libdb.git
src-openeuler
libdb
libdb
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register