-
Notifications
You must be signed in to change notification settings - Fork 11
GPUOP-907: fix gpuagent SIGSEGV on MI350P from clock freq OOB read #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,9 +46,10 @@ static inline void | |
| find_low_high_frequency (amdsmi_frequencies_t *freq, | ||
| uint32_t *min, uint32_t *max) | ||
| { | ||
| // create a vector of the valid frequencies | ||
| std::vector<uint64_t> f(freq->frequency, | ||
| freq->frequency + freq->num_supported); | ||
| // clamp num_supported to the array bound before building the vector | ||
| uint32_t n = (freq->num_supported < AMDSMI_MAX_NUM_FREQUENCIES) ? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix alignment |
||
| freq->num_supported : AMDSMI_MAX_NUM_FREQUENCIES; | ||
| std::vector<uint64_t> f(freq->frequency, freq->frequency + n); | ||
|
|
||
| // sort vector | ||
| std::sort(f.begin(), f.end()); | ||
|
|
@@ -76,6 +77,24 @@ find_low_high_frequency (amdsmi_frequencies_t *freq, | |
| return; | ||
| } | ||
|
|
||
| /// \brief return current raw frequency in Hz, clamping an out-of-bounds index | ||
| /// \param[in] freq frequencies struct from amdsmi | ||
| /// \return current frequency in Hz; 0 when no supported frequencies, | ||
| /// else the first entry if current is out of range | ||
| static inline uint64_t | ||
| current_frequency_hz (amdsmi_frequencies_t *freq) | ||
| { | ||
| uint32_t n, idx; | ||
|
|
||
| if (freq->num_supported == 0) { | ||
| return 0; | ||
| } | ||
| n = (freq->num_supported < AMDSMI_MAX_NUM_FREQUENCIES) ? | ||
| freq->num_supported : AMDSMI_MAX_NUM_FREQUENCIES; | ||
| idx = (freq->current < n) ? freq->current : 0; | ||
| return freq->frequency[idx]; | ||
| } | ||
|
|
||
| /// \brief convert amdsmi virtualization mode to aga vritualization mode | ||
| /// \param[in] virt_mode amdsmi virtualization mode | ||
| /// \return aga virtualization mode | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the order of variables