Bug#1148283: [PATCH] nvidia-kernel-dkms: fix build with Linux 7.2 (strncpy removal, drm_atomic_commit rename)
Kevin Cuevas
nivekcuevas936 at gmail.com
Sat Sep 26 04:08:07 BST 2026
Control: tags -1 + patch
Hi,
Attached is a patch against nvidia-graphics-drivers 550.163.01-5.1 that
makes
nvidia-kernel-dkms build and work on Linux 7.2.6+deb14-amd64. It addresses
the
two issues Jonas described in his follow-up to this bug.
1. strncpy() removed in Linux 7.2
- nvidia/os-interface.c and nvidia-uvm/uvm_pmm_gpu.c: switched to
strscpy(),
same as NVIDIA's upstream fix (open-gpu-kernel-modules PR #1227,
shipped
in 610.57.04).
- nvidia/linux_nvswitch.c (registry key parsing): switched to memcpy(),
also
as upstream does. The following line already NUL-terminates.
- nvkms_strncpy() and nvswitch_os_strncpy(): these are called from the
closed-source binary objects, so, following the concern raised in this
bug, I kept their names and exact strncpy() semantics (copy, then
zero-pad the rest of the buffer), implemented locally instead of
changing
them to strscpy().
2. struct drm_atomic_state renamed to struct drm_atomic_commit
(commit 5164f7e7ff8e)
- New conftest drm_atomic_commit_present (types), registered in
nvidia-drm-sources.mk. It uses sizeof(struct drm_atomic_commit), so it
cannot give a false positive on older kernels.
- When it is defined, nvidia-drm-conftest.h maps the old names to the new
API (drm_atomic_state_alloc/clear/get/put/init/default_clear/
default_release -> drm_atomic_commit_*). I checked these names against
the 7.2.6 headers.
- Several existing conftests probe using the old struct name and silently
report false negatives on 7.2. That made the driver pick the pre-4.10
code paths (drm_atomic_state_free, and the old signatures of the crtc
and
plane atomic_check callbacks). When NV_DRM_ATOMIC_COMMIT_PRESENT is
set,
the patch forces ATOMIC_STATE_REF_COUNTING_PRESENT,
CRTC/PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG and the two
ATOMIC_HELPER_SWAP_STATE conftests.
Everything new is guarded by NV_DRM_ATOMIC_COMMIT_PRESENT, so builds on
older kernels are unchanged.
Testing:
- Built with DKMS against 7.2.6+deb14-amd64 and 7.1.13+deb14-amd64. Both
succeed with no errors and no implicit-declaration or modpost warnings.
On 7.1.13 the new conftest correctly reports #undef.
- Hardware: HP laptop with GeForce RTX 2050 (GA107, 10de:25ad) plus Radeon
680M, KDE Plasma on Wayland, forky.
- Booted 7.2.6: nvidia, nvidia_modeset, nvidia_drm and nvidia_uvm load,
nvidia-smi reports the GPU with driver 550.163.01, and the desktop works.
This is a local fix and I have only tested it on one machine, so please
review
it before using it. I hope it helps get a 7.2-compatible upload out.
Thanks,
Kevin Cuevas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nvidia-devel/attachments/20260925/e3029add/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nvidia-550-linux-7.2.patch
Type: text/x-patch
Size: 6939 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-nvidia-devel/attachments/20260925/e3029add/attachment.bin>
More information about the pkg-nvidia-devel
mailing list