module: Prevent crash by resetting local_err in module_load_qom_all()
cover module: Prevent crash by resetting local_err in module_load_qom_all()
After updating QEMU modules previously executed QEMU processes crash on module loading. It happens because error_setg() calls with a not NULL errp argument.
There is a discussion - https://issues.redhat.com/browse/RHEL-29848
Alexander Ivanov (1):
module: Prevent crash by resetting local_err in module_load_qom_all()
util/module.c | 1 + 1 file changed, 1 insertion(+)
Signature · 1 line
2.43.0
PATCH 1/1 module: Prevent crash by resetting local_err in module_load_qom_all()
Set local_err to NULL after it has been freed in error_report_err(). This avoids triggering assert(*errp == NULL) failure in error_setv() when local_err is reused in the loop.
--- util/module.c | 1 + 1 file changed, 1 insertion(+)
util/module.c +1 -0
@@ -369,6 +369,7 @@ void module_load_qom_all(void) }if (module_load ("" , modinfo->name, &local_err) <0 ) {error_report_err (local_err); + local_err =NULL ; } } module_loaded_qom_all = true;
Signature · 1 line
2.43.0
Quoted 14 lines · Alexander Ivanov
Set
local_errto NULL after it has been freed inerror_report_err(). This avoids triggeringassert(*errp == NULL)failure inerror_setv()whenlocal_erris reused in the loop.Signed-off-by Alexander Ivanov <[email protected]>--- util/module.c | 1 + 1 file changed, 1 insertion(+)util/module.c +0
-0
util/module.c void module_load_qom_all(void) · line 375
Quoted 7 lines
util/module.c +1
-0@@ -369,6 +369,7 @@ void module_load_qom_all(void) }if (module_load ("" , modinfo->name, &local_err) <0 ) {error_report_err (local_err); + local_err =NULL ; } } module_loaded_qom_all = true;
Quoted 14 lines · Alexander Ivanov
Set
local_errto NULL after it has been freed inerror_report_err(). This avoids triggeringassert(*errp == NULL)failure inerror_setv()whenlocal_erris reused in the loop.Signed-off-by Alexander Ivanov <[email protected]>--- util/module.c | 1 + 1 file changed, 1 insertion(+)util/module.c +0
-0
util/module.c void module_load_qom_all(void) · line 375
Quoted 7 lines
util/module.c +1
-0@@ -369,6 +369,7 @@ void module_load_qom_all(void) }if (module_load ("" , modinfo->name, &local_err) <0 ) {error_report_err (local_err); + local_err =NULL ; } } module_loaded_qom_all = true;
Quoted 14 lines · Alexander Ivanov
Set
local_errto NULL after it has been freed inerror_report_err(). This avoids triggeringassert(*errp == NULL)failure inerror_setv()whenlocal_erris reused in the loop.Signed-off-by Alexander Ivanov <[email protected]>--- util/module.c | 1 + 1 file changed, 1 insertion(+)util/module.c +0
-0
util/module.c void module_load_qom_all(void) · line 375
Quoted 7 lines
util/module.c +1
-0@@ -369,6 +369,7 @@ void module_load_qom_all(void) }if (module_load ("" , modinfo->name, &local_err) <0 ) {error_report_err (local_err); + local_err =NULL ; } } module_loaded_qom_all = true;
Better, IMO, to move local_err and its initialization into the loop.
r~
Quoted 10 lines · Richard Henderson
Quoted 9 lines · Alexander Ivanov
Set
local_errto NULL after it has been freed inerror_report_err(). This avoids triggeringassert(*errp == NULL)failure inerror_setv()whenlocal_erris reused in the loop.Signed-off-by Alexander Ivanov <[email protected]>---
util/module.c| 1 +1 file changed, 1 insertion(+)
Quoted 14 lines
util/module.c void module_load_qom_all(void) · line 375
Quoted 12 lines
util/module.c +1
-0@@ -369,6 +369,7 @@ void module_load_qom_all(void) } if (module_load("", modinfo->name, &local_err) < 0) { error_report_err(local_err); + local_err = NULL; } } module_loaded_qom_all = true;Better, IMO, to move
local_errand its initialization into the loop.
Yes, I agree, it makes sense.
Quoted 3 lines
r~
Signature · 2 lines
Best regards, Alexander Ivanov
Paolo Bonzini
AppliedQueued, thanks.
Paolo