Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2024 10:31:43 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 445eb90240ec - stable/12 - kern linker: Do not retry loading modules on EEXIST
Message-ID:  <202401151031.40FAVhmv018096@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=445eb90240ecbd095d8cf865af6773022e8dd750

commit 445eb90240ecbd095d8cf865af6773022e8dd750
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-11-07 04:45:25 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-01-15 10:31:01 +0000

    kern linker: Do not retry loading modules on EEXIST
    
    LINKER_LOAD_FILE() calls linker_load_dependencies() which will return
    EEXIST in case the module to be loaded has already been compiled into
    the kernel. Since the format of the module is now recognized then there
    is no need to retry loading with a different linker, otherwise the
    userland will get misleading error number ENOEXEC.
    
    PR:             274936
    Reviewed by:    dfr
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D42474
    
    (cherry picked from commit ecf710f0e04e3314a492747124166ccb7cf4019e)
    (cherry picked from commit e7fd435d3d4e888d9894d8c212c29ae6e2768f74)
    (cherry picked from commit d18326a7cf14804086550c7463be9721e8d28b64)
---
 sys/kern/kern_linker.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index f0732e7012ae..c199d4eb0f31 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -448,8 +448,11 @@ linker_load_file(const char *filename, linker_file_t *result)
 		 * If we got something other than ENOENT, then it exists but
 		 * we cannot load it for some other reason.
 		 */
-		if (error != ENOENT)
+		if (error != ENOENT) {
 			foundfile = 1;
+			if (error == EEXIST)
+				break;
+		}
 		if (lf) {
 			error = linker_file_register_modules(lf);
 			if (error == EEXIST) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401151031.40FAVhmv018096>