modules: Only return -EEXIST for modules that have finished loading
PATCH 1/1 modules: Only return -EEXIST for modules that have finished loading
Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
The warnings occur because the module code erroneously returns -EEXIST for modules that have failed to load and are in the process of being removed from the module list.
module amd64_edac_mod has a dependency on module edac_mce_amd. Using modules.dep, systemd will load edac_mce_amd for every request of amd64_edac_mod. When the edac_mce_amd module loads, the module has state MODULE_STATE_UNFORMED and once the module load fails and the state becomes MODULE_STATE_GOING. Another request for edac_mce_amd module executes and add_unformed_module() will erroneously return -EEXIST even though the previous instance of edac_mce_amd has MODULE_STATE_GOING. Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which fails because of unknown symbols from edac_mce_amd.
add_unformed_module() must wait to return for any case other than MODULE_STATE_LIVE to prevent a race between multiple loads of dependent modules.
--- kernel/module.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/module.c +1 -2
@@ -3566,8 +3566,7 @@ static int add_unformed_module(struct module *mod)mutex_lock (&module_mutex); old =find_module_all (mod->name,strlen (mod->name), true);if (old !=NULL ) { -if (old->state ==MODULE_STATE_COMING - || old->state ==MODULE_STATE_UNFORMED ) { +if (old->state !=MODULE_STATE_LIVE ) {/* Wait in case it fails to load. */ mutex_unlock (&module_mutex); err = wait_event_interruptible(module_wq,
Signature · 1 line
2.17.2
Jessica? ping?
P.
Quoted 50 lines · Prarit Bhargava
Microsoft HyperV disables the
X86_FEATURE_SMCAbit on AMD systems, and linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)The warnings occur because the module code erroneously returns
-EEXISTfor modules that have failed to load and are in the process of being removed from the module list.module
amd64_edac_modhas a dependency on moduleedac_mce_amd. Using modules.dep, systemd will loadedac_mce_amdfor every request ofamd64_edac_mod. When theedac_mce_amdmodule loads, the module has stateMODULE_STATE_UNFORMEDand once the module load fails and the state becomesMODULE_STATE_GOING. Another request foredac_mce_amdmodule executes andadd_unformed_module()will erroneously return-EEXISTeven though the previous instance ofedac_mce_amdhasMODULE_STATE_GOING. Upon receiving-EEXIST, systemd attempts to loadamd64_edac_mod, which fails because of unknown symbols fromedac_mce_amd.
add_unformed_module()must wait to return for any case other thanMODULE_STATE_LIVEto prevent a race between multiple loads of dependent modules.Signed-off-by Prarit Bhargava <[email protected]>Reported-by Cathy Avery <[email protected]>Cc Jessica Yu <[email protected]>--- kernel/module.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)kernel/module.c +1
-2@@ -3566,8 +3566,7 @@ static int add_unformed_module(struct module *mod)mutex_lock (&module_mutex); old =find_module_all (mod->name,strlen (mod->name), true);if (old !=NULL ) { -if (old->state ==MODULE_STATE_COMING - || old->state ==MODULE_STATE_UNFORMED ) { +if (old->state !=MODULE_STATE_LIVE ) {/* Wait in case it fails to load. */ mutex_unlock (&module_mutex); err = wait_event_interruptible(module_wq,
Jessica Yu
Applied+++ Prarit Bhargava [02/04/19 09:39 -0400]:
Quoted 24 lines
Microsoft HyperV disables the
X86_FEATURE_SMCAbit on AMD systems, and linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)The warnings occur because the module code erroneously returns
-EEXISTfor modules that have failed to load and are in the process of being removed from the module list.module
amd64_edac_modhas a dependency on moduleedac_mce_amd. Using modules.dep, systemd will loadedac_mce_amdfor every request ofamd64_edac_mod. When theedac_mce_amdmodule loads, the module has stateMODULE_STATE_UNFORMEDand once the module load fails and the state becomesMODULE_STATE_GOING. Another request foredac_mce_amdmodule executes andadd_unformed_module()will erroneously return-EEXISTeven though the previous instance ofedac_mce_amdhasMODULE_STATE_GOING. Upon receiving-EEXIST, systemd attempts to loadamd64_edac_mod, which fails because of unknown symbols fromedac_mce_amd.
Quoted 7 lines
add_unformed_module()must wait to return for any case other thanMODULE_STATE_LIVEto prevent a race between multiple loads of dependent modules.Signed-off-by Prarit Bhargava <[email protected]>Reported-by Cathy Avery <[email protected]>Cc Jessica Yu <[email protected]>
Applied to modules-next. Thanks Prarit!
Jessica
Quoted 29 lines · Jessica Yu
+++ Prarit Bhargava [02/04/19 09:39 -0400]:
Quoted 28 lines
Microsoft HyperV disables the
X86_FEATURE_SMCAbit on AMD systems, and linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)The warnings occur because the module code erroneously returns
-EEXISTfor modules that have failed to load and are in the process of being removed from the module list.module
amd64_edac_modhas a dependency on module edac_mce_amd. Using modules.dep, systemd will loadedac_mce_amdfor every request of amd64_edac_mod. When theedac_mce_amdmodule loads, the module has stateMODULE_STATE_UNFORMEDand once the module load fails and the state becomes MODULE_STATE_GOING. Another request foredac_mce_amdmodule executes andadd_unformed_module()will erroneously return-EEXISTeven though the previous instance ofedac_mce_amdhasMODULE_STATE_GOING. Upon receiving-EEXIST, systemd attempts to loadamd64_edac_mod, which fails because of unknown symbols fromedac_mce_amd.
add_unformed_module()must wait to return for any case other thanMODULE_STATE_LIVEto prevent a race between multiple loads of dependent modules.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Prarit Bhargava <[email protected]>Reported-by Cathy Avery <[email protected]>Cc Jessica Yu <[email protected]>Applied to modules-next. Thanks Prarit!
Jessica, could I have the URL of the git tree?
Thanks,
P.
Quoted 3 lines
Jessica
+++ Prarit Bhargava [15/04/19 08:04 -0400]:
Quoted 32 lines · Jessica Yu
Quoted 29 lines
+++ Prarit Bhargava [02/04/19 09:39 -0400]:
Quoted 28 lines
Microsoft HyperV disables the
X86_FEATURE_SMCAbit on AMD systems, and linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)amd64_edac_mod: Unknown symbolamd_unregister_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_register_ecc_decoder(err -2)amd64_edac_mod: Unknown symbolamd_report_gart_errors(err -2)The warnings occur because the module code erroneously returns
-EEXISTfor modules that have failed to load and are in the process of being removed from the module list.module
amd64_edac_modhas a dependency on module edac_mce_amd. Using modules.dep, systemd will loadedac_mce_amdfor every request of amd64_edac_mod. When theedac_mce_amdmodule loads, the module has stateMODULE_STATE_UNFORMEDand once the module load fails and the state becomes MODULE_STATE_GOING. Another request foredac_mce_amdmodule executes andadd_unformed_module()will erroneously return-EEXISTeven though the previous instance ofedac_mce_amdhasMODULE_STATE_GOING. Upon receiving-EEXIST, systemd attempts to loadamd64_edac_mod, which fails because of unknown symbols fromedac_mce_amd.
add_unformed_module()must wait to return for any case other thanMODULE_STATE_LIVEto prevent a race between multiple loads of dependent modules.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Prarit Bhargava <[email protected]>Reported-by Cathy Avery <[email protected]>Cc Jessica Yu <[email protected]>Applied to modules-next. Thanks Prarit!
Jessica, could I have the URL of the git tree?
Sure, you can find the modules-next branch at:
git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git
Thanks,
Jessica