Fix XCHG atomic operation to fetch old value per eBPF spec#41
Fix XCHG atomic operation to fetch old value per eBPF spec#41Officeyutong merged 2 commits intomainfrom
Conversation
Co-authored-by: yunwei37 <34985212+yunwei37@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #41 +/- ##
=======================================
Coverage 79.00% 79.00%
=======================================
Files 5 5
Lines 1229 1229
Branches 134 134
=======================================
Hits 971 971
Misses 258 258
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
can you update the bpf conformance_test so the Ci is actually exam the tests cases? Currently ci will pass without valid the testcases of bpf conformance |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the LLVM JIT compiler where the EBPF_ATOMIC_OP_XCHG operation was not returning the old memory value to the source register as required by the eBPF specification. The fix resolves failures in the lock_xchg and lock_xchg32 conformance tests.
Changes:
- Changed the
is_fetchparameter fromfalsetotruein theEBPF_ATOMIC_OP_XCHGhandler to comply with the eBPF specification
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The
lock_xchgandlock_xchg32conformance tests were failing because the atomic exchange operation wasn't storing the old memory value back to the source register.Changes
is_fetchparameter fromfalsetotrueinEBPF_ATOMIC_OP_XCHGhandlerThe eBPF spec defines
EBPF_ATOMIC_OP_XCHGas(0xe0 | EBPF_ATOMIC_OP_FETCH), meaning the fetch flag is always set. The operation must atomically exchange values and return the old memory value in the source register.All 34 lock-related conformance tests now pass.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.