NVIDIA / NVIDIA/k8s-device-plugin

vendored go-nvlib is affected by tryResolveLibrary directory-shadowing bug (NVIDIA/go-nvlib#107)

Open
#1,945 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.9k
Forks
868
Avg merge
2d 14h
Merged PRs (30d)
27

Description

This repo vendors github.com/NVIDIA/go-nvlib v0.12.0 (vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/root.go), pulled in both directly and through github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi, and used from internal/rm, internal/plugin, internal/resource, and the plugin, gfd, and mps-control-daemon entrypoints.

That version has the bug from NVIDIA/go-nvlib#107: tryResolveLibrary resolves each candidate path with filepath.EvalSymlinks but never checks whether the result is a regular file. EvalSymlinks succeeds for directories too, so a stray directory named after a library in an earlier search path, for example /usr/lib64/libnvidia-ml.so.1, shadows the real library found later under /usr/lib/x86_64-linux-gnu. Driver library discovery here can end up pointing at a directory instead of the real .so.

The fix ("Skip non-regular files in tryResolveLibrary") is merged in NVIDIA/go-nvlib#108, but go-nvlib hasn't tagged a release past v0.12.0, so a normal go get -u won't pick it up yet.

Once go-nvlib cuts a release with #108 in it, or if a pseudo-version pin to the merge commit a9dc4f8 works as a stopgap, this repo's go.mod and vendor tree need the bump. nvidia-container-toolkit vendors the same broken copy directly (filed as NVIDIA/nvidia-container-toolkit#1966), and this repo pulls it in a second time through that module.

Closed issue: NVIDIA/go-nvlib#107
Merged fix: NVIDIA/go-nvlib#108
Same issue in nvidia-container-toolkit: NVIDIA/nvidia-container-toolkit#1966

I can open the dependency bump PR once a release or pseudo-version is agreed on.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect go.mod and vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/root.go to confirm the pinned v0.12.0 copy and affected vendored code. Check whether a release containing NVIDIA/go-nvlib#108 is available; otherwise evaluate the proposed pseudo-version. Done means updating the dependency and vendor tree so tryResolveLibrary skips non-regular files.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.