Package: release.debian.org Severity: normal Tags: bullseye User: release.debian....@packages.debian.org Usertags: pu
Hi, along with the nvidia-graphics-drivers* packages, I'd like to upgrade nvidia-modprobe to a new upstream release this time, too. It's unusual that nvidia-modprobe sees any updates (besides the version bump) in the older release branches when the corresponding driver package gets updated, so in order not to have an nvidia-modprobe that unneccessarily deviates from upstream behavior, lets update that, too. The corresponding change has been cherry-picked into sid (there is no 530 release yet that includes it, since the last 530 release is a week older than the 525/470/450 releases that included this change). It is not yet in bookworm. +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 <a...@debian.org> Tue, 11 Apr 2023 22:21:56 +0200 Andreas
diff --git a/debian/changelog b/debian/changelog index 5eca61c..b3176cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +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 <a...@debian.org> Tue, 11 Apr 2023 22:21:56 +0200 + nvidia-modprobe (470.103.01-1~deb11u1) bullseye; urgency=medium * Rebuild for bullseye. diff --git a/debian/copyright b/debian/copyright index ff0d5ff..26ebb3f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -9,7 +9,8 @@ Disclaimer: NVIDIA drivers in non-free. Files: * -Copyright: Copyright (C) 2004-2017 NVIDIA Corporation +Copyright: + Copyright (C) 2004-2023 NVIDIA Corporation License: Expat Files: modprobe-utils/pci-enum.h @@ -25,7 +26,8 @@ Copyright: (C) Copyright IBM Corporation 2006 License: Expat Files: debian/* -Copyright: © 2014-2022 Andreas Beckmann <a...@debian.org> +Copyright: + © 2014-2023 Andreas Beckmann <a...@debian.org> License: Expat License: Expat diff --git a/debian/gbp.conf b/debian/gbp.conf index f5b3a2c..47d7377 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -1,2 +1,5 @@ +[DEFAULT] +debian-branch = bullseye + [import-orig] upstream-vcs-tag = %(version)s diff --git a/debian/nvidia-modprobe.lintian-overrides b/debian/nvidia-modprobe.lintian-overrides index ecc59fc..d19f35e 100644 --- a/debian/nvidia-modprobe.lintian-overrides +++ b/debian/nvidia-modprobe.lintian-overrides @@ -1 +1 @@ -elevated-privileges usr/bin/nvidia-modprobe 4755 root/root +elevated-privileges 4755 root/root [usr/bin/nvidia-modprobe] diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index 8ebed74..f462e54 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -1,2 +1,2 @@ # upstream provides no signatures -debian-watch-does-not-check-gpg-signature +debian-watch-does-not-check-openpgp-signature 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 061d452..2953b73 100644 --- a/version.mk +++ b/version.mk @@ -1,4 +1,4 @@ -NVIDIA_VERSION = 470.103.01 +NVIDIA_VERSION = 470.182.03 # This file. VERSION_MK_FILE := $(lastword $(MAKEFILE_LIST))