qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leak in bitmap code?


From: Vladimir Sementsov-Ogievskiy
Subject: Re: Memory leak in bitmap code?
Date: Mon, 20 Jul 2020 10:50:23 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]