Fix the "--enable-optimization Seg Fault"#96
Conversation
…fixing a seg fault.
Greptile SummaryThis PR fixes a segfault that occurs when Centrallix is compiled with Confidence Score: 5/5Safe to merge — the core fix is correct and the only finding is a minor style concern about include ordering. The fix correctly disables unreliable __builtin_return_address(1) debug checks under optimization. One P2 comment about config.h placement after system headers, which is consistent with an existing pattern in the codebase and does not affect correctness of this change. No files require special attention.
|
| Filename | Overview |
|---|---|
| centrallix/include/cxss/cxss.h | Adds #ifdef HAVE_CONFIG_H / #include "config.h" and conditionally disables CXSS_DEBUG_CONTEXTSTACK when USING_OPTIMIZATION is defined, preventing seg-faults from unreliable __builtin_return_address(1) under optimization; config.h is included after system headers rather than first. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Compile centrallix] --> B{--enable-optimization?}
B -- Yes --> C[USING_OPTIMIZATION defined in config.h]
B -- No --> D[USING_OPTIMIZATION not defined]
C --> E[CXSS_DEBUG_CONTEXTSTACK = 0]
D --> F[CXSS_DEBUG_CONTEXTSTACK = 1]
E --> G["CallerReturnAddr field NOT in CxssCtxStack struct\n__builtin_return_address checks DISABLED"]
F --> H["CallerReturnAddr field IN CxssCtxStack struct\n__builtin_return_address checks ENABLED"]
G --> I["cxssPushContext / cxssPopContext run safely"]
H --> J["Push/Pop mismatch detection active\n(debug builds only)"]
Reviews (2): Last reviewed commit: "Add code to disable CXSS_DEBUG_CONTEXTST..." | Re-trigger Greptile
--enable-optimization Is Used--enable-optimization Seg Fault"
|
This PR is cleared for human review. |
Add code to disable
CXSS_DEBUG_CONTEXTSTACKwhen theUSING_OPTIMIZATIONflag is defined. The checks made by context stack debugging can cause seg-faults if the compiler applies optimizations. With this PR, such checks are now disabled, allowing pages to load successfully again with--enable-optimizationin use.