[CUDA][srad_v2] Out-of-bounds neighbor reads occur before boundary correction
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Comienza en cuda/srad_v2/srad_kernel.cu, en srad_cuda_1 y srad_cuda_2, siguiendo index_n e index_s a través de las ramas de los límites. Verifica que, antes de la corrección, ninguna carga de un vecino pueda acceder fuera de la asignación de rows * cols; después, valida el resultado con las pruebas de seguridad de memoria del repositorio.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The srad_v2 CUDA implementation in this repository contains global-memory out-of-bounds reads in srad_cuda_1 and srad_cuda_2.
The kernels compute neighbor indices and immediately use them to load data from global memory. For boundary blocks, some of these indices fall outside the underlying allocation. The code only replaces the corresponding shared-memory values with valid boundary values after the
loads have already occurred.
I detected these invalid reads during memory-safety testing and subsequently confirmed the issue from the source-level index calculations.
Affected Code
File: cuda/srad_v2/srad_kernel.cu
In srad_cuda_1, neighbor values are loaded before the boundary condition is handled:
north[ty][tx] = J_cuda[index_n];
south[ty][tx] = J_cuda[index_s];
if (by == 0) {
north[ty][tx] = J_cuda[BLOCK_SIZE * bx + tx];
} else if (by == gridDim.y - 1) {
south[ty][tx] =
J_cuda[cols * BLOCK_SIZE * (gridDim.y - 1)
+ BLOCK_SIZE * bx
+ cols * (BLOCK_SIZE - 1) + tx];
}
A similar pattern occurs in srad_cuda_2:
south_c[ty][tx] = C_cuda[index_s];
if (by == gridDim.y - 1) {
south_c[ty][tx] =
C_cuda[cols * BLOCK_SIZE * (gridDim.y - 1)
+ BLOCK_SIZE * bx
+ cols * (BLOCK_SIZE - 1) + tx];
}
Root Cause
The device arrays contain exactly:
rows * cols
elements, so the valid index range is:
0 ... rows * cols - 1
For the top block row (by == 0), index_n is negative, causing a read before the beginning of J_cuda.
For the bottom block row (by == gridDim.y - 1), the south-neighbor index satisfies:
index_s >= rows * cols
and therefore accesses memory beyond the end of the allocation.
For example, with:
rows = 128
cols = 128
the allocation contains:
128 * 128 = 16384
floating-point elements, corresponding to:
16384 * sizeof(float) = 65536 bytes
The first invalid south-neighbor access can therefore occur at:
base + 65536
which is exactly the first address beyond the allocation.
The later boundary correction only overwrites the value stored in shared memory. It cannot undo the out-of-bounds global-memory read
that has already occurred.
The same issue also affects the corresponding neighbor accesses in srad_cuda_2.
- Lenguaje dominante
- C
- Estrellas
- 56
- Forks
- 41
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaParallel/rodinia
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
JuliaParallel/rodinia#7 · 1 comentario ·
-
for dataset binaryAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
JuliaParallel/rodinia#4 ·
Todos los issues de JuliaParallel/rodinia
Issues similares
-
parsedate: two-digit year "70" is read as 2070, so cookies deleted with expires=...01-Jan-70... are keptPosiblemente ocupada @lazerg la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
clang:frontend clang:openmp crash
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
llvm/llvm-project#245442 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug 🐞
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
valkey-io/valkey-glide#7848 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
InauguralSystems/EigenScript#2518 · 1 comentario ·
Los mantenedores suelen responder en 1 día