qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] module: Prevent crash by resetting local_err in module_load_qom_all()
@ 2024-08-09 12:13 Alexander Ivanov
  2024-08-09 12:13 ` [PATCH 1/1] " Alexander Ivanov
  2024-08-13 14:33 ` [PATCH 0/1] " Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Alexander Ivanov @ 2024-08-09 12:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: den, andrey.drobyshev, cfontana, kraxel, laurent, mjt

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(+)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/1] module: Prevent crash by resetting local_err in module_load_qom_all()
  2024-08-09 12:13 [PATCH 0/1] module: Prevent crash by resetting local_err in module_load_qom_all() Alexander Ivanov
@ 2024-08-09 12:13 ` Alexander Ivanov
  2024-08-09 12:14   ` Denis V. Lunev
                     ` (2 more replies)
  2024-08-13 14:33 ` [PATCH 0/1] " Paolo Bonzini
  1 sibling, 3 replies; 7+ messages in thread
From: Alexander Ivanov @ 2024-08-09 12:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: den, andrey.drobyshev, cfontana, kraxel, laurent, mjt

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.

Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
 util/module.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/module.c b/util/module.c
index 32e263163c..3ff4aee2ca 100644
--- a/util/module.c
+++ b/util/module.c
@@ -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;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] module: Prevent crash by resetting local_err in module_load_qom_all()
  2024-08-09 12:13 ` [PATCH 1/1] " Alexander Ivanov
@ 2024-08-09 12:14   ` Denis V. Lunev
  2024-08-09 13:22   ` Claudio Fontana
  2024-08-11 22:05   ` Richard Henderson
  2 siblings, 0 replies; 7+ messages in thread
From: Denis V. Lunev @ 2024-08-09 12:14 UTC (permalink / raw)
  To: Alexander Ivanov, qemu-devel
  Cc: andrey.drobyshev, cfontana, kraxel, laurent, mjt

On 8/9/24 14:13, Alexander Ivanov wrote:
> 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.
>
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
> ---
>   util/module.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/util/module.c b/util/module.c
> index 32e263163c..3ff4aee2ca 100644
> --- a/util/module.c
> +++ b/util/module.c
> @@ -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;
Reviewed-by: Denis V. Lunev <den@openvz.org>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] module: Prevent crash by resetting local_err in module_load_qom_all()
  2024-08-09 12:13 ` [PATCH 1/1] " Alexander Ivanov
  2024-08-09 12:14   ` Denis V. Lunev
@ 2024-08-09 13:22   ` Claudio Fontana
  2024-08-11 22:05   ` Richard Henderson
  2 siblings, 0 replies; 7+ messages in thread
From: Claudio Fontana @ 2024-08-09 13:22 UTC (permalink / raw)
  To: Alexander Ivanov, qemu-devel; +Cc: den, andrey.drobyshev, kraxel, laurent, mjt

On 8/9/24 14:13, Alexander Ivanov wrote:
> 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.
> 
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
> ---
>  util/module.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/util/module.c b/util/module.c
> index 32e263163c..3ff4aee2ca 100644
> --- a/util/module.c
> +++ b/util/module.c
> @@ -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;

Reviewed-by: Claudio Fontana <cfontana@suse.de>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] module: Prevent crash by resetting local_err in module_load_qom_all()
  2024-08-09 12:13 ` [PATCH 1/1] " Alexander Ivanov
  2024-08-09 12:14   ` Denis V. Lunev
  2024-08-09 13:22   ` Claudio Fontana
@ 2024-08-11 22:05   ` Richard Henderson
  2024-08-12  7:59     ` Alexander Ivanov
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2024-08-11 22:05 UTC (permalink / raw)
  To: Alexander Ivanov, qemu-devel
  Cc: den, andrey.drobyshev, cfontana, kraxel, laurent, mjt

On 8/9/24 22:13, Alexander Ivanov wrote:
> 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.
> 
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
> ---
>   util/module.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/util/module.c b/util/module.c
> index 32e263163c..3ff4aee2ca 100644
> --- a/util/module.c
> +++ b/util/module.c
> @@ -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~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] module: Prevent crash by resetting local_err in module_load_qom_all()
  2024-08-11 22:05   ` Richard Henderson
@ 2024-08-12  7:59     ` Alexander Ivanov
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Ivanov @ 2024-08-12  7:59 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel
  Cc: den, andrey.drobyshev, cfontana, kraxel, laurent, mjt

On 8/12/24 00:05, Richard Henderson wrote:
> On 8/9/24 22:13, Alexander Ivanov wrote:
>> 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.
>>
>> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
>> ---
>>   util/module.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/util/module.c b/util/module.c
>> index 32e263163c..3ff4aee2ca 100644
>> --- a/util/module.c
>> +++ b/util/module.c
>> @@ -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.
Yes, I agree, it makes sense.
>
>
> r~

-- 
Best regards,
Alexander Ivanov



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] module: Prevent crash by resetting local_err in module_load_qom_all()
  2024-08-09 12:13 [PATCH 0/1] module: Prevent crash by resetting local_err in module_load_qom_all() Alexander Ivanov
  2024-08-09 12:13 ` [PATCH 1/1] " Alexander Ivanov
@ 2024-08-13 14:33 ` Paolo Bonzini
  1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2024-08-13 14:33 UTC (permalink / raw)
  To: Alexander Ivanov
  Cc: qemu-devel, den, andrey.drobyshev, cfontana, kraxel, laurent, mjt

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-08-13 14:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09 12:13 [PATCH 0/1] module: Prevent crash by resetting local_err in module_load_qom_all() Alexander Ivanov
2024-08-09 12:13 ` [PATCH 1/1] " Alexander Ivanov
2024-08-09 12:14   ` Denis V. Lunev
2024-08-09 13:22   ` Claudio Fontana
2024-08-11 22:05   ` Richard Henderson
2024-08-12  7:59     ` Alexander Ivanov
2024-08-13 14:33 ` [PATCH 0/1] " Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).