Skip to content

Commit 00c5d3b

Browse files
committed
fixup! Add a hook to update nvidia params
Signed-off-by: Evan Lezar <[email protected]>
1 parent 11d4e0e commit 00c5d3b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cmd/nvidia-cdi-hook/update-nvidia-params/mount_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ import (
2424
)
2525

2626
func bindMountReadonly(source string, target string) error {
27-
return unix.Mount(source, target, "", unix.MS_BIND|unix.MS_RDONLY, "")
27+
return unix.Mount(source, target, "", unix.MS_BIND|unix.MS_RDONLY|unix.MS_NOSYMFOLLOW, "")
2828

2929
}

cmd/nvidia-cdi-hook/update-nvidia-params/update-nvidia-params.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"io"
2424
"os"
25+
"path/filepath"
2526
"strings"
2627

2728
"github.com/urfave/cli/v2"
@@ -150,7 +151,7 @@ func (m command) updateNvidiaParamsFromReader(r io.Reader, containerRoot string)
150151
return fmt.Errorf("failed to set permissions on temporary params file: %w", err)
151152
}
152153

153-
if err := bindMountReadonly(containerParamsFile.Name(), nvidiaDriverParamsPath); err != nil {
154+
if err := bindMountReadonly(containerParamsFile.Name(), filepath.Join(containerRoot, nvidiaDriverParamsPath)); err != nil {
154155
return fmt.Errorf("failed to create temporary parms file mount: %w", err)
155156
}
156157

0 commit comments

Comments
 (0)