Uninitialized `mnt` dereferenced on `mount_with_flags` failure path (src/nvc_mount.c)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 82/100
Línea de trabajo
Lee mount_with_flags() en src/nvc_mount.c, especialmente su ruta de limpieza fail:, y compárala con las funciones auxiliares de montaje adyacentes que inicializan mnt. El issue proporciona una reproducción con AddressSanitizer e identifica errores tempranos que hay que comprobar. La tarea estará terminada cuando la ruta de error gestione de forma segura un montaje no establecido y la reproducción ya no provoque un fallo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
mount_with_flags() in src/nvc_mount.c declares char *mnt without an initializer (:82) and the fail path does unmount(mnt) at :99. All the early exits — file_mode(src), file_create(dst), xmount returning EPERM — jump to fail: before mnt is ever assigned, so cleanup runs on a garbage stack pointer: str_empty() dereferences it (utils.c:171), and if the garbage is non-NULL it also umount2()s and file_remove()/nftw()s a random pointer.
Every other mount helper in the file handles this. mount_procfs_gpu/mount_procfs_mig use char *mnt = NULL, mount_device/mount_ipc fail with unmount(dst), nvc_imex_channel_mount initializes to NULL. mount_with_flags looks like it was missed in the same sweep that fixed the nvc_ldcache.c pointer UB in 1.17.8 (#316/#318) — this one is still broken in v1.20.2 (c7727e5) and on current main.
Deterministic repro: small harness that #includes nvc_mount.c and links the repo's own make debug objects, compiled with -ftrivial-auto-var-init=pattern, calling the function with a failing src:
==469703==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x5583f862b232 bp 0x7fff18909f90 sp 0x7fff18909f78 T0)
==469703==The signal is caused by a READ memory access.
#0 str_empty src/utils.c:171
#1 unmount src/nvc_mount.c:512
#2 mount_with_flags src/nvc_mount.c:99
#3 t_mount_with_flags harness/h2_path.c:103
#4 main harness/h2_path.c:218
SUMMARY: AddressSanitizer: SEGV src/utils.c:171 in str_empty
Exactly where it should fault: unmount(mnt) at :99 reading the never-assigned mnt.
Also hit it end-to-end on the release build: nvidia-container-cli configure with the container rootfs bind-mounted read-only dies at file_create with "read-only file system", which is the same goto fail. In that run the stack slot happened to be benign, so it quietly umount2()d a garbage pointer and exited normally. So in default builds the outcome depends on stack contents: crash, or silent bogus cleanup — never a correct one.
Fix is one line, same as the siblings:
- char *mnt;
+ char *mnt = NULL;
(For clarity vs #377: that one is about the cleanup being harmful when it runs correctly on a shared rootfs. Here the cleanup argument itself is uninitialized memory. Different bug, same code region.)
- Lenguaje dominante
- C
- Estrellas
- 1.1k
- Forks
- 278
- Merge medio
- 3 d 7 h
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 NVIDIA/libnvidia-container
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
NVIDIA/libnvidia-container#406 ·
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 58/100
NVIDIA/libnvidia-container#409 ·
-
question
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
NVIDIA/libnvidia-container#404 ·
-
OpenSuSE Leap 15.2 is missingPosiblemente ocupada @gusraggio la tomó hace 44 días. Abiertoquestion
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
NVIDIA/libnvidia-container#100 · 9 comentarios · 1 reacción ·
Todos los issues de NVIDIA/libnvidia-container
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition rootPosiblemente ocupada @tuhaihe la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/cloudberry#2356 ·
Los mantenedores suelen responder en 2 días
-
windows-artifacts: the win-arm64 job uses a Visual Studio generator missing from windows-11-armAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
-
Add Royalty funding badgeAbierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
crosspoint-reader/crosspoint-reader#4535 ·
Los mantenedores suelen responder en 1 día
-
[core] Clients never advertise RNS_UD_CS_SUPPORT_ERRINFO_PDU, so a conforming server can't send them Set Error InfoPosiblemente ocupada @akallabeth la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
FreeRDP/FreeRDP#14230 · 1 comentario ·
Los mantenedores suelen responder en 1 día