From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
Ahmad Fatoum <a.fatoum@barebox.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] sandbox: add memory leak debugging tooling around LeakSanitizer
Date: Tue, 28 Oct 2025 08:59:05 +0100 [thread overview]
Message-ID: <ada2cb2b-e08a-4d02-bb04-15750352836f@pengutronix.de> (raw)
In-Reply-To: <aQB3hThqS9P0wHuX@pengutronix.de>
Hi Sascha,
On 10/28/25 8:57 AM, Sascha Hauer wrote:
> On Mon, Oct 27, 2025 at 08:44:45AM +0100, Ahmad Fatoum wrote:
>> When enabled, this allows calling barebox_memleak_check() or running the
>> checkleak command to instruct LeakSanitizer to sweep the memory and find
>> unreferenced allocations.
>>
>> LeakSanitizier is also enabled along AddressSanitizer and runs on AMD64
>> Linux automatically on exit already.
>>
>> +static int do_checkleak(int argc, char *argv[])
>> +{
>> + unsigned int count;
>> + int opt;
>> +
>> + while((opt = getopt(argc, argv, "l:")) > 0) {
>> + switch(opt) {
>> + case 'l':
>> + if (kstrtouint(optarg, 0, &count))
>> + return COMMAND_ERROR;
>> + (void)malloc(count);
>> + break;
>> + default:
>> + return COMMAND_ERROR_USAGE;
>> + }
>> + }
>> +
>> + argv += optind;
>> + argc -= optind;
>> +
>> + if (argc)
>> + return COMMAND_ERROR_USAGE;
>> +
>> + memleak_check();
>
> barebox exits in this call. Is this intended?
Until I figure out how to suppress it, yes, unfortunately. Haven't dug
into the source code yet.
On the bright side my talloc series removes the long standing leak in
hush, so it's less of a bother. :D
Cheers,
Ahmad
>
> Sascha
>
--
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 |
next prev parent reply other threads:[~2025-10-28 7:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 7:44 Ahmad Fatoum
2025-10-28 7:57 ` Sascha Hauer
2025-10-28 7:59 ` Ahmad Fatoum [this message]
2025-10-28 8:15 ` 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=ada2cb2b-e08a-4d02-bb04-15750352836f@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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