Skip to content

Commit

Permalink
kern linker: Do not retry loading modules on EEXIST
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
gmshake authored and laffer1 committed Jan 29, 2024
1 parent e76178b commit a841502
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sys/kern/kern_linker.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,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) {
Expand Down

0 comments on commit a841502

Please sign in to comment.