| Message ID | 20251201170529.3237986-26-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=1764608961; bh=0Snx27rfuO93+mb3eHb+BT+n19dt1Xj4iuIRzbcdhLo=; 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=JkTu98U1svHV7IT75j3uVp0HFsj/cOV78hxjgYj2OFpZzIdoyGiNCsNEN1/GnDvkn cTKj4VW/hih5486/CwU0tO8G3WIXLRwhjP0ZG9cGwwckRI7RcKOr+KEkJ7JZLWV2oY Fpulv2Wc29YcObErNLmP9iq02Vmnq0+Ubfm+MI/NGX0JwX3xOy8nIgeD4uQ9XKb/1a XjlIVlp1GXcVgsZ39xjX604t25aIesKJMefxsB1PFhRR3gDvlmg3YEA6w4xvukfXd1 l55u2jE2pG2jBOAdtZ2LcfWCs3MngsDnVTu3xUbxi5lRS2vUf5BrXJhPXzx5Wi7zZn apZopg3SwTmXA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C388A688DD for <u-boot-concept@u-boot.org>; Mon, 1 Dec 2025 10:09:21 -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 0auj3vdLYI6R for <u-boot-concept@u-boot.org>; Mon, 1 Dec 2025 10:09:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608961; bh=0Snx27rfuO93+mb3eHb+BT+n19dt1Xj4iuIRzbcdhLo=; 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=JkTu98U1svHV7IT75j3uVp0HFsj/cOV78hxjgYj2OFpZzIdoyGiNCsNEN1/GnDvkn cTKj4VW/hih5486/CwU0tO8G3WIXLRwhjP0ZG9cGwwckRI7RcKOr+KEkJ7JZLWV2oY Fpulv2Wc29YcObErNLmP9iq02Vmnq0+Ubfm+MI/NGX0JwX3xOy8nIgeD4uQ9XKb/1a XjlIVlp1GXcVgsZ39xjX604t25aIesKJMefxsB1PFhRR3gDvlmg3YEA6w4xvukfXd1 l55u2jE2pG2jBOAdtZ2LcfWCs3MngsDnVTu3xUbxi5lRS2vUf5BrXJhPXzx5Wi7zZn apZopg3SwTmXA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B1C8968821 for <u-boot-concept@u-boot.org>; Mon, 1 Dec 2025 10:09:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608959; bh=tNPTa7+KmWfWOAiQ2beic9xECVZRGwyw5y1WE4Pce4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJch64uNNO7wr3ZpCym0JQcNau2b6bHqu51D67xSxue45EDGkG988ARu0fK19I75e LQiX5ndK2TIWwcj2PPwUQxvvW7Iwle1r3hrisF9a4POibp9xqAQqy/WFqbJpCWixhx GazMQDZHiC6vvD2EwpnvLPmB0GvmIsmkbhkzEWYfiaxAnzuGSzu+y7Y7O/FqXO1Ex4 hQtxz8jh6DB7PMxw63RgovvcfxtbGdnajjXfnagcoVTfuOqTaPZ/6ucWgFy8LL16Di VJVomaFstDCTrLNh4ZTyKFhOdr7rOqsXIYO2ocmQTTjD7P2LWjW7yvYS8UV2tWeLgz V5XsDpCms8aKg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8D96E688AE; Mon, 1 Dec 2025 10:09:19 -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 1uqXeWTbtz-y; Mon, 1 Dec 2025 10:09:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608957; bh=8HHE2ieRyZ/jh0p/oVVpw43Oz1ja/zlFxSORp89sPjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tEh6DfBfDFvTJ0Br7YrJdZvvgY3MGsTLSxrVRTSWxkQ1H9Hqw+A0vNiI6FyyDg6YG sThDArytqt7x0Ksa7P8xU+cu+j+ZUAXhNqENYHdDkBa+irUoOrq36y6d1nwcqg0ivB GL5Yn1xpGnNF4z03/VH2WjhSXs+jEYAFbvS8pTvm5KthEfXbLERA0ZmS0bKzZu/DiU o460xlGdKpA0ziPE+39TKEVrd7Tp4gtmsgsJtdzr4wMO8yRZoW9XKHYfdHooiG7gTH 9ClLeJ7Kt61OExABwfGerN8mGpLcgB75x3jhBWWCCUJ4J8oPWniCLl+J1iXeHPCg6q DXFSiqnp4kvdA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 73BAF688CB; Mon, 1 Dec 2025 10:09:17 -0700 (MST) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Mon, 1 Dec 2025 10:05:04 -0700 Message-ID: <20251201170529.3237986-26-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251201170529.3237986-1-sjg@u-boot.org> References: <20251201170529.3237986-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SKC5JJFBWFHK5K4RHTILJTI7H35IHVAM X-Message-ID-Hash: SKC5JJFBWFHK5K4RHTILJTI7H35IHVAM 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>, Eugene Uriev <eugeneuriev@gmail.com>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 25/37] mcheck: support memalign 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/SKC5JJFBWFHK5K4RHTILJTI7H35IHVAM/> 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: Import dlmalloc 2.8.6
|
|
Commit Message
Simon Glass
Dec. 1, 2025, 5:05 p.m. UTC
From: Simon Glass <simon.glass@canonical.com> Implement the dlmemalign wrapper function for mcheck heap protection. Uses mcheck_memalign_prehook() and mcheck_memalign_posthook() to properly handle aligned allocations. Changes from original commit: - Uses dlmemalign/dlmemalign_impl instead of mEMALIGn/mEMALIGn_impl Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com> Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> (cherry picked from commit ae838768d79cbb834c4a8a5f4810df373e58b622) --- common/dlmalloc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 102b6c2bf8d..c9eb18787e8 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -5628,7 +5628,12 @@ void *dlrealloc(void *oldmem, size_t bytes) void *dlmemalign(size_t alignment, size_t bytes) { - return NULL; + size_t fullsz = mcheck_memalign_prehook(alignment, bytes); + void *p = dlmemalign_impl(alignment, fullsz); + + if (!p) + return p; + return mcheck_memalign_posthook(alignment, p, bytes); } /* dlpvalloc, dlvalloc redirect to dlmemalign, so they need no wrapping */