nvidia-cdi-hook chmod: adopt os.Root confinement like sibling hooks
I maintainer di solito rispondono entro 5 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Start with getPaths() in cmd/nvidia-cdi-hook/chmod/chmod.go, then compare its filesystem operations with the sibling hooks listed in the issue. Trace how run() invokes path resolution and preserve the existing skip behavior for missing or inaccessible paths. The work is done when chmod resolves and modifies paths through the confined root pattern rather than filepath.Join, os.Stat, and os.Chmod, while retaining current hook semantics.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
cmd/nvidia-cdi-hook/chmod/chmod.go (reviewed at tag v1.20.1) resolves its target
paths with plain string concatenation (filepath.Join(root, f)) and then calls
os.Stat (getPaths, chmod.go:143-147) and os.Chmod (run, chmod.go:131)
directly on the resulting string. Every other root-executed, filesystem-writing hook
in the same binary already confines its path resolution:
| Hook | Confinement |
|---|---|
create-symlinks |
pathrs.OpenatInRoot / MkdirAllHandle (cyphar/filepath-securejoin/pathrs-lite) |
enable-cuda-compat |
pathrs.OpenatInRoot + Openat(O_NOFOLLOW|O_EXCL) for writes |
disable-device-node-modification |
os.OpenRoot |
update-application-profile |
os.OpenRoot |
update-ldcache |
pivot_root into the container root |
chmod |
none — filepath.Join + os.Stat + os.Chmod |
The chmod hook is the only hook in this family without root confinement, which makes
it structurally inconsistent with the hardening applied after CVE-2024-0132 /
CVE-2025-23359 / CVE-2026-24260.
Lab verification (no security issue observed)
To be explicit: I tested this end-to-end and found no currently-reachable security
problem. In a real podman + crun pipeline (crun 1.30.1, toolkit v1.20.1, CDI spec
generated with --enable-hooks chmod and --path /dev/dri added to the hook args to
mirror the spec shape produced when a hooked folder is present):
- A container image can carry an absolute symlink at
/dev/drivia anADD
tarball (it survives into the image layer and the extracted rootfs;RUN ln -s
does not survive, since build-time changes under/devare not committed). - However, crun populates the container rootfs
/devwith its own tmpfs before
thecreateContainerhook runs, so the image-supplied symlink is not visible at
hook time. The hook's own debug log confirms it skips the path:
Skipping path ".../rootfs/dev/dri": stat ... no such file or directory.
So this is a defensive consistency request, not a vulnerability report. The
observed runtime behavior masks the issue; the request is to not rely on that
masking.
Request
Rework getPaths() to use the pattern the sibling hooks already use (the module
already pins go 1.26.0, so os.Root is available), e.g.:
root, err := os.OpenRoot(containerRoot)
if err != nil { return err }
defer root.Close()
for _, p := range paths {
if _, err := root.Stat(p); errors.Is(err, fs.ErrNotExist) {
continue
}
f, err := root.OpenFile(p, os.O_RDONLY, 0)
if err != nil { /* skip, as today */ }
if err := f.Chmod(mode); err != nil { /* skip, as today */ }
f.Close()
}
This makes the hook robust against the symlink-following class of bugs by
construction, instead of relying on the runtime's /dev tmpfs masking, and keeps
this file consistent with the rest of the hook family.
Notes
- The hook is marked deprecated; simply removing it would also resolve the
inconsistency. --mode 755and the hooked-folder allowlist (/dev/dri,/dev/nvidia-caps) are
hardcoded in the generator (pkg/nvcdi/workarounds-device-folder-permissions.go),
so the current blast radius is narrow — another reason this is a consistency ask
rather than a security fix.
- Lingua principale
- Go
- Stelle
- 4.6k
- Fork
- 605
- Merge medio
- 7g 15h
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/nvidia-container-toolkit
-
Address TODO comments in internal/platform-support/dgpu/dgpu.goForse già presa @truongbo17 l’ha presa 21 giorni fa. Apertadsx-ws-0930 good-first-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA/nvidia-container-toolkit#2114 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
[Bug]: nvidia-ctk runtime configure --runtime=docker without --set-as-default leaves default-runtime set to nvidiaForse già presa @blacksoxx l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
NVIDIA/nvidia-container-toolkit#2155 ·
I maintainer di solito rispondono entro 5 giorni
-
[Bug]: Containerized installer removes the existing Toolkit installation before the replacement is complete and durableForse già presa @henry118 l’ha presa 1 giorno fa. Apertabug needs-triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
NVIDIA/nvidia-container-toolkit#2153 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 47/100
NVIDIA/nvidia-container-toolkit#2137 ·
I maintainer di solito rispondono entro 5 giorni
-
[Bug]: containerd cleanup removes imports for unrelated drop-insForse già presa @git-jxj l’ha presa 12 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
NVIDIA/nvidia-container-toolkit#2134 ·
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di NVIDIA/nvidia-container-toolkit
Issue simili
-
status:needs-review type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Gentleman-Programming/engram#2079 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
limitlessprojects/Go-Hybrid#1377 ·
I maintainer di solito rispondono entro 1 giorno
-
bug report
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno