From nobody Fri Nov 05 14:54:17 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6884318338E1 for ; Fri, 5 Nov 2021 14:54:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hm3S92HsGz4YJF for ; Fri, 5 Nov 2021 14:54:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3049719B66 for ; Fri, 5 Nov 2021 14:54:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1A5EsHhS050126 for ; Fri, 5 Nov 2021 14:54:17 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1A5EsHax050125 for bugs@FreeBSD.org; Fri, 5 Nov 2021 14:54:17 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 207898] kernel linker behaves differently on amd64 vs. i386 Date: Fri, 05 Nov 2021 14:54:17 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: emaste@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207898 --- Comment #6 from Ed Maste --- (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.=