-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libnvidia-container: 1.9.0 -> 1.16.2 (#347867)
- Loading branch information
Showing
5 changed files
with
113 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
From 8799541f99785d2bd881561386676fb0985e939e Mon Sep 17 00:00:00 2001 | ||
From: Moritz Sanft <[email protected]> | ||
Date: Thu, 10 Oct 2024 14:32:42 +0200 | ||
Subject: [PATCH] fix library resolving | ||
|
||
Signed-off-by: Moritz Sanft <[email protected]> | ||
--- | ||
src/ldcache.c | 46 +++++++++++++++++----------------------------- | ||
src/ldcache.h | 2 +- | ||
src/nvc_info.c | 10 +++------- | ||
src/nvc_ldcache.c | 2 +- | ||
4 files changed, 22 insertions(+), 38 deletions(-) | ||
|
||
diff --git a/src/ldcache.c b/src/ldcache.c | ||
index 38bab05..e1abc89 100644 | ||
index 38bab055..8cd30a0f 100644 | ||
--- a/src/ldcache.c | ||
+++ b/src/ldcache.c | ||
@@ -108,40 +108,27 @@ ldcache_close(struct ldcache *ctx) | ||
@@ -108,40 +108,28 @@ ldcache_close(struct ldcache *ctx) | ||
|
||
int | ||
ldcache_resolve(struct ldcache *ctx, uint32_t arch, const char *root, const char * const libs[], | ||
- char *paths[], size_t size, ldcache_select_fn select, void *select_ctx) | ||
|
@@ -14,26 +27,17 @@ index 38bab05..e1abc89 100644 | |
- int override; | ||
+ char dir[PATH_MAX]; | ||
+ char lib[PATH_MAX]; | ||
|
||
- h = (struct header_libc6 *)ctx->ptr; | ||
memset(paths, 0, size * sizeof(*paths)); | ||
|
||
- for (uint32_t i = 0; i < h->nlibs; ++i) { | ||
- int32_t flags = h->libs[i].flags; | ||
- char *key = (char *)ctx->ptr + h->libs[i].key; | ||
- char *value = (char *)ctx->ptr + h->libs[i].value; | ||
- | ||
- if (!(flags & LD_ELF) || (flags & LD_ARCH_MASK) != arch) | ||
+ for (size_t j = 0; j < size; ++j) { | ||
+ snprintf(dir, 100, "/run/opengl-driver%s/lib", | ||
+ arch == LD_I386_LIB32 ? "-32" : ""); | ||
+ if (!strncmp(libs[j], "libvdpau_nvidia.so", 100)) | ||
+ strcat(dir, "/vdpau"); | ||
+ snprintf(lib, 100, "%s/%s.%s", dir, libs[j], version); | ||
+ if (path_resolve_full(ctx->err, path, "/", lib) < 0) | ||
+ return (-1); | ||
+ if (!file_exists(ctx->err, path)) | ||
continue; | ||
- continue; | ||
- | ||
- for (size_t j = 0; j < size; ++j) { | ||
- if (!str_has_prefix(key, libs[j])) | ||
|
@@ -52,14 +56,25 @@ index 38bab05..e1abc89 100644 | |
- } | ||
- break; | ||
- } | ||
+ for (size_t j = 0; j < size; ++j) { | ||
+ snprintf(dir, 100, "@driverLink@/lib"); | ||
+ | ||
+ if (!strncmp(libs[j], "libvdpau_nvidia.so", 100)) | ||
+ strcat(dir, "/vdpau"); | ||
+ snprintf(lib, 100, "%s/%s.%s", dir, libs[j], version); | ||
+ if (path_resolve_full(ctx->err, path, "/", lib) < 0) | ||
+ return (-1); | ||
+ if (!file_exists(ctx->err, path)) | ||
+ continue; | ||
+ | ||
+ paths[j] = xstrdup(ctx->err, path); | ||
+ if (paths[j] == NULL) | ||
+ return (-1); | ||
} | ||
return (0); | ||
} | ||
diff --git a/src/ldcache.h b/src/ldcache.h | ||
index 33d78dd..2b087db 100644 | ||
index 33d78dd7..2b087dbc 100644 | ||
--- a/src/ldcache.h | ||
+++ b/src/ldcache.h | ||
@@ -50,6 +50,6 @@ void ldcache_init(struct ldcache *, struct error *, const char *); | ||
|
@@ -68,19 +83,19 @@ index 33d78dd..2b087db 100644 | |
int ldcache_resolve(struct ldcache *, uint32_t, const char *, const char * const [], | ||
- char *[], size_t, ldcache_select_fn, void *); | ||
+ char *[], size_t, const char*); | ||
|
||
#endif /* HEADER_LDCACHE_H */ | ||
diff --git a/src/nvc_info.c b/src/nvc_info.c | ||
index 30e3cfd..6d12a50 100644 | ||
index b7b8adfa..d42f2beb 100644 | ||
--- a/src/nvc_info.c | ||
+++ b/src/nvc_info.c | ||
@@ -167,15 +167,13 @@ find_library_paths(struct error *err, struct nvc_driver_info *info, const char * | ||
@@ -217,15 +217,13 @@ find_library_paths(struct error *err, struct dxcore_context *dxcore, struct nvc_ | ||
if (path_resolve_full(err, path, root, ldcache) < 0) | ||
return (-1); | ||
ldcache_init(&ld, err, path); | ||
- if (ldcache_open(&ld) < 0) | ||
- return (-1); | ||
|
||
info->nlibs = size; | ||
info->libs = array_new(err, size); | ||
if (info->libs == NULL) | ||
|
@@ -89,42 +104,44 @@ index 30e3cfd..6d12a50 100644 | |
- info->libs, info->nlibs, select_libraries_fn, info) < 0) | ||
+ info->libs, info->nlibs, info->nvrm_version) < 0) | ||
goto fail; | ||
|
||
info->nlibs32 = size; | ||
@@ -183,13 +181,11 @@ find_library_paths(struct error *err, struct nvc_driver_info *info, const char * | ||
@@ -233,13 +231,11 @@ find_library_paths(struct error *err, struct dxcore_context *dxcore, struct nvc_ | ||
if (info->libs32 == NULL) | ||
goto fail; | ||
if (ldcache_resolve(&ld, LIB32_ARCH, root, libs, | ||
- info->libs32, info->nlibs32, select_libraries_fn, info) < 0) | ||
+ info->libs32, info->nlibs32, info->nvrm_version) < 0) | ||
goto fail; | ||
rv = 0; | ||
|
||
fail: | ||
- if (ldcache_close(&ld) < 0) | ||
- return (-1); | ||
return (rv); | ||
} | ||
@@ -203,7 +199,7 @@ find_binary_paths(struct error *err, struct nvc_driver_info *info, const char *r | ||
|
||
@@ -253,7 +249,7 @@ find_binary_paths(struct error *err, struct dxcore_context* dxcore, struct nvc_d | ||
char path[PATH_MAX]; | ||
int rv = -1; | ||
|
||
- if ((env = secure_getenv("PATH")) == NULL) { | ||
+ if ((env = "/run/nvidia-docker/bin:/run/nvidia-docker/extras/bin") == NULL) { | ||
error_setx(err, "environment variable PATH not found"); | ||
return (-1); | ||
} | ||
diff --git a/src/nvc_ldcache.c b/src/nvc_ldcache.c | ||
index 6ff380f..cbe6a69 100644 | ||
index db3b2f69..ae5def43 100644 | ||
--- a/src/nvc_ldcache.c | ||
+++ b/src/nvc_ldcache.c | ||
@@ -340,7 +340,7 @@ nvc_ldcache_update(struct nvc_context *ctx, const struct nvc_container *cnt) | ||
@@ -367,7 +367,7 @@ nvc_ldcache_update(struct nvc_context *ctx, const struct nvc_container *cnt) | ||
if (validate_args(ctx, cnt != NULL) < 0) | ||
return (-1); | ||
- argv = (char * []){cnt->cfg.ldconfig, cnt->cfg.libs_dir, cnt->cfg.libs32_dir, NULL}; | ||
|
||
- argv = (char * []){cnt->cfg.ldconfig, "-f", "/etc/ld.so.conf", "-C", "/etc/ld.so.cache", cnt->cfg.libs_dir, cnt->cfg.libs32_dir, NULL}; | ||
+ argv = (char * []){cnt->cfg.ldconfig, "-f", "/tmp/ld.so.conf.nvidia-host", "-C", "/tmp/ld.so.cache.nvidia-host", cnt->cfg.libs_dir, cnt->cfg.libs32_dir, NULL}; | ||
if (*argv[0] == '@') { | ||
/* | ||
* We treat this path specially to be relative to the host filesystem. | ||
-- | ||
2.46.0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters