All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1860610] [NEW] cap_disas_plugin leaks memory
@ 2020-01-22 21:59 Robert Henry
  2020-01-31 17:17 ` [Bug 1860610] " Alex Bennée
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Robert Henry @ 2020-01-22 21:59 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Looking at origin/master head, the function cap_disas_plugin leaks
memory.

per capstone's examples using their ABI, cs_free(insn, count); needs to
called just before cs_close.

I discovered this running qemu under valgrind.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  New

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

* [Bug 1860610] Re: cap_disas_plugin leaks memory
  2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
@ 2020-01-31 17:17 ` Alex Bennée
  2020-01-31 19:56 ` Robert Henry
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2020-01-31 17:17 UTC (permalink / raw)
  To: qemu-devel

It looks like this will fail on all the other capstone cases as well. Is
this an API change across versions?

** Tags added: plugin tcg

** Changed in: qemu
     Assignee: (unassigned) => Alex Bennée (ajbennee)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  New

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

* [Bug 1860610] Re: cap_disas_plugin leaks memory
  2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
  2020-01-31 17:17 ` [Bug 1860610] " Alex Bennée
@ 2020-01-31 19:56 ` Robert Henry
  2020-02-06 11:36 ` Alex Bennée
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Robert Henry @ 2020-01-31 19:56 UTC (permalink / raw)
  To: qemu-devel

I run git blame in the capstone repository, and cs_free has been around
for at least 4 years in the capstone ABI. I can not tell if the need to
call cs_free is a (new) requirement. Documentation capstone is a little
informal...

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  New

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

* [Bug 1860610] Re: cap_disas_plugin leaks memory
  2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
  2020-01-31 17:17 ` [Bug 1860610] " Alex Bennée
  2020-01-31 19:56 ` Robert Henry
@ 2020-02-06 11:36 ` Alex Bennée
  2020-02-06 12:26 ` Alex Bennée
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2020-02-06 11:36 UTC (permalink / raw)
  To: qemu-devel

What command line where you using? I've been unable to replicate the
valgrind warning with a riscv64-linux-user run of hello with the
libhowvec.so plugin. Valgrind does complain about a bunch of other stuff
though.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  New

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

* [Bug 1860610] Re: cap_disas_plugin leaks memory
  2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
                   ` (2 preceding siblings ...)
  2020-02-06 11:36 ` Alex Bennée
@ 2020-02-06 12:26 ` Alex Bennée
  2020-08-08  9:55 ` Thomas Huth
  2020-10-08  4:17 ` Launchpad Bug Tracker
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2020-02-06 12:26 UTC (permalink / raw)
  To: qemu-devel

Looking at the way disas is structured it seems cap_insn is allocated
once (per thread) and re-used for each disassembly so we shouldn't be
free'ing it after each usage. In fact the comments to cap_disas_start
imply we want to do better than re-initialising the library for every
set of instructions we disassemble.

It is true that we don't clean-up any of the disassembly machinery on
exit but the same can be said for a lot of QEMU's static state. So
currently I don't see a leak rather than a one-time allocation. Unless I
can reproduce the leak I'm going to mark this as incomplete for now.

** Changed in: qemu
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  Incomplete

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

* [Bug 1860610] Re: cap_disas_plugin leaks memory
  2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
                   ` (3 preceding siblings ...)
  2020-02-06 12:26 ` Alex Bennée
@ 2020-08-08  9:55 ` Thomas Huth
  2020-10-08  4:17 ` Launchpad Bug Tracker
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2020-08-08  9:55 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
     Assignee: Alex Bennée (ajbennee) => (unassigned)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  Incomplete

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

* [Bug 1860610] Re: cap_disas_plugin leaks memory
  2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
                   ` (4 preceding siblings ...)
  2020-08-08  9:55 ` Thomas Huth
@ 2020-10-08  4:17 ` Launchpad Bug Tracker
  5 siblings, 0 replies; 7+ messages in thread
From: Launchpad Bug Tracker @ 2020-10-08  4:17 UTC (permalink / raw)
  To: qemu-devel

[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1860610

Title:
  cap_disas_plugin leaks memory

Status in QEMU:
  Expired

Bug description:
  Looking at origin/master head, the function cap_disas_plugin leaks
  memory.

  per capstone's examples using their ABI, cs_free(insn, count); needs
  to called just before cs_close.

  I discovered this running qemu under valgrind.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1860610/+subscriptions


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

end of thread, other threads:[~2020-10-08  4:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 21:59 [Bug 1860610] [NEW] cap_disas_plugin leaks memory Robert Henry
2020-01-31 17:17 ` [Bug 1860610] " Alex Bennée
2020-01-31 19:56 ` Robert Henry
2020-02-06 11:36 ` Alex Bennée
2020-02-06 12:26 ` Alex Bennée
2020-08-08  9:55 ` Thomas Huth
2020-10-08  4:17 ` Launchpad Bug Tracker

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.