[PATCH] dlmalloc: remove in favor of TLSF
Sascha Hauer
s.hauer at pengutronix.de
Mon Jun 16 23:56:49 PDT 2025
On Mon, Jun 16, 2025 at 03:04:30PM +0200, Ahmad Fatoum wrote:
> We have had a TLSF implementation in barebox for >= 13 years now and it
> has more features than the dlmalloc, which we inherited from U-Boot,
> like multiple pools and KASAN integration.
>
> We didn't have pressure to retire dlmalloc in that time, but bugs like
> those fixed in commit 7cf25e0733f0 ("dlmalloc: Fix integer overflow in
> request2size()") show that there's a security cost associated with
> keeping bitrotted code, especially as we didn't document TLSF as being
> the recommended allocator anywhere.
>
> Since then, TLSF has been been made the default allocator in Kconfig[1]
> and dlmalloc deprecation was announced[2]. Follow through now and drop
> dlmalloc altogether.
>
> [1]: Commit c1552409af30 ("common: make TLSF the default allocator")
> [2]: https://lore.barebox.org/barebox/7a4edaef-a606-4b9d-bdf5-c7b5f896daae@pengutronix.de/
>
> Cc: Antony Pavlov <antonynpavlov at gmail.com>
> Cc: Richard Weinberger <richard at nod.at>
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> .../migration-guides/migration-2025.07.0.rst | 5 +
> common/Kconfig | 3 -
> common/Makefile | 1 -
> common/dlmalloc.c | 1976 -----------------
> include/dlmalloc.h | 15 -
> 5 files changed, 5 insertions(+), 1995 deletions(-)
> delete mode 100644 common/dlmalloc.c
> delete mode 100644 include/dlmalloc.h
With this INTERNAL_SIZE_T becomes unused. Merged the following into
this commit
-------------------------8<-----------------------------
>From 5e436f98aba7dd371856acb41e34a2d4507016fe Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer at pengutronix.de>
Date: Tue, 17 Jun 2025 08:54:08 +0200
Subject: [PATCH] fixup! dlmalloc: remove in favor of TLSF
---
arch/riscv/include/asm/types.h | 8 --------
arch/x86/include/asm/types.h | 13 -------------
2 files changed, 21 deletions(-)
diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h
index add1c94fc7..f89733dcc4 100644
--- a/arch/riscv/include/asm/types.h
+++ b/arch/riscv/include/asm/types.h
@@ -5,12 +5,4 @@
#include <asm-generic/int-ll64.h>
-#if __riscv_xlen == 64
-/*
- * This is used in dlmalloc. On RISCV64 we need it to be 64 bit
- */
-#define INTERNAL_SIZE_T unsigned long
-
-#endif
-
#endif /* __ASM_RISCV_TYPES_H */
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index feb5843b9c..87813325f1 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -5,17 +5,4 @@
#include <asm-generic/int-ll64.h>
-#ifndef __ASSEMBLY__
-
-#ifdef __x86_64__
-/*
- * This is used in dlmalloc. On X86_64 we need it to be
- * 64 bit
- */
-#define INTERNAL_SIZE_T unsigned long
-
-#endif
-
-#endif
-
#endif
--
2.39.5
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list