Page MenuHomeFreeBSD

Export required symbols in nvidia.ko and nvidia-modeset.ko for their consumers
AcceptedPublic

Authored by junchoon_dec.sakura.ne.jp on Nov 29 2025, 4:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 26, 9:46 PM
Unknown Object (File)
Sun, Dec 14, 4:51 PM
Unknown Object (File)
Wed, Dec 10, 2:35 AM
Unknown Object (File)
Tue, Dec 9, 4:33 AM
Unknown Object (File)
Nov 30 2025, 8:41 AM
Unknown Object (File)
Nov 30 2025, 6:11 AM
Unknown Object (File)
Nov 30 2025, 4:44 AM
Subscribers

Details

Reviewers
emaste
kbowling
ashafer
Group Reviewers
x11
Summary

When kernel linker disables local symbol resolution, kernel modules
that require local symbols in other kernel modules, which are not
explicitly exported, stops to be loaded.

This behavior was turned on by default on main branch of src
at commit base 9562994a7aacee2baae6ddee1a7b558b48ae39ef.

Export local symbols in nvidia.ko for nvidia-modeset.ko and
in nvidia-modeset.ko for nvidia-drm.ko.

PR: 291212

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

So why can't the coonsumers of these symbols just depend on the module? Why do we have to export the symbols from these modules to everybody?

If nvidia.ko hesitates to load due to the absense of linux*.ko, maybe src (main branch) would be needed to catch up with commit base e00a781c216cb12603a0a71c9ca293dde3e06250.

For testing on other branches, LINUX option would be needed to be disabled for x11/nvidia-kmod[-devel].
As my main branch (of src) environment is too outdated, I've tested tihs way on stable/15 and confirmed nvidia.ko and nvidia-modeset.ko are loadable.

In D53987#1233511, @imp wrote:

So why can't the coonsumers of these symbols just depend on the module? Why do we have to export the symbols from these modules to everybody?

The dependendies are already defined from before. But EXPORT_SYMS in Makefiles of each modules were missing.
And even without this, modules worked fine until debug.link_elf_obj_leak_locals=1 was the default.

It is better to provide an explicit list of symbols than just EXPORT_SYMS=YESunless we are sure that all symbols should be exported. But, this enough to preserve the status quo at least.

It is better to provide an explicit list of symbols than just EXPORT_SYMS=YESunless we are sure that all symbols should be exported. But, this enough to preserve the status quo at least.

I've tried it first, but it resulted in new symbol to appear, appear, and appear as error and gave up.
graphics/drm-*-kmod (at least graphics/drm-66-kmod) does the same thing, maybe because of
the same struggles.

This revision is now accepted and ready to land.Nov 29 2025, 5:25 PM

I'm ok with for now just enabling all symbol exports to unblock things and then figure out how to clean things up in post.

I'm ok with for now just enabling all symbol exports to unblock things and then figure out how to clean things up in post.

How do you think about the threshold to use EXPORT_SYMS= YES or list per-symbols?
Even tens or hundreds (or even unlimited depending of codes) to be listed?

Yes, I know exposing really local symbols could be security risks. But maybe taking well balances considering maintainability may be wanted, not limiting with nvidia case.