Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts EVM JIT trap handling so that faults at (or near) a null pointer are reported as an internal engine error rather than being misclassified as an EVM out-of-bounds memory access, preventing an engine defect from being surfaced as a consensus-visible halt condition.
Changes:
- Add a dedicated
EVMNullPointerDereferenceerror code for JIT-only null-pointer faults. - Update
Runtime::callEVMInJITModesignal-trap mapping to classify low-address SIGSEGV/SIGBUS asEVMC_INTERNAL_ERRORinstead ofEVMC_INVALID_MEMORY_ACCESS.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/runtime/runtime.cpp | Adds low-address (null) fault detection in the EVM JIT trap handler and maps it to an internal EVMC status. |
| src/common/errors.def | Introduces EVMNullPointerDereference to represent JIT null-pointer dereference defects distinctly from EVM execution faults. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+933
to
+936
| /// Size of the unmapped low address range. A faulting address below this is a | ||
| /// null pointer plus a small offset, never a real allocation. | ||
| static constexpr uintptr_t NullPointerPageSize = 4096; | ||
|
|
⚡ Performance Regression Check Results✅ Performance Check Passed (interpreter)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions ✅ Performance Check Passed (multipass)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions |
This was referenced Aug 29, 2026
abmcar
force-pushed
the
fix/evm-null-deref-classification
branch
from
October 9, 2026 09:14
9f5cbc3 to
f41ef6a
Compare
5 of 16 tasks
callEVMInJITMode mapped every SIGSEGV/SIGBUS that was not native stack exhaustion to EVMC_INVALID_MEMORY_ACCESS, a mapping inherited from the guard-page bounds checks of WebAssembly. EVM memory is never bounds-checked by a fault, so in EVM JIT code such a fault is an engine defect, and reporting it as an EVM halt let the embedder accept a wrong result. Report it as EVMC_INTERNAL_ERROR, as other unexpected signals already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
abmcar
force-pushed
the
fix/evm-null-deref-classification
branch
from
October 11, 2026 06:55
f41ef6a to
754dd9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
2. What is the scope of this PR (e.g. component or file name):
Runtime::callEVMInJITModeinsrc/runtime/runtime.cpp.3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
In EVM JIT code, every SIGSEGV/SIGBUS that was not native stack exhaustion was reported as
EVMC_INVALID_MEMORY_ACCESS. The mapping comes from WebAssembly, whose linear memory is bounds-checked by guard pages. EVM memory is a heap buffer expanded explicitly before each access, and EVM exceptions use the illegal-instruction trap, so such a fault can only be an engine defect. Reported as an EVM halt, it was accepted as a valid result: with the stale memory base fixed in #600, the replay of mainnet block 25818502 finished with wrong gas instead of failing.This PR reports these faults as
EVMC_INTERNAL_ERROR, as other unexpected signals already are. Stack exhaustion still maps toEVMC_STACK_OVERFLOW.Change doc:
docs/changes/2026-10-11-evm-jit-fault-internal-error4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
An embedder now receives
EVMC_INTERNAL_ERRORinstead ofEVMC_INVALID_MEMORY_ACCESSfor a fault in EVM JIT code. No status changes for any condition the EVM defines.5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:
No new tests.
ctest(default and CI multipass arguments) andtools/run_evm_tests.py(multipass, interpreter) pass.6. Release note
🤖 Generated with Claude Code