From nobody Mon Feb 9 20:46:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585734555; cv=none; d=zohomail.com; s=zohoarc; b=Yz6rYvA5pIsYwyWtr1HZZPpQDFEY65YtM7kwTinZ2notZY349Rxq2FJ+gTLauo+vkGjXcuuPr/HGaMnH3Ur+SI+wiYUT1CzEvswDMLWGKpoBw7USNb0LPtye8Udja+X+1MuaA6F9N6IJacsAOPKVhsp7eA2FKTaJWCLkkHzG+Zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585734555; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=h75bfILekusPXGlQBXuZSQUYvT0dH6xycgkUfP0rfEE=; b=UN0N6zLrec7CdUwBEk7RgDqzhc0XxyOrle0DnteBvprbQniM1u6GEZ3dbgOoshudLP3nDsd8qvkBB/cX0oX3OzR5LRd8M1UgG98OgSfekZ1m7JgvioZUrhyP8FLAE07FPQqDmq0ibnQUyTGqhZQPw+28fULKCAkesELwzIJy0HI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585734555761828.2045900185607; Wed, 1 Apr 2020 02:49:15 -0700 (PDT) Received: from localhost ([::1]:57218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJZzm-000655-B1 for importer@patchew.org; Wed, 01 Apr 2020 05:49:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38445) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJZyk-0004Gz-JR for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJZyj-0002Bf-JP for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:10 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:51906) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJZyj-0002B3-Dn for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:09 -0400 Received: by mail-wm1-x341.google.com with SMTP id z7so3171019wmk.1 for ; Wed, 01 Apr 2020 02:48:09 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z129sm1974080wmb.7.2020.04.01.02.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 02:48:03 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C84071FF91; Wed, 1 Apr 2020 10:48:00 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h75bfILekusPXGlQBXuZSQUYvT0dH6xycgkUfP0rfEE=; b=RMProAHXOWc8vNSSVJOn0d1/V812X8r5sXDCj0Z/r/Tih7krd/eYR1UsEhM26pSWTB Dnzle2Op5YTAv+uplilIGicw/ebRfyGJewXZsSc/wR3L1iK57UPf/Sb51B7jAAqG+fyJ 4TeMfV6P3Oe6TkFezn+lcQyEYjzekG3Dm9y2B8K+FXeWGN7pTj5tCcIIb5KpQtxF/S/c QnBXgkq0/Wazl6j4dzTmsmqBltZBeEHS8oydZuQx2yNUos9hlBfIDwU4TZKyRtOD39UN 9S1VNTfdnQ87tdQVBX4V7CiwdHtdfIrak3t5cBzRuFFxW83D0GwDPQHSt57shRSuOaLa DM6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h75bfILekusPXGlQBXuZSQUYvT0dH6xycgkUfP0rfEE=; b=WxsjTnDhu9A4eKOSoMzbRaJAGqZ4oCsBgAFDYsmrn/DeCpOvrDXM4tbrhogvborNxV 70E+xOMkt2EZh6wFzCMOcByZ8f3BTz36Xbf/WntRhvrJ9s+iCwkIeUR3NJngtlbR4oHi Qk2knCUvjkvyNSQr1FL893rKK5PnT0QDSSapcR96+CdoiR0r+5P+c0jln+BHwvtbwR8d HXQSsXdztns9QT5a/RNKMFksf0fGJzE0u8Ml1Co812fHNqWQWbj/qWZKtn8lLXPEZiOU yWehD1eQJ861OKmENJ4Nv29fM3xQzOZA3NvS3IBYJm3oOVAPOpFdwtRKaR7+qFegOCss gnGg== X-Gm-Message-State: AGi0PubJLxW9OWwPbZxQzP19f1Cb/7aNGzBawO3KYZSvUlsjX+PUJKrn jmNXT3U4FmM15A+ONiOPNa0XQQ== X-Google-Smtp-Source: APiQypK9xv5BTWrp1VkpsZLejm1tKrhwj7MuUam69Y79t8z4Bp/CE39d3/rkI0HgDaFWd80NDtSeSA== X-Received: by 2002:a7b:c404:: with SMTP id k4mr3265439wmi.37.1585734488421; Wed, 01 Apr 2020 02:48:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 05/10] target/xtensa: add FIXME for translation memory leak Date: Wed, 1 Apr 2020 10:47:54 +0100 Message-Id: <20200401094759.5835-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200401094759.5835-1-alex.bennee@linaro.org> References: <20200401094759.5835-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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=C3=A9e Cc: Max Filippov Acked-by: Max Filippov --- 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(DisasContex= tBase *dcbase, dc->callinc =3D ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >> XTENSA_TBFLAG_CALLINC_SHIFT); =20 + /* + * 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 =3D xtensa_insnbuf_alloc(dc->config->isa); dc->slotbuf =3D xtensa_insnbuf_alloc(dc->config->isa); --=20 2.20.1