From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 5/5] tlsf: panic in asserts if CONFIG_BUG_ON_DATA_CORRUPTION=y
Date: Mon, 2 Dec 2024 09:18:15 +0100 [thread overview]
Message-ID: <20241202081815.3475994-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241202081815.3475994-1-a.fatoum@pengutronix.de>
We currently consult CONFIG_BUG_ON_DATA_CORRUPTION=y only in linked list
code, but we should really do it everywhere, where we detect data
corruption.
We have some assertions in the TLSF code, so let's panic if the user has
configured that this happens.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/tlsf.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/tlsf.h b/include/tlsf.h
index 3fa220371577..2f82d0fa005b 100644
--- a/include/tlsf.h
+++ b/include/tlsf.h
@@ -43,10 +43,12 @@ extern "C" {
#endif
#include <printk.h>
+#include <linux/bug.h>
#define tlsf_assert(expr) do { \
if (unlikely(!(expr))) { \
printf(#expr "%s %d\n", __FILE__, __LINE__); \
+ BUG_ON(IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)); \
dump_stack(); \
} \
} while (0)
--
2.39.5
next prev parent reply other threads:[~2024-12-02 8:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 8:18 [PATCH v2 0/5] malloc: add options to zero-initialize buffers Ahmad Fatoum
2024-12-02 8:18 ` [PATCH v2 1/5] dlmalloc: add aliases with dl as prefix Ahmad Fatoum
2024-12-02 8:18 ` [PATCH v2 2/5] hardening: support zeroing all malloc buffers by default Ahmad Fatoum
2024-12-02 8:18 ` [PATCH v2 3/5] hardening: support initializing stack variables " Ahmad Fatoum
2024-12-02 8:18 ` [PATCH v2 4/5] hardening: support register zeroing on function exit Ahmad Fatoum
2024-12-02 8:18 ` Ahmad Fatoum [this message]
2024-12-02 11:09 ` [PATCH v2 0/5] malloc: add options to zero-initialize buffers Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241202081815.3475994-6-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox