|
| 1 | +From be4ba83b821eea9050eefdb7e67df2d757c3795a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Jingwei Wang < [email protected]> |
| 3 | +Date: Wed, 23 Apr 2025 17:17:35 +0000 |
| 4 | +Subject: [PATCH] fix ldcache parsing for aarch64 |
| 5 | + |
| 6 | +k8s-device-plugin carries its own nvidia-container-toolkit and uses |
| 7 | +nvidia-ctk to generate the CDI specifications. |
| 8 | + |
| 9 | +The architecture flag for aarch64 is currently missing from the |
| 10 | +supported architecture flags list. This omission causes the getEntries |
| 11 | +function to exclude all libraries found on aarch64 hosts. As a result |
| 12 | +helper programs like nvidia-ctk are unable to generate CDI |
| 13 | +specifications for the aarch64 architecture. |
| 14 | + |
| 15 | +This fix adds the missing aarch64 architecture flag, using the same |
| 16 | +value as defined in libnvidia-container[1], which maintains a more |
| 17 | +comprehensive list of supported architectures. |
| 18 | + |
| 19 | +[1]: https://github.com/NVIDIA/libnvidia-container/blob/a198166e1c1166f4847598438115ea97dacc7a92/src/ldcache.h#L21 |
| 20 | + |
| 21 | +Signed-off-by: Jingwei Wang < [email protected]> |
| 22 | +--- |
| 23 | + .../nvidia-container-toolkit/internal/ldcache/ldcache.go | 3 +++ |
| 24 | + 1 file changed, 3 insertions(+) |
| 25 | + |
| 26 | +diff --git a/vendor/github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache/ldcache.go b/vendor/github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache/ldcache.go |
| 27 | +index 4daf95b..455048c 100644 |
| 28 | +--- a/vendor/github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache/ldcache.go |
| 29 | ++++ b/vendor/github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache/ldcache.go |
| 30 | +@@ -47,6 +47,7 @@ const ( |
| 31 | + flagArchX8664 = 0x0300 |
| 32 | + flagArchX32 = 0x0800 |
| 33 | + flagArchPpc64le = 0x0500 |
| 34 | ++ flagArchAarch64 = 0x0a00 |
| 35 | + ) |
| 36 | + |
| 37 | + var errInvalidCache = errors.New("invalid ld.so.cache file") |
| 38 | +@@ -195,6 +196,8 @@ func (c *ldcache) getEntries() []entry { |
| 39 | + switch e.Flags & flagArchMask { |
| 40 | + case flagArchX8664: |
| 41 | + fallthrough |
| 42 | ++ case flagArchAarch64: |
| 43 | ++ fallthrough |
| 44 | + case flagArchPpc64le: |
| 45 | + bits = 64 |
| 46 | + case flagArchX32: |
| 47 | +-- |
| 48 | +2.47.0 |
| 49 | + |
0 commit comments