Package: release.debian.org Severity: normal Tags: bookworm User: [email protected] Usertags: pu
[ Reason ] In prepararion to upgrading nvidia-graphics-drivers(-tesla) to the 535 series (a new LTSB branch announced last week and supported until June 2026, i.e. sufficient for bookworm) I'd like to update nvidia-modprobe to a new upstream release. [ Impact ] The 525 series currently in sid/bookworm is only supported until the end of this year. [ Tests ] n/a [ Risks ] Low. No functional changes. [ Checklist ] [x] *all* changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in (old)stable [x] the issue is verified as fixed in unstable [ Changes ] Except for the version bump there are no code changes. The backported patch is now part of the upstream release. This is a rebuild of the package from sid with no further changes. [ Other info ] nvidia-graphics-drivers has a versioned dependency on nvidia-modprobe (>= $MAJOR_VERSION) to ensure we don't miss (again) the rare cases where nvidia-modprobe actually had code changes. That version works with all driver series, so we can start with uploading nvidia-modprobe even if the driver packages are not yet ready. Andreas
diff --git a/debian/changelog b/debian/changelog index 0ad05af..9ce25ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +nvidia-modprobe (535.54.03-1~deb12u1) bookworm; urgency=medium + + * Rebuild for bookworm. + + -- Andreas Beckmann <[email protected]> Mon, 10 Jul 2023 00:10:07 +0200 + +nvidia-modprobe (535.54.03-1) unstable; urgency=medium + + * New upstream release. + + -- Andreas Beckmann <[email protected]> Sun, 02 Jul 2023 20:36:35 +0200 + nvidia-modprobe (530.30.02-2) unstable; urgency=medium * Updated nvidia-modprobe to create symbolic links in /dev/char when @@ -73,6 +85,18 @@ nvidia-modprobe (495.44-1) experimental; urgency=medium -- Andreas Beckmann <[email protected]> Sun, 07 Nov 2021 09:19:56 +0100 +nvidia-modprobe (470.182.03-1) bullseye; urgency=medium + + * New upstream release. + - Updated nvidia-modprobe to create symbolic links in /dev/char when + creating the /dev/nvidia* device nodes. This resolves an issue that + prevented the device nodes from working with newer versions of runc: + https://github.com/opencontainers/runc/issues/3708 + * Update Lintian overrides. + * Upload to bullseye. + + -- Andreas Beckmann <[email protected]> Sun, 16 Apr 2023 21:40:37 +0200 + nvidia-modprobe (470.103.01-1~deb11u1) bullseye; urgency=medium * Rebuild for bullseye. diff --git a/debian/copyright b/debian/copyright index 415c397..26ebb3f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -9,7 +9,8 @@ Disclaimer: NVIDIA drivers in non-free. Files: * -Copyright: Copyright (C) 2004-2021 NVIDIA Corporation +Copyright: + Copyright (C) 2004-2023 NVIDIA Corporation License: Expat Files: modprobe-utils/pci-enum.h diff --git a/debian/patches/dev-char-symlink.patch b/debian/patches/dev-char-symlink.patch deleted file mode 100644 index b7e7994..0000000 --- a/debian/patches/dev-char-symlink.patch +++ /dev/null @@ -1,151 +0,0 @@ -commit ec487af278c3603f785e6829023dc1675c66a236 -Author: Aaron Plattner <[email protected]> -Date: Thu Mar 30 11:10:10 2023 -0700 - - 525.105.17 - -diff --git a/modprobe-utils/nvidia-modprobe-utils.c b/modprobe-utils/nvidia-modprobe-utils.c -index 7437751..1a2144f 100644 ---- a/modprobe-utils/nvidia-modprobe-utils.c -+++ b/modprobe-utils/nvidia-modprobe-utils.c -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2013, NVIDIA CORPORATION. -+ * Copyright (c) 2013-2023, NVIDIA CORPORATION. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation -@@ -42,6 +42,7 @@ - #include "nvidia-modprobe-utils.h" - #include "pci-enum.h" - -+#define NV_DEV_PATH "/dev/" - #define NV_PROC_MODPROBE_PATH "/proc/sys/kernel/modprobe" - #define NV_PROC_MODULES_PATH "/proc/modules" - #define NV_PROC_DEVICES_PATH "/proc/devices" -@@ -502,6 +503,75 @@ int nvidia_get_file_state(int minor) - return state; - } - -+/* -+ * Symbolically link the /dev/char/<major:minor> file to the given -+ * device node. -+ */ -+static int symlink_char_dev(int major, int minor, const char *dev_path) -+{ -+ char symlink_path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; -+ char dev_rel_path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; -+ struct stat link_status; -+ struct stat dev_status; -+ int ret; -+ -+ ret = snprintf(symlink_path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, -+ NV_CHAR_DEVICE_NAME, major, minor); -+ -+ if (ret < 0 || ret >= NV_MAX_CHARACTER_DEVICE_FILE_STRLEN) -+ { -+ return 0; -+ } -+ -+ /* Verify that the target device node exists and is a character device. */ -+ if (stat(dev_path, &dev_status) != 0 || !S_ISCHR(dev_status.st_mode)) -+ { -+ return 0; -+ } -+ -+ /* Verify the device path prefix is as expected. */ -+ if (strncmp(dev_path, NV_DEV_PATH, strlen(NV_DEV_PATH)) != 0) -+ { -+ return 0; -+ } -+ -+ /* -+ * Create the relative path for the symlink by replacing "/dev/" prefix in -+ * the path with "../", to match existing links in the /dev/char directory. -+ */ -+ ret = snprintf(dev_rel_path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, -+ "../%s", dev_path + strlen(NV_DEV_PATH)); -+ -+ if (ret < 0 || ret >= NV_MAX_CHARACTER_DEVICE_FILE_STRLEN) -+ { -+ return 0; -+ } -+ -+ /* -+ * An existing link may not point at the target device, so remove it. -+ * Any error is discarded since the failure checks below will handle -+ * the problematic cases. -+ */ -+ (void)remove(symlink_path); -+ -+ ret = symlink(dev_rel_path, symlink_path); -+ -+ /* -+ * If the symlink(3) failed, we either don't have permission to create it, -+ * or the file already exists -- our remove(3) call above failed. In this -+ * case, we return success only if the link exists and matches the target -+ * device (stat(2) will follow the link). -+ */ -+ if (ret < 0 && -+ (stat(symlink_path, &link_status) != 0 || -+ link_status.st_ino != dev_status.st_ino)) -+ { -+ return 0; -+ } -+ -+ return 1; -+} -+ - /* - * Attempt to create the specified device file with the specified major - * and minor number. If proc_path is specified, scan it for custom file -@@ -532,7 +602,7 @@ static int mknod_helper(int major, int minor, const char *path, - - if (modification_allowed != 1) - { -- return 1; -+ return symlink_char_dev(major, minor, path); - } - - state = get_file_state_helper(path, major, minor, -@@ -542,7 +612,7 @@ static int mknod_helper(int major, int minor, const char *path, - nvidia_test_file_state(state, NvDeviceFileStateChrDevOk) && - nvidia_test_file_state(state, NvDeviceFileStatePermissionsOk)) - { -- return 1; -+ return symlink_char_dev(major, minor, path); - } - - /* If the stat(2) above failed, we need to create the device file. */ -@@ -594,10 +664,9 @@ static int mknod_helper(int major, int minor, const char *path, - return 0; - } - -- return 1; -+ return symlink_char_dev(major, minor, path); - } - -- - /* - * Attempt to create a device file with the specified minor number for - * the specified NVIDIA module instance. -diff --git a/modprobe-utils/nvidia-modprobe-utils.h b/modprobe-utils/nvidia-modprobe-utils.h -index 924f7c3..ebc01e1 100644 ---- a/modprobe-utils/nvidia-modprobe-utils.h -+++ b/modprobe-utils/nvidia-modprobe-utils.h -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2013, NVIDIA CORPORATION. -+ * Copyright (c) 2013-2023, NVIDIA CORPORATION. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation -@@ -46,6 +46,8 @@ - #define NV_CAPS_MODULE_NAME "nvidia-caps" - #define NV_CAP_DEVICE_NAME "/dev/" NV_CAPS_MODULE_NAME "/nvidia-cap%d" - -+#define NV_CHAR_DEVICE_NAME "/dev/char/%d:%d" -+ - #if defined(NV_LINUX) - - typedef enum diff --git a/debian/patches/series b/debian/patches/series index 64a3dbb..7cad60d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,2 @@ setuid.patch repro.patch -dev-char-symlink.patch diff --git a/modprobe-utils/nvidia-modprobe-utils.c b/modprobe-utils/nvidia-modprobe-utils.c index 7437751..1a2144f 100644 --- a/modprobe-utils/nvidia-modprobe-utils.c +++ b/modprobe-utils/nvidia-modprobe-utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, NVIDIA CORPORATION. + * Copyright (c) 2013-2023, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -42,6 +42,7 @@ #include "nvidia-modprobe-utils.h" #include "pci-enum.h" +#define NV_DEV_PATH "/dev/" #define NV_PROC_MODPROBE_PATH "/proc/sys/kernel/modprobe" #define NV_PROC_MODULES_PATH "/proc/modules" #define NV_PROC_DEVICES_PATH "/proc/devices" @@ -502,6 +503,75 @@ int nvidia_get_file_state(int minor) return state; } +/* + * Symbolically link the /dev/char/<major:minor> file to the given + * device node. + */ +static int symlink_char_dev(int major, int minor, const char *dev_path) +{ + char symlink_path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; + char dev_rel_path[NV_MAX_CHARACTER_DEVICE_FILE_STRLEN]; + struct stat link_status; + struct stat dev_status; + int ret; + + ret = snprintf(symlink_path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, + NV_CHAR_DEVICE_NAME, major, minor); + + if (ret < 0 || ret >= NV_MAX_CHARACTER_DEVICE_FILE_STRLEN) + { + return 0; + } + + /* Verify that the target device node exists and is a character device. */ + if (stat(dev_path, &dev_status) != 0 || !S_ISCHR(dev_status.st_mode)) + { + return 0; + } + + /* Verify the device path prefix is as expected. */ + if (strncmp(dev_path, NV_DEV_PATH, strlen(NV_DEV_PATH)) != 0) + { + return 0; + } + + /* + * Create the relative path for the symlink by replacing "/dev/" prefix in + * the path with "../", to match existing links in the /dev/char directory. + */ + ret = snprintf(dev_rel_path, NV_MAX_CHARACTER_DEVICE_FILE_STRLEN, + "../%s", dev_path + strlen(NV_DEV_PATH)); + + if (ret < 0 || ret >= NV_MAX_CHARACTER_DEVICE_FILE_STRLEN) + { + return 0; + } + + /* + * An existing link may not point at the target device, so remove it. + * Any error is discarded since the failure checks below will handle + * the problematic cases. + */ + (void)remove(symlink_path); + + ret = symlink(dev_rel_path, symlink_path); + + /* + * If the symlink(3) failed, we either don't have permission to create it, + * or the file already exists -- our remove(3) call above failed. In this + * case, we return success only if the link exists and matches the target + * device (stat(2) will follow the link). + */ + if (ret < 0 && + (stat(symlink_path, &link_status) != 0 || + link_status.st_ino != dev_status.st_ino)) + { + return 0; + } + + return 1; +} + /* * Attempt to create the specified device file with the specified major * and minor number. If proc_path is specified, scan it for custom file @@ -532,7 +602,7 @@ static int mknod_helper(int major, int minor, const char *path, if (modification_allowed != 1) { - return 1; + return symlink_char_dev(major, minor, path); } state = get_file_state_helper(path, major, minor, @@ -542,7 +612,7 @@ static int mknod_helper(int major, int minor, const char *path, nvidia_test_file_state(state, NvDeviceFileStateChrDevOk) && nvidia_test_file_state(state, NvDeviceFileStatePermissionsOk)) { - return 1; + return symlink_char_dev(major, minor, path); } /* If the stat(2) above failed, we need to create the device file. */ @@ -594,10 +664,9 @@ static int mknod_helper(int major, int minor, const char *path, return 0; } - return 1; + return symlink_char_dev(major, minor, path); } - /* * Attempt to create a device file with the specified minor number for * the specified NVIDIA module instance. diff --git a/modprobe-utils/nvidia-modprobe-utils.h b/modprobe-utils/nvidia-modprobe-utils.h index 924f7c3..ebc01e1 100644 --- a/modprobe-utils/nvidia-modprobe-utils.h +++ b/modprobe-utils/nvidia-modprobe-utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, NVIDIA CORPORATION. + * Copyright (c) 2013-2023, NVIDIA CORPORATION. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -46,6 +46,8 @@ #define NV_CAPS_MODULE_NAME "nvidia-caps" #define NV_CAP_DEVICE_NAME "/dev/" NV_CAPS_MODULE_NAME "/nvidia-cap%d" +#define NV_CHAR_DEVICE_NAME "/dev/char/%d:%d" + #if defined(NV_LINUX) typedef enum diff --git a/version.mk b/version.mk index f317cd6..bc5d21a 100644 --- a/version.mk +++ b/version.mk @@ -1,4 +1,4 @@ -NVIDIA_VERSION = 530.30.02 +NVIDIA_VERSION = 535.54.03 # This file. VERSION_MK_FILE := $(lastword $(MAKEFILE_LIST))

