The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9562994a7aacee2baae6ddee1a7b558b48ae39ef

commit 9562994a7aacee2baae6ddee1a7b558b48ae39ef
Author:     Ed Maste <[email protected]>
AuthorDate: 2024-11-25 19:05:54 +0000
Commit:     Ed Maste <[email protected]>
CommitDate: 2025-11-25 13:49:20 +0000

    kernel linker: Disable local sym resolution by default
    
    In 95c20faf11a1 and ecd8245e0d77 kib introduced support to have the
    kernel linker stop resolving local symbols from other files, but did
    not enable it by default to avoid surprises.  Flip the default now,
    before FreeBSD 16.0.
    
    The debug.link_elf_leak_locals and debug.link_elf_obj_leak_locals
    sysctls are available to revert to the previous behaviour if necessary.
    
    PR:             207898
    Reviewed by:    bz
    Relnotes:       Yes
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D47742
---
 UPDATING                | 9 +++++++++
 sys/kern/link_elf.c     | 2 +-
 sys/kern/link_elf_obj.c | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/UPDATING b/UPDATING
index aaef0e5b4cd3..7f0cb44181d3 100644
--- a/UPDATING
+++ b/UPDATING
@@ -27,6 +27,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 16.x IS SLOW:
        world, or to merely disable the most expensive debugging functionality
        at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20251125:
+       The `debug.link_elf_leak_locals` and `debug.link_elf_obj_leak_locals`
+       sysctls now default to 0, so the kernel module linker no longer
+       performs symbol resolution against local symbols from other modules.
+
+       If a kernel module now fails to load because of an unresolved symbol,
+       set these sysctls to 1 and file a bug report including details about
+       the affected module.
+
 20251115:
        The FreeBSD-base repository is now defined in /etc/pkg/FreeBSD.conf,
        disabled by default.  In -CURRENT and -STABLE this points at nightly
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index ebd203858b66..f910fc3d5df5 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -203,7 +203,7 @@ static struct linker_class link_elf_class = {
        link_elf_methods, sizeof(struct elf_file)
 };
 
-static bool link_elf_leak_locals = true;
+static bool link_elf_leak_locals = false;
 SYSCTL_BOOL(_debug, OID_AUTO, link_elf_leak_locals,
     CTLFLAG_RWTUN, &link_elf_leak_locals, 0,
     "Allow local symbols to participate in global module symbol resolution");
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index a3a53a39bfd6..759cd75cba31 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -192,7 +192,7 @@ static struct linker_class link_elf_class = {
        link_elf_methods, sizeof(struct elf_file)
 };
 
-static bool link_elf_obj_leak_locals = true;
+static bool link_elf_obj_leak_locals = false;
 SYSCTL_BOOL(_debug, OID_AUTO, link_elf_obj_leak_locals,
     CTLFLAG_RWTUN, &link_elf_obj_leak_locals, 0,
     "Allow local symbols to participate in global module symbol resolution");

Reply via email to