| Message ID | 20260103200510.3605009-18-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767470799; bh=3oC5El3ls9jbTgxC8Z0pDdtriv2TKiwel0nfyfUQvdM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fUi8qpad1tTr0HAiI0rPr1UySWWRmCrcMVjZRKPcwd+2aaePslpkmPnFpCQyl1pu6 J+HKBUbdT5lTEFop7PTfffeLFS5TvIB5DZVVyTAxAnp64wipIeNXMZSgxG8TM9z+Xa Wxakeg+2REEPywJilCMIstf6Wa9qkK1sTyKkefEpm4EjiO3NQWUZftCxUKGW0Lq2Vb ICoi6AvMDLG2dcFE3sjraQZgQq55GXXh+LWpNuvDp4elbwa3lrTcrlRDgwiBHoG4mq AAN6h/rjmK4JqjRWUUXSzhW2KzSOqCZi/W1x6jADqsRhY9cqgIkX4vbXcMcpmoeLRl jckAZGgNfXoeg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9566F69097 for <u-boot-concept@u-boot.org>; Sat, 3 Jan 2026 13:06:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id WLL9xnVwFim3 for <u-boot-concept@u-boot.org>; Sat, 3 Jan 2026 13:06:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767470799; bh=3oC5El3ls9jbTgxC8Z0pDdtriv2TKiwel0nfyfUQvdM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fUi8qpad1tTr0HAiI0rPr1UySWWRmCrcMVjZRKPcwd+2aaePslpkmPnFpCQyl1pu6 J+HKBUbdT5lTEFop7PTfffeLFS5TvIB5DZVVyTAxAnp64wipIeNXMZSgxG8TM9z+Xa Wxakeg+2REEPywJilCMIstf6Wa9qkK1sTyKkefEpm4EjiO3NQWUZftCxUKGW0Lq2Vb ICoi6AvMDLG2dcFE3sjraQZgQq55GXXh+LWpNuvDp4elbwa3lrTcrlRDgwiBHoG4mq AAN6h/rjmK4JqjRWUUXSzhW2KzSOqCZi/W1x6jADqsRhY9cqgIkX4vbXcMcpmoeLRl jckAZGgNfXoeg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 85A286907B for <u-boot-concept@u-boot.org>; Sat, 3 Jan 2026 13:06:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767470797; bh=xpjDevNEIhV9PV/ykmb/IdJ7QyJS6u4qXEPNKGSVwxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m46Y52RDaK5MvMfCVDPeYALXtft1TQQR78l89qDuFnYUg4V64C4oP3ayDRIGP2dU/ qtC/dX8FgduCTZFHoFhCHSwgfSB2923ODNY7UzWa6HE5gdIs2DjWNbQxHGtThU0tKw AI6AnTEQqAHUFxOFDs8J8V3QEhflqwIwcpKb3t0DK6SoXjCfzmK++96vuyInXVXvlS 8Vw2+czUM/Ddwp6lFVhC4iC+AR5AzgCCDTA8YKy3DDt+MK7qzKIdfFthS5bD6EAJUI QeHvWeAnwIzkuE2mcJJfXecOOk6gmtmCaOgFOMLQDDUqt9lbdDb3cuH2B3bfaDPJtc 3w5JhKHDuHR2Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AF18B6907B; Sat, 3 Jan 2026 13:06:37 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id rsNNfZjD8oKW; Sat, 3 Jan 2026 13:06:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767470793; bh=S1/RZn1tbMAeqPrKCkg1fdvxKpSrF05LnaFzNH/j5+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6HhIDgz1SPZbdwDsZDCq5O1/ubTbv958BYUpt4isq16zoxCS5vers7WKKKfSQyDp 2AmuTb4La83fqbBOYw9Jr8GySBHEshN4Kdu7IIfTO7Z2qBOPwmrbICCyrvZ6B3qxUv +3VGa2e0VxPeiyIJj5ZvOlFljq41cLyBSiDGNBY3PS7WSB+H4GNk2EDTyepHigSjhC KXVr91E0Ax1cEmgQMAGw3WwlZkiuAXSguv3GfV1IOQJVHHveP0BstwOO5H908+8gfj 2I0IsubGabfCEgy20pFZPN+5N0fKLMZDh2oSOYa+7sBHQBiBlL0lAtZsYmHRRvj+fj +FEXej3WLFlOg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 55C6368FCC; Sat, 3 Jan 2026 13:06:33 -0700 (MST) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Sat, 3 Jan 2026 13:04:48 -0700 Message-ID: <20260103200510.3605009-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260103200510.3605009-1-sjg@u-boot.org> References: <20260103200510.3605009-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JK6FDJ3F55GOWUAJTEE3NLDKZYEYJZCZ X-Message-ID-Hash: JK6FDJ3F55GOWUAJTEE3NLDKZYEYJZCZ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt <xypron.glpk@gmx.de>, Simon Glass <simon.glass@canonical.com>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 17/29] test: malloc: Account for mcheck overhead in the large test List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/JK6FDJ3F55GOWUAJTEE3NLDKZYEYJZCZ/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
Malloc debugging and test/py improvements
|
|
Commit Message
Simon Glass
Jan. 3, 2026, 8:04 p.m. UTC
From: Simon Glass <simon.glass@canonical.com> The malloc_very_large() test fails when mcheck is enabled with large CONFIG_MCHECK_CALLER_LEN because the 64K margin does not account for the per-allocation overhead (header + canaries). Use a larger margin (256K) when mcheck is enabled to ensure the test passes regardless of the mcheck caller length setting. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- (no changes since v1) test/common/malloc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/common/malloc.c b/test/common/malloc.c index 9fdc1789645..436aac503be 100644 --- a/test/common/malloc.c +++ b/test/common/malloc.c @@ -535,11 +535,21 @@ COMMON_TEST(common_test_mallinfo, 0); /* Test allocating a very large size */ static int common_test_malloc_very_large(struct unit_test_state *uts) { - size_t size, before; + size_t size, before, margin; void *ptr; before = get_alloced_size(); - size = TOTAL_MALLOC_LEN - before - SZ_64K; + + /* + * When mcheck is enabled, it adds overhead per allocation (header + + * canaries). With large CONFIG_MCHECK_CALLER_LEN, this can be + * significant. Use a larger margin to account for mcheck overhead. + */ + if (CONFIG_IS_ENABLED(MCHECK_HEAP_PROTECTION)) + margin = SZ_256K; + else + margin = SZ_64K; + size = TOTAL_MALLOC_LEN - before - margin; ptr = malloc(size); ut_assertnonnull(ptr);