Bug 2099930
| Summary: | Macro SH_TAILQ_NEXT may cause a potential infinite loop in libdb | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | freshmakeruser | ||||
| Component: | libdb | Assignee: | Filip Januš <fjanus> | ||||
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 36 | CC: | fjanus, hhorak, jnovy, jstanek, jsynacek, mmuzila, odubaj, pkubat | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | --- | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2023-05-25 16:17:17 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
This message is a reminder that Fedora Linux 36 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '36'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see it. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 36 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed. Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16. Fedora Linux 36 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed. |
Created attachment 1891791 [details] Attached is the fix patch src/dbinc/shqueue.h:264 SH_TAILQ_NEXT macro may cause a potential infinite loop src/mp/mp_alloc.c:306 Iterate through the 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))) When (elm)->field.stqe_next is 0, src/mp/mp_alloc.c:306 will be trapped in a infinite loop because the buffer traversed to is still itself. The robustness of the program should be guaranteed within the SH_TAILQ_NEXT macro, and the call point should not be expected not to pass in an exception value. Modify the code attached to mp_alloc.c:306 so that the field.stqe_next of a certain buffer is 0. It is easy to dummy out and the program is stuck in a infinite loop. Therefore (elm)->field.stqe_next == 0 should also be the termination condition to determine. At this point, jump out of the loop and continue to traverse the next hash bucket, rather than repeatedly traverse the same buffer and fall into a infinite loop. Attached is the fix patch.