From 4f0de9f1ef07abd6c1b3dd54995b275fb74d14dc Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 4 Jun 2024 12:57:58 +0200 Subject: [PATCH] Increase priority of ld.so.conf.d config file This change ensures that the created /etc/ld.so.conf.d file has a higher priority to ensure that the injected libraries take precendence over non-compat libraries. Signed-off-by: Evan Lezar --- cmd/nvidia-cdi-hook/update-ldcache/update-ldcache.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/nvidia-cdi-hook/update-ldcache/update-ldcache.go b/cmd/nvidia-cdi-hook/update-ldcache/update-ldcache.go index 5a94a834..7128aa6b 100644 --- a/cmd/nvidia-cdi-hook/update-ldcache/update-ldcache.go +++ b/cmd/nvidia-cdi-hook/update-ldcache/update-ldcache.go @@ -153,8 +153,11 @@ func (m command) resolveLDConfigPath(path string) string { return strings.TrimPrefix(config.NormalizeLDConfigPath("@"+path), "@") } -// createConfig creates (or updates) /etc/ld.so.conf.d/nvcr-.conf in the container +// createConfig creates (or updates) /etc/ld.so.conf.d/00-nvcr-.conf in the container // to include the required paths. +// Note that the 00-nvcr prefix is chosen to ensure that these libraries have +// a higher precedence than other libraries on the system but are applied AFTER +// 00-cuda-compat.conf. func (m command) createConfig(root string, folders []string) error { if len(folders) == 0 { m.logger.Debugf("No folders to add to /etc/ld.so.conf") @@ -165,7 +168,7 @@ func (m command) createConfig(root string, folders []string) error { return fmt.Errorf("failed to create ld.so.conf.d: %v", err) } - configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "nvcr-*.conf") + configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "00-nvcr-*.conf") if err != nil { return fmt.Errorf("failed to create config file: %v", err) }