Skip to content

Linux Kernel 6.19.8 - Build Failure: objtool flags 'naked' returns in MITIGATION_RETHUNK build #1077

Open

Description

@ullahsamee

NVIDIA Open GPU Kernel Modules Version

595.58.03

Operating System and Version

Ubuntu 25.04

Kernel Release

Linux 6.19.8-061908-generic #202603131837 SMP PREEMPT_DYNAMIC Fri Mar 13 23:26:49 UTC 2026 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

make modules -j$(nproc)

Terminal output/Build Log

build.log

More Info

No response

Activity

  1. ullahsamee commented on Mar 25, 2026

    @ullahsamee
    Author

    The # Fix for Kernel 6.19 RETHUNK build errors is in the Kbuild file, add
    OBJECT_FILES_NON_STANDARD := y

    After NV_BUILD_TYPE ?= release

  2. aritger commented on Mar 30, 2026

    @aritger
    Collaborator

    Thank you for the report. Yes, we are aware of the problem, and hope in the future to build the "OS-agnostic" portion of the kernel modules with -mfunction-return=thunk-extern. In the meantime, if you disable CONFIG_OBJTOOL_WERROR, then this will "only" be a warning rather than a build error.

  3. Fjodor42 commented on Mar 30, 2026

    @Fjodor42

    Or, alternatively, to actually get properly and safely compiled versions of the binary files that produce the errors, due to not, at present, being shipped in such a state: #1015 (comment)

  4. tofurky commented on Oct 10, 2026

    @tofurky

    61dcc93 (615.71.09) added the suggested -mfunction-return=thunk-extern to nvidia-modeset's Makefile:

    CONDITIONAL_CFLAGS += $(call TEST_CC_ARG, -mfunction-return=thunk-extern)
    

    However, there seems to be a missing step somewhere that has started to cause new kernel splats like this after updating from 610.57.04 to 615.71.09 with Ubuntu 26.04's new nvidia-driver-615-open package:

    Unpatched return thunk in use. This should not happen!
    WARNING: CPU: 3 PID: 248 at arch/x86/kernel/cpu/bugs.c:3830 __warn_thunk+0x25/0x30
    ...
    CPU: 3 UID: 0 PID: 248 Comm: (udev-worker) Tainted: G           O    T   6.18.55aquos+ #73 VOLUNTARY 
    ...
    Call Trace:
     <TASK>
     warn_thunk_thunk+0x16/0x30
     nv_vasprintf+0x2b/0xd0 [nvidia_modeset]
     ? __kmalloc_noprof+0x2f6/0x570
     ? __kmalloc_cache_noprof+0x10a/0x4b0
     ? nvkms_exit+0x900/0x900 [nvidia_modeset]
     ? nvVEvoLog+0x33/0xa0 [nvidia_modeset]
     ? nvEvoLog+0x4a/0x60 [nvidia_modeset]
     ? __register_chrdev+0xe0/0xe0
     ? nvKmsModuleLoad+0x24/0x200 [nvidia_modeset]
     ? down+0x19/0x60
     ? nvkms_init+0x1a7/0x1000 [nvidia_modeset]
     ? do_one_initcall+0x5b/0x2a0
     ? do_init_module+0x7f/0x270
     ? init_module_from_file+0x86/0xc0
     ? idempotent_init_module+0x18c/0x280
     ? __x64_sys_finit_module+0x5a/0xa0
     ? do_syscall_64+0x73/0x280
     ? entry_SYSCALL_64_after_hwframe+0x55/0x5d
     </TASK>
    ---[ end trace 0000000000000000 ]---
    nvidia-modeset: Loading NVIDIA UNIX Open Kernel Mode Setting Driver for x86_64  615.71.09  Release Build  (dvs-builder@U22-I3-F05-2-4)  Fri Sep  4 22:15:27 UTC 2026
    

    I have worked around it by running this to add missing return_sites metadata to nv-modeset-kernel.o_binary and rebuilt, which prevents the warning:

    sudo <path to my kernel build dir>/tools/objtool/objtool --rethunk --module --link /usr/src/nvidia-615.71.09/nvidia-modeset/nv-modeset-kernel.o_binary
    

    Apparently, this is more than just noise and causes some inefficient code paths (jumping thru warn_thunk_thunk each time, though its only logged once):

    void __warn_thunk(void)
    {
            WARN_ONCE(1, "Unpatched return thunk in use. This should not happen!\n");
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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