All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Max Filippov" <jcmvbkbc@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH v2 05/10] target/xtensa: add FIXME for translation memory leak
Date: Wed,  1 Apr 2020 10:47:54 +0100	[thread overview]
Message-ID: <20200401094759.5835-6-alex.bennee@linaro.org> (raw)
In-Reply-To: <20200401094759.5835-1-alex.bennee@linaro.org>

Dynamically allocating a new structure within the DisasContext can
potentially leak as we can longjmp out of the translation loop (see
test_phys_mem). The proper fix would be to use static allocation
within the DisasContext but as the Xtensa translator imports it's code
from elsewhere I leave that as an exercise for the maintainer.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
---
 target/xtensa/translate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 8aa972cafdf..37f65b1f030 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -1174,6 +1174,11 @@ static void xtensa_tr_init_disas_context(DisasContextBase *dcbase,
     dc->callinc = ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >>
                    XTENSA_TBFLAG_CALLINC_SHIFT);
 
+    /*
+     * FIXME: This will leak when a failed instruction load or similar
+     * event causes us to longjump out of the translation loop and
+     * hence not clean-up in xtensa_tr_tb_stop
+     */
     if (dc->config->isa) {
         dc->insnbuf = xtensa_insnbuf_alloc(dc->config->isa);
         dc->slotbuf = xtensa_insnbuf_alloc(dc->config->isa);
-- 
2.20.1



  parent reply	other threads:[~2020-04-01  9:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  9:47 [PATCH for 5.0 v2 00/10] A selection of sanitiser fixes Alex Bennée
2020-04-01  9:47 ` [PATCH v2 01/10] elf-ops: bail out if we have no function symbols Alex Bennée
2020-04-01  9:47 ` [PATCH v2 02/10] linux-user: protect fcntl64 with an #ifdef Alex Bennée
2020-04-01  9:47 ` [PATCH v2 03/10] tests/tcg: remove extraneous pasting macros Alex Bennée
2020-04-01  9:47 ` [PATCH v2 04/10] linux-user: more debug for init_guest_space Alex Bennée
2020-04-01  9:47 ` Alex Bennée [this message]
2020-04-01 22:58   ` [PATCH v2 05/10] target/xtensa: add FIXME for translation memory leak Max Filippov
2020-04-01  9:47 ` [PATCH v2 06/10] gdbstub: fix compiler complaining Alex Bennée
2020-04-01  9:47 ` [PATCH v2 07/10] softfloat: Fix BAD_SHIFT from normalizeFloatx80Subnormal Alex Bennée
2020-04-01  9:47 ` [PATCH v2 08/10] linux-user: factor out reading of /proc/self/maps Alex Bennée
2020-04-02 16:58   ` Richard Henderson
2020-04-03 12:35     ` Alex Bennée
2020-04-01  9:47 ` [PATCH v2 09/10] linux-user: clean-up padding on /proc/self/maps Alex Bennée
2020-04-02 16:59   ` Richard Henderson
2020-04-01  9:47 ` [PATCH v2 10/10] linux-user: completely re-write init_guest_space Alex Bennée
2020-04-02  9:10   ` Alex Bennée
2020-04-02 22:03   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200401094759.5835-6-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.