All of lore.kernel.org
 help / color / mirror / Atom feed
* QEMU | Pipeline #168317253 has failed for master | 9fc87111
@ 2020-07-19 19:35 GitLab via
  2020-07-20  6:16 ` Memory leak in bitmap code? (was: QEMU | Pipeline #168317253 has failed for master | 9fc87111) Thomas Huth
  0 siblings, 1 reply; 5+ messages in thread
From: GitLab via @ 2020-07-19 19:35 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 3274 bytes --]



Your pipeline has failed.

Project: QEMU ( https://gitlab.com/qemu-project/qemu )
Branch: master ( https://gitlab.com/qemu-project/qemu/-/commits/master )

Commit: 9fc87111 ( https://gitlab.com/qemu-project/qemu/-/commit/9fc87111005e8903785db40819af66b8f85b8b96 )
Commit Message: Merge remote-tracking branch 'remotes/rth/tags/...
Commit Author: Peter Maydell ( https://gitlab.com/pm215 )

Pipeline #168317253 ( https://gitlab.com/qemu-project/qemu/-/pipelines/168317253 ) triggered by Alex Bennée ( https://gitlab.com/stsquad )
had 1 failed build.

Job #645799805 ( https://gitlab.com/qemu-project/qemu/-/jobs/645799805/raw )

Stage: build
Name: build-fuzzer
Trace: ==11111==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2359296 byte(s) in 9 object(s) allocated from:
    #0 0x5570060105d7 in calloc (/builds/qemu-project/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x2bdb5d7)
    #1 0x55700605ddf9 in bitmap_try_new /builds/qemu-project/qemu/include/qemu/bitmap.h:96:12
    #2 0x55700605ddf9 in bitmap_new /builds/qemu-project/qemu/include/qemu/bitmap.h:101:26
    #3 0x55700605ddf9 in dirty_memory_extend /builds/qemu-project/qemu/exec.c:2219:37
    #4 0x55700605ddf9 in ram_block_add /builds/qemu-project/qemu/exec.c:2268:9
    #5 0x5570060611b4 in qemu_ram_alloc_internal /builds/qemu-project/qemu/exec.c:2441:5
    #6 0x557006061567 in qemu_ram_alloc /builds/qemu-project/qemu/exec.c:2460:12
    #7 0x55700675d350 in memory_region_init_ram_shared_nomigrate /builds/qemu-project/qemu/softmmu/memory.c:1514:21
    #8 0x557006bdd127 in ram_backend_memory_alloc /builds/qemu-project/qemu/backends/hostmem-ram.c:30:5
    #9 0x557006bd9733 in host_memory_backend_memory_complete /builds/qemu-project/qemu/backends/hostmem.c:333:9
    #10 0x557007a20ffc in user_creatable_complete /builds/qemu-project/qemu/qom/object_interfaces.c:23:9
    #11 0x557007a2178a in user_creatable_add_type /builds/qemu-project/qemu/qom/object_interfaces.c:93:10
    #12 0x557007a219dc in user_creatable_add_dict /builds/qemu-project/qemu/qom/object_interfaces.c:134:11
    #13 0x557007ee7eb6 in qmp_dispatch /builds/qemu-project/qemu/qapi/qmp-dispatch.c:155:5
    #14 0x5570077452a8 in monitor_qmp_dispatch /builds/qemu-project/qemu/monitor/qmp.c:145:11
    #15 0x55700774411d in monitor_qmp_bh_dispatcher /builds/qemu-project/qemu/monitor/qmp.c:234:9
    #16 0x557008065c66 in aio_bh_poll /builds/qemu-project/qemu/util/async.c:164:13
    #17 0x55700800235c in aio_dispatch /builds/qemu-project/qemu/util/aio-posix.c:380:5
    #18 0x55700806a62c in aio_ctx_dispatch /builds/qemu-project/qemu/util/async.c:306:5
    #19 0x7f93662807ae in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x527ae)

SUMMARY: AddressSanitizer: 2359296 byte(s) leaked in 9 allocation(s).
/builds/qemu-project/qemu/tests/qtest/libqtest.c:166: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
ERROR qmp-cmd-test - too few tests run (expected 51, got 50)
make: *** [/builds/qemu-project/qemu/tests/Makefile.include:650: check-qtest-x86_64] Error 1
section_end:1595186229:step_script
^[[0K^[[31;1mERROR: Job failed: exit code 1
^[[0;m


-- 
You're receiving this email because of your account on gitlab.com.




[-- Attachment #2: Type: text/html, Size: 17009 bytes --]

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

* Memory leak in bitmap code? (was: QEMU | Pipeline #168317253 has failed for master | 9fc87111)
  2020-07-19 19:35 QEMU | Pipeline #168317253 has failed for master | 9fc87111 GitLab via
@ 2020-07-20  6:16 ` Thomas Huth
  2020-07-20  7:50   ` Memory leak in bitmap code? Vladimir Sementsov-Ogievskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2020-07-20  6:16 UTC (permalink / raw)
  To: QEMU Developers, Vladimir Sementsov-Ogievskiy, Eric Blake
  Cc: Kevin Wolf, Richard Henderson


 Hi,

looks like the LeakSanitizer spotted a memory leak in the bitmap related
code ... not sure why it just triggered with Richard's pull request, and
I can also not reproduce it... But since there is a nice backtrace in it
and there have been some bitmap-related patches recently, could you
maybe have a look whether this rings a bell by any chance:

 https://gitlab.com/qemu-project/qemu/-/jobs/645799805#L3282

?

 Thanks,
  Thomas


On 19/07/2020 21.35, GitLab via wrote:
> GitLab
> ✖ 	Your pipeline has failed.
> 
>  
> Project 	QEMU <https://gitlab.com/qemu-project> / QEMU
> <https://gitlab.com/qemu-project/qemu>
> Branch 	
> 	master <https://gitlab.com/qemu-project/qemu/-/commits/master>
> 
> Commit 	
> 	9fc87111
> <https://gitlab.com/qemu-project/qemu/-/commit/9fc87111005e8903785db40819af66b8f85b8b96>
> 
> 
> Merge remote-tracking branch 'remotes/rth/tags/...
> Commit Author 	
> 	Peter Maydell <https://gitlab.com/pm215>
> 
>  
> Pipeline #168317253
> <https://gitlab.com/qemu-project/qemu/-/pipelines/168317253>
> triggered by 		Alex Bennée <https://gitlab.com/stsquad>
> 
> had 1 failed build.
> Logs may contain sensitive data. Please consider before forwarding this
> email.
> ✖ 	build
> 
> 	build-fuzzer <https://gitlab.com/qemu-project/qemu/-/jobs/645799805>
> 
> ==11111==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 2359296 byte(s) in 9 object(s) allocated from:
> #0 0x5570060105d7 in calloc
> (/builds/qemu-project/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x2bdb5d7)
> #1 0x55700605ddf9 in bitmap_try_new
> /builds/qemu-project/qemu/include/qemu/bitmap.h:96:12
> #2 0x55700605ddf9 in bitmap_new
> /builds/qemu-project/qemu/include/qemu/bitmap.h:101:26
> #3 0x55700605ddf9 in dirty_memory_extend
> /builds/qemu-project/qemu/exec.c:2219:37
> #4 0x55700605ddf9 in ram_block_add /builds/qemu-project/qemu/exec.c:2268:9
> #5 0x5570060611b4 in qemu_ram_alloc_internal
> /builds/qemu-project/qemu/exec.c:2441:5
> #6 0x557006061567 in qemu_ram_alloc /builds/qemu-project/qemu/exec.c:2460:12
> #7 0x55700675d350 in memory_region_init_ram_shared_nomigrate
> /builds/qemu-project/qemu/softmmu/memory.c:1514:21
> #8 0x557006bdd127 in ram_backend_memory_alloc
> /builds/qemu-project/qemu/backends/hostmem-ram.c:30:5
> #9 0x557006bd9733 in host_memory_backend_memory_complete
> /builds/qemu-project/qemu/backends/hostmem.c:333:9
> #10 0x557007a20ffc in user_creatable_complete
> /builds/qemu-project/qemu/qom/object_interfaces.c:23:9
> #11 0x557007a2178a in user_creatable_add_type
> /builds/qemu-project/qemu/qom/object_interfaces.c:93:10
> #12 0x557007a219dc in user_creatable_add_dict
> /builds/qemu-project/qemu/qom/object_interfaces.c:134:11
> #13 0x557007ee7eb6 in qmp_dispatch
> /builds/qemu-project/qemu/qapi/qmp-dispatch.c:155:5
> #14 0x5570077452a8 in monitor_qmp_dispatch
> /builds/qemu-project/qemu/monitor/qmp.c:145:11
> #15 0x55700774411d in monitor_qmp_bh_dispatcher
> /builds/qemu-project/qemu/monitor/qmp.c:234:9
> #16 0x557008065c66 in aio_bh_poll
> /builds/qemu-project/qemu/util/async.c:164:13
> #17 0x55700800235c in aio_dispatch
> /builds/qemu-project/qemu/util/aio-posix.c:380:5
> #18 0x55700806a62c in aio_ctx_dispatch
> /builds/qemu-project/qemu/util/async.c:306:5
> #19 0x7f93662807ae in g_main_context_dispatch
> (/lib64/libglib-2.0.so.0+0x527ae)
> 
> SUMMARY: AddressSanitizer: 2359296 byte(s) leaked in 9 allocation(s).
> /builds/qemu-project/qemu/tests/qtest/libqtest.c:166: kill_qemu() tried
> to terminate QEMU process but encountered exit status 1 (expected 0)
> ERROR qmp-cmd-test - too few tests run (expected 51, got 50)
> make: *** [/builds/qemu-project/qemu/tests/Makefile.include:650:
> check-qtest-x86_64] Error 1
> ERROR: Job failed: exit code 1
> 
> GitLab
> You're receiving this email because of your account on gitlab.com.
> Manage all notifications <https://gitlab.com/profile/notifications> ·
> Help <https://gitlab.com/help>
> 



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

* Re: Memory leak in bitmap code?
  2020-07-20  6:16 ` Memory leak in bitmap code? (was: QEMU | Pipeline #168317253 has failed for master | 9fc87111) Thomas Huth
@ 2020-07-20  7:50   ` Vladimir Sementsov-Ogievskiy
  2020-07-21 10:50     ` Stefan Hajnoczi
  2020-07-21 12:05     ` Stefan Hajnoczi
  0 siblings, 2 replies; 5+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2020-07-20  7:50 UTC (permalink / raw)
  To: Thomas Huth, QEMU Developers, Eric Blake
  Cc: Kevin Wolf, Richard Henderson, Stefan Hajnoczi

20.07.2020 09:16, Thomas Huth wrote:
> 
>   Hi,
> 
> looks like the LeakSanitizer spotted a memory leak in the bitmap related
> code ... not sure why it just triggered with Richard's pull request, and
> I can also not reproduce it... But since there is a nice backtrace in it
> and there have been some bitmap-related patches recently, could you
> maybe have a look whether this rings a bell by any chance:
> 
>   https://gitlab.com/qemu-project/qemu/-/jobs/645799805#L3282
> 

Hi! Hmm. bitmap.c/bitmap.h is a simple bitmap library, which was not changed this
year. The last commit I see is about a year ago.

So, I assume the problem should be somewhere below in the stack trace.

I don't know this code, but try to look at:

OK, sanitizer reports that we loose the memory allocated at exce.c:2219, i.e.

new_blocks->blocks1[j] = bitmap_new(DIRTY_MEMORY_BLOCK_SIZE);

Hmm. And where is this bitmap released? I can't find the place. May be the leak
was introduced in far 5b82b703b69acc67b7 with this bitmap_new()? Add Stefan to
CC.

> 
>   Thanks,
>    Thomas
> 
> 
> On 19/07/2020 21.35, GitLab via wrote:
>> GitLab
>> ✖ 	Your pipeline has failed.
>>
>>   
>> Project 	QEMU <https://gitlab.com/qemu-project> / QEMU
>> <https://gitlab.com/qemu-project/qemu>
>> Branch 	
>> 	master <https://gitlab.com/qemu-project/qemu/-/commits/master>
>>
>> Commit 	
>> 	9fc87111
>> <https://gitlab.com/qemu-project/qemu/-/commit/9fc87111005e8903785db40819af66b8f85b8b96>
>>
>>
>> Merge remote-tracking branch 'remotes/rth/tags/...
>> Commit Author 	
>> 	Peter Maydell <https://gitlab.com/pm215>
>>
>>   
>> Pipeline #168317253
>> <https://gitlab.com/qemu-project/qemu/-/pipelines/168317253>
>> triggered by 		Alex Bennée <https://gitlab.com/stsquad>
>>
>> had 1 failed build.
>> Logs may contain sensitive data. Please consider before forwarding this
>> email.
>> ✖ 	build
>>
>> 	build-fuzzer <https://gitlab.com/qemu-project/qemu/-/jobs/645799805>
>>
>> ==11111==ERROR: LeakSanitizer: detected memory leaks
>>
>> Direct leak of 2359296 byte(s) in 9 object(s) allocated from:
>> #0 0x5570060105d7 in calloc
>> (/builds/qemu-project/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x2bdb5d7)
>> #1 0x55700605ddf9 in bitmap_try_new
>> /builds/qemu-project/qemu/include/qemu/bitmap.h:96:12
>> #2 0x55700605ddf9 in bitmap_new
>> /builds/qemu-project/qemu/include/qemu/bitmap.h:101:26
>> #3 0x55700605ddf9 in dirty_memory_extend
>> /builds/qemu-project/qemu/exec.c:2219:37
>> #4 0x55700605ddf9 in ram_block_add /builds/qemu-project/qemu/exec.c:2268:9
>> #5 0x5570060611b4 in qemu_ram_alloc_internal
>> /builds/qemu-project/qemu/exec.c:2441:5
>> #6 0x557006061567 in qemu_ram_alloc /builds/qemu-project/qemu/exec.c:2460:12
>> #7 0x55700675d350 in memory_region_init_ram_shared_nomigrate
>> /builds/qemu-project/qemu/softmmu/memory.c:1514:21
>> #8 0x557006bdd127 in ram_backend_memory_alloc
>> /builds/qemu-project/qemu/backends/hostmem-ram.c:30:5
>> #9 0x557006bd9733 in host_memory_backend_memory_complete
>> /builds/qemu-project/qemu/backends/hostmem.c:333:9
>> #10 0x557007a20ffc in user_creatable_complete
>> /builds/qemu-project/qemu/qom/object_interfaces.c:23:9
>> #11 0x557007a2178a in user_creatable_add_type
>> /builds/qemu-project/qemu/qom/object_interfaces.c:93:10
>> #12 0x557007a219dc in user_creatable_add_dict
>> /builds/qemu-project/qemu/qom/object_interfaces.c:134:11
>> #13 0x557007ee7eb6 in qmp_dispatch
>> /builds/qemu-project/qemu/qapi/qmp-dispatch.c:155:5
>> #14 0x5570077452a8 in monitor_qmp_dispatch
>> /builds/qemu-project/qemu/monitor/qmp.c:145:11
>> #15 0x55700774411d in monitor_qmp_bh_dispatcher
>> /builds/qemu-project/qemu/monitor/qmp.c:234:9
>> #16 0x557008065c66 in aio_bh_poll
>> /builds/qemu-project/qemu/util/async.c:164:13
>> #17 0x55700800235c in aio_dispatch
>> /builds/qemu-project/qemu/util/aio-posix.c:380:5
>> #18 0x55700806a62c in aio_ctx_dispatch
>> /builds/qemu-project/qemu/util/async.c:306:5
>> #19 0x7f93662807ae in g_main_context_dispatch
>> (/lib64/libglib-2.0.so.0+0x527ae)
>>
>> SUMMARY: AddressSanitizer: 2359296 byte(s) leaked in 9 allocation(s).
>> /builds/qemu-project/qemu/tests/qtest/libqtest.c:166: kill_qemu() tried
>> to terminate QEMU process but encountered exit status 1 (expected 0)
>> ERROR qmp-cmd-test - too few tests run (expected 51, got 50)
>> make: *** [/builds/qemu-project/qemu/tests/Makefile.include:650:
>> check-qtest-x86_64] Error 1
>> ERROR: Job failed: exit code 1
>>
>> GitLab
>> You're receiving this email because of your account on gitlab.com.
>> Manage all notifications <https://gitlab.com/profile/notifications> ·
>> Help <https://gitlab.com/help>
>>
> 


-- 
Best regards,
Vladimir


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

* Re: Memory leak in bitmap code?
  2020-07-20  7:50   ` Memory leak in bitmap code? Vladimir Sementsov-Ogievskiy
@ 2020-07-21 10:50     ` Stefan Hajnoczi
  2020-07-21 12:05     ` Stefan Hajnoczi
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2020-07-21 10:50 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy
  Cc: Kevin Wolf, Richard Henderson, Thomas Huth, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]

On Mon, Jul 20, 2020 at 10:50:23AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> 20.07.2020 09:16, Thomas Huth wrote:
> > 
> >   Hi,
> > 
> > looks like the LeakSanitizer spotted a memory leak in the bitmap related
> > code ... not sure why it just triggered with Richard's pull request, and
> > I can also not reproduce it... But since there is a nice backtrace in it
> > and there have been some bitmap-related patches recently, could you
> > maybe have a look whether this rings a bell by any chance:
> > 
> >   https://gitlab.com/qemu-project/qemu/-/jobs/645799805#L3282
> > 
> 
> Hi! Hmm. bitmap.c/bitmap.h is a simple bitmap library, which was not changed this
> year. The last commit I see is about a year ago.
> 
> So, I assume the problem should be somewhere below in the stack trace.
> 
> I don't know this code, but try to look at:
> 
> OK, sanitizer reports that we loose the memory allocated at exce.c:2219, i.e.
> 
> new_blocks->blocks1[j] = bitmap_new(DIRTY_MEMORY_BLOCK_SIZE);
> 
> Hmm. And where is this bitmap released? I can't find the place. May be the leak
> was introduced in far 5b82b703b69acc67b7 with this bitmap_new()? Add Stefan to
> CC.

g_free_rcu() is used when ram_list->dirty_memory[] is extended, so the
leak is not dangerous.

There is no cleanup function for the global ram_list. I'll investigate
writing a patch to clean up ram_list fields.

Thanks,
Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: Memory leak in bitmap code?
  2020-07-20  7:50   ` Memory leak in bitmap code? Vladimir Sementsov-Ogievskiy
  2020-07-21 10:50     ` Stefan Hajnoczi
@ 2020-07-21 12:05     ` Stefan Hajnoczi
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2020-07-21 12:05 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy
  Cc: Kevin Wolf, Richard Henderson, Thomas Huth, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

On Mon, Jul 20, 2020 at 10:50:23AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> 20.07.2020 09:16, Thomas Huth wrote:
> > 
> >   Hi,
> > 
> > looks like the LeakSanitizer spotted a memory leak in the bitmap related
> > code ... not sure why it just triggered with Richard's pull request, and
> > I can also not reproduce it... But since there is a nice backtrace in it
> > and there have been some bitmap-related patches recently, could you
> > maybe have a look whether this rings a bell by any chance:
> > 
> >   https://gitlab.com/qemu-project/qemu/-/jobs/645799805#L3282
> > 
> 
> Hi! Hmm. bitmap.c/bitmap.h is a simple bitmap library, which was not changed this
> year. The last commit I see is about a year ago.
> 
> So, I assume the problem should be somewhere below in the stack trace.
> 
> I don't know this code, but try to look at:
> 
> OK, sanitizer reports that we loose the memory allocated at exce.c:2219, i.e.
> 
> new_blocks->blocks1[j] = bitmap_new(DIRTY_MEMORY_BLOCK_SIZE);
> 
> Hmm. And where is this bitmap released? I can't find the place. May be the leak
> was introduced in far 5b82b703b69acc67b7 with this bitmap_new()? Add Stefan to
> CC.

Looking at this more there are a bunch of exec.c resources that are not
freed at shutdown (system_memory, mutexes, etc). I don't think it is
worth freeing them, especially not for QEMU 5.1 since it needs to be
done very carefully to avoid dangling pointers in case something else
that hasn't been free is still referencing the resources.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-07-21 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-19 19:35 QEMU | Pipeline #168317253 has failed for master | 9fc87111 GitLab via
2020-07-20  6:16 ` Memory leak in bitmap code? (was: QEMU | Pipeline #168317253 has failed for master | 9fc87111) Thomas Huth
2020-07-20  7:50   ` Memory leak in bitmap code? Vladimir Sementsov-Ogievskiy
2020-07-21 10:50     ` Stefan Hajnoczi
2020-07-21 12:05     ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.