From nobody Sat Apr 12 07:47:48 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428046; cv=none; d=zohomail.com; s=zohoarc; b=HRnBSaKp4g4TPc+hHiZQvZLGAUfsyP2tMLzRrb29L6bBKJzbetf2+TfjuL7zoSyCKB0bObb/6aI4YhKyPTGu2y6VHCRLUE+nGMOiD+GFOXn7zqjbTZ2CwDlfrV452HyZHC2hfmIidqoscxvFjd6hzVkHy+kF7ULZDkMm03zYwio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428046; 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=W7GA19BzjsaVlb4cNdmGQMkPm1CutshKMo07MTWHTyQ=; b=c8hfWoh5gafRYvO3mXP/EO4g3/5rGlhzRH7rMqlIv9JH52mAVZiFON6+sJYRPDabw/lB+TMasg6yxb/gBsBIHX6C6hypfq7acy3rR94vhXJCnbVq9ELSFjZJFhOX1Pw5oZwUk//AKJqFPFW+f21EU7xsQJ5qG0dAPxCkfpjl3Tk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1611428046488366.41376228581214; Sat, 23 Jan 2021 10:54:06 -0800 (PST) Received: from localhost ([::1]:33646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O2v-0000ma-GY for importer@patchew.org; Sat, 23 Jan 2021 13:54:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nzc-0005FE-15 for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:40 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:52524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzU-0008FZ-1T for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:39 -0500 Received: by mail-pj1-x102b.google.com with SMTP id kx7so5856091pjb.2 for ; Sat, 23 Jan 2021 10:50:31 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:30 -0800 (PST) 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=W7GA19BzjsaVlb4cNdmGQMkPm1CutshKMo07MTWHTyQ=; b=Wy4HJVZ8A5QabipftgesTjaJoNOAdfuD7fGQdPqKg0pSu9Y75W6mtFQ+984z3DXHlA CN0gidKTNwVn/5zxgtrzEbueZgWEnJwHke0WCRjhfmpW1H+xM0zK1OywsLw6IZKxv9zA Hj1bhca/EsXYR4BZg8NxATlq4bZss6ecv9dP4BPxl0mCVQRmeocFUGm1BD6O2alcD2WG zr1pWKjWji67fkCH4kk4Y238O1hu4hwMmFLFQB7w5U5t9PiatV9ykL67BsumWJXn6eAM PHAqTceOCoQAyjjeK/NOrMz/pbeIfN8yXaoNSHwYxSR6q1i/bpn15eeC3lq7pn24Ifbw axuw== 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=W7GA19BzjsaVlb4cNdmGQMkPm1CutshKMo07MTWHTyQ=; b=SY6gODMERAlnTlz7uL56plj8oSdK+W73NiDYzG4PPFTAlSY0hAgfZWfqQXjM3tmuuf cKdNOTweryJxnbyq66fpqyeywwtL8N60O0ax5YT2y0j/hkjDvo4soXbOuUhr0EOT4g7Q foCZON16bYLtU7sseQT+y4DWXpCZMX4Xt+J94ME1H/6E1s4AGlSbHLjBoDqUcP3CSXQn GAomQD5451Y2ZBteVRqOGKvPmrWA81hUaCSHaUecdRvtACt0Q+l1zbw+AYIwVzQnnzGC bNn9NtLBid06bC773w66Qhjgk/IFLK9AFC+l5zecNb3LAxklL50Qi3HNXM4yWt8zx3IT Al9Q== X-Gm-Message-State: AOAM533AQACCVKYDrlsW7tJBvwCL2RsgXX9oLDZPtMWSJxnsi0jDQiu7 ZQjvEpyQ7yaNLlnOKy0t94N7Oxs2f8j5Rw== X-Google-Smtp-Source: ABdhPJxl5JlSIrzt71lIAXDnKbylnJcLBEHJO3o1mvfubdBeQpaksjG8usBEQsOj9+mQObJKTv7L/A== X-Received: by 2002:a17:90a:17a5:: with SMTP id q34mr6039866pja.47.1611427830567; Sat, 23 Jan 2021 10:50:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/10] tcg: Increase the static number of temporaries Date: Sat, 23 Jan 2021 08:50:14 -1000 Message-Id: <20210123185020.1766324-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: peter.maydell@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This isn't a total or permanent solution to the problem of running out of temporaries, but it puts off the issue for a bit. Make the assert in tcg_temp_alloc unconditional. If we do run out of temps, this can fail much later as a weird SIGSEGV, due to the buffer overrun of the temp array. Remove the inlines from tcg_temp_alloc and tcg_global_alloc. Buglink: https://bugs.launchpad.net/bugs/1912065 Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 +- tcg/tcg.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index c5a9d65d5f..0187de1352 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -275,7 +275,7 @@ typedef struct TCGPool { =20 #define TCG_POOL_CHUNK_SIZE 32768 =20 -#define TCG_MAX_TEMPS 512 +#define TCG_MAX_TEMPS 1024 #define TCG_MAX_INSNS 512 =20 /* when the size of the arguments of a called function is smaller than diff --git a/tcg/tcg.c b/tcg/tcg.c index 8f8badb61c..5110f6f39c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1204,14 +1204,14 @@ void tcg_func_start(TCGContext *s) QSIMPLEQ_INIT(&s->labels); } =20 -static inline TCGTemp *tcg_temp_alloc(TCGContext *s) +static TCGTemp *tcg_temp_alloc(TCGContext *s) { int n =3D s->nb_temps++; - tcg_debug_assert(n < TCG_MAX_TEMPS); + g_assert(n < TCG_MAX_TEMPS); return memset(&s->temps[n], 0, sizeof(TCGTemp)); } =20 -static inline TCGTemp *tcg_global_alloc(TCGContext *s) +static TCGTemp *tcg_global_alloc(TCGContext *s) { TCGTemp *ts; =20 --=20 2.25.1