Skip to content

UBSAN_SANITIZE needed? apt takes 60+ minutes for dkms building #1256

Description

@poldap

NVIDIA Open GPU Kernel Modules Version

580.173.02, i.e. 580.173.02-1pop1~1783343684~22.04~397d671

Operating System and Version

Pop!_OS 22.04 LTS

Kernel Release

Linux pop-os 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux

Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.

  • I am running on a stable kernel release.

Build Command

sudo apt upgrade

Terminal output/Build Log

Setting up nvidia-dkms-580 (580.173.02-1pop1~1783343684~22.04~397d671) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
Loading new nvidia-580.173.02 DKMS files...
Building for 7.0.11-76070011-generic
Building for architecture x86_64
Building initial module for 7.0.11-76070011-generic

.... very very long wait ....

More Info

I am out of my depth, but AI-servant prepared a summary with more info. Hope it helps and it does not waste any time.

The hang occurs during the DKMS build of nvidia-uvm/uvm_lock.c. Investigation shows the root cause is UBSAN_SANITIZE := y set in NVIDIA's own Kbuild file, which causes the kernel build system to apply -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum to all module files. On this kernel (which has CONFIG_UBSAN_BOUNDS_STRICT=y, CONFIG_UBSAN_SHIFT=y, CONFIG_UBSAN_BOOL=y, CONFIG_UBSAN_ENUM=y), GCC's cc1 takes 70+ minutes of CPU time at 100% to compile uvm_lock.c — a 15KB source file.

The fix would be to add either:
UBSAN_SANITIZE_uvm_lock.o := n
or disable it for the entire nvidia-uvm submodule:
UBSAN_SANITIZE := n
in the nvidia-uvm Kbuild/Makefile.

Expected behavior: DKMS build completes in under 5 minutes as it did before UBSAN was enabled in the Kbuild.

Hardware: NVIDIA GeForce RTX 4070, driver 580.173.02, GCC 11.4.0, kernel 7.0.11-76070011-generic (Pop!_OS).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions