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 0/9] mcheck implementation for U-Boot
Date: Sun, 31 Mar 2024 23:03:18 +0300 [thread overview]
Message-ID: <20240331200327.29141-1-eugeneuriev@gmail.com> (raw)
There was no "mcheck" for U-Boot before.
Since U-Boot has only 1 thread, and normally makes 4000+ - 6000+
mallocs, it's better to use havier canaries to protect heap-chunks.
My variant uses 2x8 = 16byte-long protector. And
the multiplier could be changed to tune speed/protection tradeoff.
This protects not only against memset()-s, but against "near" wild
pointers too, and makes more probable to catch "distant" ones.
The core file of the set is included into the C-file, not complied
separately in order to enable (potential) coexisting of
mcheck-protectors, e.g. malloc_simple(.) and dlmalloc simultaneously.
My tests were for ARM SoC, 64bit, so the patch is
aware of alignment.
Primary this patch is for using by developers: to verify,
if a change doesn't break the heap integrity.
By default the mcheck is disabled and wouldn't affect the boot.
I used pedantic mode, canary=16byte, registry-size=6608.
For my system the overhead was 230ms.
I assume, the merge window coming. So I send it now.
Eugene Uriev (9):
mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands
mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for
mcheck.
mcheck: introduce essentials of mcheck
mcheck: integrate mcheck into dlmalloc.c
mcheck: support memalign
mcheck: add pedantic mode support
mcheck: introduce mcheck_on_ramrelocation(.)
mcheck: add stats, add a comment with test results
mcheck: let mcheck_abortfunc_t print the pointer
common/board_f.c | 4 +
common/dlmalloc.c | 154 ++++++++++++++++----
common/mcheck_core.inc.h | 304 +++++++++++++++++++++++++++++++++++++++
include/mcheck.h | 51 +++++++
4 files changed, 488 insertions(+), 25 deletions(-)
create mode 100644 common/mcheck_core.inc.h
create mode 100644 include/mcheck.h
--
2.25.1
next reply other threads:[~2024-03-31 21:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-31 20:03 Eugene Uriev [this message]
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 ` [PATCH 9/9] mcheck: let mcheck_abortfunc_t print the pointer Eugene Uriev
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-1-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