Repository navigation
fix(AIESW-42718,AIESW-42772,AIESW-42780,AIESW-42800): zocl sysfs, copy-BO, aied, and KDS stat safety - #10107
Merged
Conversation
Each populated PR slot copied up to the original count into the kernfs buffer. Shrink the remaining budget after every copy so later slots cannot write past it. Co-authored-by: Cursor <cursoragent@cursor.com>
dst_offset and src_offset are attacker-controlled uint64_t values. Compare each offset to the BO size before adding so a wrapped sum cannot pass the DMA bounds check. Co-authored-by: Cursor <cursoragent@cursor.com>
pollAIE reads mGraphs while register and deregister mutate it. Hold a mutex around those accesses and publish the shutdown flag with an atomic so the poll thread cannot use a freed graph. Co-authored-by: Cursor <cursoragent@cursor.com>
show_kds_cuctx_stat_raw walked client and CU-context lists under cu_mgmt->lock, which does not protect those lists. Take kds->lock and client->lock in the same order as the writers, and reject a cu_idx outside xcus[]. Co-authored-by: Cursor <cursoragent@cursor.com>
ManojTakasi
requested review from
chvamshi-xilinx and
larry9523
as code owners
October 9, 2026 12:57
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
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.
Problem solved by the commit
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
How problem was solved, alternative solutions (if any) and why they were rejected
AIESW-42718. Each reader stops when count is exhausted and subtracts nread after every slot copy. A single helper was rejected so the five existing copy sites stay local and the per-slot offset behavior is unchanged.
AIESW-42772. The check is now offset > bo_size || size > bo_size - offset, for both source and destination, before any addition. check_add_overflow() was rejected because the needed condition is "this range lies inside the buffer object," which the compare-before-subtract states directly.
AIESW-42780. m_graphs_lock covers register, deregister, the empty check, and the status loop, including getname() and getstatus(). done is std::atomic. std::lock_guard unlocks at the end of its scope. Copying the vector and dropping the lock before getname()/getstatus() was rejected because the graph object can still be destroyed. std::shared_mutex was rejected because the poll thread must exclude deregister for the whole call. On rebase, upstream had renamed Aied to aied; the same lock was applied to m_graphs.
AIESW-42800. The walk takes kds->lock around kds->clients and client->lock around each client's lists. cu_mgmt->lock is taken only while reading xcus[], and only after client->lock, because the ioctl path already uses that order. cu_idx >= MAX_CUS is skipped. RCU was rejected because these lists already have mutexes. Holding cu_mgmt->lock and then taking client->lock was rejected because kds_add_context() and kds_del_context() take client->lock and then cu_mgmt->lock.
Risks (if any) associated the changes in the commit
low
What has been tested and how, request additional testing if necessary
Testd on vck190 hw
Documentation impact (if any)
None