GPU: hold SHADER_HEAPS across descriptor mirror and check query offsets
mirror() previously dropped the SHADER_HEAPS lock inside shader_slot() before using the returned &Heap, allowing a concurrent Heap::drop to free the heap while mirror() accessed it. Also guards copy_simple() against invalid descriptor kinds, rejects placed heaps whose address+size wraps u64, and checks offset+count*bytes in resolve_queries() against overflow (with a regression test). (cherry picked from commit 628b95da5e738046d00995743e07137e48936ba6)
This commit is contained in:
1 parent
f1650b7e45
commit
51b9d09b34
3 files changed
+84
-16
No files matched your search
@@ -2856,6 +2856,43 @@ static RESOURCE_FUNCTIONS: Table<32> = {
|
||||
Table(f)
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn test_buffer(width: u64) -> This {
|
||||
let heap = HeapProperties {
|
||||
kind: 1,
|
||||
cpu_pages: 0,
|
||||
pool: 0,
|
||||
creation_nodes: 0,
|
||||
visible_nodes: 0,
|
||||
};
|
||||
let desc = ResourceDesc {
|
||||
dimension: BUFFER,
|
||||
alignment: 0,
|
||||
width,
|
||||
height: 1,
|
||||
depth_or_array_size: 1,
|
||||
mip_levels: 1,
|
||||
format: 0,
|
||||
sample_count: 1,
|
||||
sample_quality: 0,
|
||||
layout: 1,
|
||||
flags: 0,
|
||||
};
|
||||
let mut out = std::ptr::null();
|
||||
let hr = create_committed(
|
||||
std::ptr::null(),
|
||||
&heap,
|
||||
0,
|
||||
&desc,
|
||||
0,
|
||||
std::ptr::null(),
|
||||
&RESOURCE_IIDS[0],
|
||||
&mut out,
|
||||
);
|
||||
assert_eq!(hr, S_OK);
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user