From: Eugene Uriev <eugeneuriev@gmail.com>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, Eugene Uriev <eugeneuriev@gmail.com>
Subject: [PATCH 9/9] mcheck: let mcheck_abortfunc_t print the pointer
Date: Sun, 31 Mar 2024 23:03:27 +0300 [thread overview]
Message-ID: <20240331200327.29141-10-eugeneuriev@gmail.com> (raw)
In-Reply-To: <20240331200327.29141-1-eugeneuriev@gmail.com>
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
---
common/mcheck_core.inc.h | 16 ++++++++--------
include/mcheck.h | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/common/mcheck_core.inc.h b/common/mcheck_core.inc.h
index 2f11ac567f..6902140992 100644
--- a/common/mcheck_core.inc.h
+++ b/common/mcheck_core.inc.h
@@ -90,7 +90,7 @@ struct mcheck_hdr {
mcheck_canary canary; /* Magic number to check header integrity. */
};
-static void mcheck_default_abort(enum mcheck_status status)
+static void mcheck_default_abort(enum mcheck_status status, const void *p)
{
const char *msg;
@@ -111,7 +111,7 @@ static void mcheck_default_abort(enum mcheck_status status)
msg = "bogus mcheck_status, library is buggy\n";
break;
}
- printf("\n\nmcheck: %s!!! [%zu]\n\n", msg, mcheck_chunk_count_max);
+ printf("\n\nmcheck: %p:%s!!! [%zu]\n\n", p, msg, mcheck_chunk_count_max);
}
static mcheck_abortfunc_t mcheck_abortfunc = &mcheck_default_abort;
@@ -124,9 +124,9 @@ static inline size_t allign_size_up(size_t sz, size_t grain)
#define mcheck_allign_customer_size(SZ) allign_size_up(SZ, sizeof(mcheck_elem))
#define mcheck_evaluate_memalign_prefix_size(ALIGN) allign_size_up(sizeof(struct mcheck_hdr), ALIGN)
-static enum mcheck_status mcheck_OnNok(enum mcheck_status status)
+static enum mcheck_status mcheck_OnNok(enum mcheck_status status, const void *p)
{
- (*mcheck_abortfunc)(status);
+ (*mcheck_abortfunc)(status, p);
return status;
}
@@ -136,11 +136,11 @@ static enum mcheck_status mcheck_checkhdr(const struct mcheck_hdr *hdr)
for (i = 0; i < CANARY_DEPTH; ++i)
if (hdr->canary.elems[i] == MAGICFREE)
- return mcheck_OnNok(MCHECK_FREE);
+ return mcheck_OnNok(MCHECK_FREE, hdr + 1);
for (i = 0; i < CANARY_DEPTH; ++i)
if (hdr->canary.elems[i] != MAGICWORD)
- return mcheck_OnNok(MCHECK_HEAD);
+ return mcheck_OnNok(MCHECK_HEAD, hdr + 1);
const size_t payload_size = hdr->size;
const size_t payload_size_aligned = mcheck_allign_customer_size(payload_size);
@@ -150,13 +150,13 @@ static enum mcheck_status mcheck_checkhdr(const struct mcheck_hdr *hdr)
for (i = 0; i < padd_size; ++i)
if (payload[payload_size + i] != PADDINGFLOOD)
- return mcheck_OnNok(MCHECK_TAIL);
+ return mcheck_OnNok(MCHECK_TAIL, hdr + 1);
const mcheck_canary *tail = (const mcheck_canary *)&payload[payload_size_aligned];
for (i = 0; i < CANARY_DEPTH; ++i)
if (tail->elems[i] != MAGICTAIL)
- return mcheck_OnNok(MCHECK_TAIL);
+ return mcheck_OnNok(MCHECK_TAIL, hdr + 1);
return MCHECK_OK;
}
diff --git a/include/mcheck.h b/include/mcheck.h
index f4c9b7e61c..bd506ae629 100644
--- a/include/mcheck.h
+++ b/include/mcheck.h
@@ -29,7 +29,7 @@ enum mcheck_status {
MCHECK_TAIL /* Memory after the block was clobbered. */
};
-typedef void (*mcheck_abortfunc_t)(enum mcheck_status);
+typedef void (*mcheck_abortfunc_t)(enum mcheck_status, const void *p);
int mcheck(mcheck_abortfunc_t func);
--
2.25.1
next prev parent reply other threads:[~2024-03-31 21:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-31 20:03 [PATCH 0/9] mcheck implementation for U-Boot Eugene Uriev
2024-03-31 20:03 ` [PATCH 1/9] mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands Eugene Uriev
2024-03-31 20:03 ` [PATCH 2/9] mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck Eugene Uriev
2024-03-31 20:03 ` [PATCH 3/9] mcheck: introduce essentials of mcheck Eugene Uriev
2024-03-31 20:03 ` [PATCH 4/9] mcheck: integrate mcheck into dlmalloc.c Eugene Uriev
2024-03-31 20:03 ` [PATCH 5/9] mcheck: support memalign Eugene Uriev
2024-03-31 20:03 ` [PATCH 6/9] mcheck: add pedantic mode support Eugene Uriev
2024-03-31 20:03 ` [PATCH 7/9] mcheck: introduce mcheck_on_ramrelocation(.) Eugene Uriev
2024-03-31 20:03 ` [PATCH 8/9] mcheck: add stats, add a comment with test results Eugene Uriev
2024-03-31 20:03 ` Eugene Uriev [this message]
2024-04-13 16:18 ` [PATCH 0/9] mcheck implementation for U-Boot Tom Rini
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=20240331200327.29141-10-eugeneuriev@gmail.com \
--to=eugeneuriev@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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