Date: Fri, 05 Nov 2021 14:54:17 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 207898] kernel linker behaves differently on amd64 vs. i386 Message-ID: <bug-207898-227-Qa45IBzQRl@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-207898-227@https.bugs.freebsd.org/bugzilla/> References: <bug-207898-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207898 --- Comment #6 from Ed Maste <emaste@freebsd.org> --- (In reply to Don Lewis from comment #3) > Why would the linker ignore the flag for local symbols? I suspect there is no satisfying reason. It was probably just never implemented, and had no (or very limited) effect on the set of (relatively simple) in-tree kernel modules. (In reply to Justin Cady from comment #4) > 1. Am I correct that because of this bug, symbol names on amd64 are effec= tively > required to be unique across all kernel module dependencies? Yes, it appears that is the case. > 2. Is there any risk to actually fixing this? I tried to understand all o= f the > potential callers of link_elf_lookup_symbol(), but doing so is not > straightforward through all the indirect calls (function pointers, macros= ). > Stated differently: is there any expectation that link_elf_lookup_symbol() > should return a local symbol? There are two separate risks: 1) changing link_elf_lookup_symbol's beavhiour, if there are callers other = than via module loading that depend on the current behaviour Notice that this is already covered in Kostik's patch (in the thread you referenced). It adds link_elf_lookup_debug_symbol which continues searching local symbols. 2) breaking in-tree or out-of-tree kernel modules that depend on this Also in Kostik's patch there were changes to sys/modules/mii and sys/modules/pseudofs, because they were missing entries in EXPORT_SYMS. (I = did not look to see if they have been fixed since, or whether there are other newly-introduced cases.) In-tree modules would have to be fixed if/when this patch goes in, but there may well be third party modules that need similar changes. All of that said, this is definitely a bug that should be fixed. I propose: 1) augment Kostik's patch to add a sysctl controlling whether kernel module symbol resolution uses local symbols or not 2) initially set it to maintain the current behaviour (use local symbols) 3) commit to main, send a call for testing 4) MFC to stable/13 (as well as stable/12 if the merge is straightforward) maintaining current behaviour 5) fix any in-tree modules 6) toggle the the sysctl in main (i.e., no longer search local symbols in kernel module lookup) 7) consider emitting a warning if the sysctl is changed by the user 8) wait for FreeBSD 14.0's release 9) remove the sysctl, leaving only no-local-lookup for kernel modules --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-207898-227-Qa45IBzQRl>