From: igor@9lab.org
To: 9front@9front.org
Cc: igor@9lab.org
Subject: [9front] leak(1): document how to generate pool.$objtype.acid required for leak
Date: Fri, 05 Nov 2021 00:31:36 +0100 [thread overview]
Message-ID: <2F5F9512727EBAEA4C2CB61AA5D72A7D@9lab.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2918 bytes --]
/sys/lib/acid/leak requires /sys/src/libc/port/pool.$objtype.acid
which is not present by default.
The attached patch adds an acid target to /sys/src/libc/port/mkfile
that generates pool.$objtype.acid and refers to it in leak(1).
With the right pool.$objtype.acid file present and its usage
documented, finding leaks in programs works. Here some leaks
present in acme (NOTE how one can use the `src(addr)` printed
by leak in an acid session to print to source of leak with
some context):
% leak -s acme|rc
src(0x0020db61); // 18
src(0x0020db82); // 18
src(0x0020db95); // 18
src(0x0020dbc3); // 18
src(0x0020dbde); // 18
src(0x0020de5f); // 17
src(0x0020db70); // 17
src(0x0020ebbc); // 7
src(0x0020ebcb); // 7
src(0x0020ec39); // 7
src(0x0020ec1e); // 6
src(0x0020ebdd); // 5
src(0x0020ebf0); // 5
src(0x00221607); // 5
src(0x0022578c); // 5
src(0x002000cb); // 1
term% acid 1179
/proc/1179/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: src(0x0020db61)
/sys/src/cmd/acme/exec.c:343
338 return;
339 if(flag1 || et->w->body.file->ntext>1 || winclean(et->w, FALSE)){
340 w = et->w;
341 name = getname(&w->body, argt, arg, narg, TRUE);
342 if(name && plumbsendfd >= 0){
>343 pm = emalloc(sizeof(Plumbmsg));
344 pm->src = estrdup("acme");
345 pm->dst = estrdup("close");
346 pm->wdir = estrdup(name);
347 if(p = strrchr(pm->wdir, '/'))
348 *p = '\0';
acid:
Looks like there are some small leaks in acme ☺.
<snip>
From: Igor Böhm <igor@9lab.org>
Date: Thu, 04 Nov 2021 23:11:56 +0000
Subject: [PATCH] leak: document how to generate pool.$objtype.acid
/sys/lib/acid/leak requires /sys/src/libc/port/pool.$objtype.acid
which is not present by default.
Add acid target to /sys/src/libc/port/mkfile that generates
pool.$objtype.acid and refer to it in leak(1).
---
diff ca73f673473457152d6f1b2e9030495f8dec5c49 2c38083b6c34c72b5417f29dc6002aa445212ae5
--- a/sys/man/1/leak Mon Nov 1 18:07:28 2021
+++ b/sys/man/1/leak Fri Nov 5 00:11:56 2021
@@ -218,7 +218,17 @@
.I kmem
depend on the internal structure of the
libc pool memory allocator (see
-.IR pool (2)).
+.IR pool (2))
+and require
+.B /sys/src/libc/port/pool.$objtype.acid
+to be present and generated from
+.BR pool.c
+as follows:
+.IP
+.EX
+% cd /sys/src/libc/port && mk acid
+.EE
+.PP
Since the ANSI/POSIX environment uses a different
allocator,
.I leak
@@ -228,8 +238,5 @@
is not speedy, and
.I acidleak
can consume more memory than the process(es) being examined.
-.PP
-These commands require
-.B /sys/src/libc/port/pool.acid
-to be present and generated from
-.BR pool.c .
+
+
--- a/sys/src/libc/port/mkfile Mon Nov 1 18:07:28 2021
+++ b/sys/src/libc/port/mkfile Fri Nov 5 00:11:56 2021
@@ -127,3 +127,6 @@
</sys/src/cmd/mksyslib
profile.$O: /sys/include/tos.h
+
+acid:V:
+ $CC -a -w pool.c > pool.$objtype.acid
</snap>
Cheers,
Igor
[-- Attachment #2: leak.patch --]
[-- Type: text/plain, Size: 1378 bytes --]
From: Igor Böhm <igor@9lab.org>
Date: Thu, 04 Nov 2021 23:11:56 +0000
Subject: [PATCH] leak: document how to generate pool.$objtype.acid
/sys/lib/acid/leak requires /sys/src/libc/port/pool.$objtype.acid
which is not present by default.
Add acid target to /sys/src/libc/port/mkfile that generates
pool.$objtype.acid and refer to it in leak(1).
---
diff ca73f673473457152d6f1b2e9030495f8dec5c49 2c38083b6c34c72b5417f29dc6002aa445212ae5
--- a/sys/man/1/leak Mon Nov 1 18:07:28 2021
+++ b/sys/man/1/leak Fri Nov 5 00:11:56 2021
@@ -218,7 +218,17 @@
.I kmem
depend on the internal structure of the
libc pool memory allocator (see
-.IR pool (2)).
+.IR pool (2))
+and require
+.B /sys/src/libc/port/pool.$objtype.acid
+to be present and generated from
+.BR pool.c
+as follows:
+.IP
+.EX
+% cd /sys/src/libc/port && mk acid
+.EE
+.PP
Since the ANSI/POSIX environment uses a different
allocator,
.I leak
@@ -228,8 +238,5 @@
is not speedy, and
.I acidleak
can consume more memory than the process(es) being examined.
-.PP
-These commands require
-.B /sys/src/libc/port/pool.acid
-to be present and generated from
-.BR pool.c .
+
+
--- a/sys/src/libc/port/mkfile Mon Nov 1 18:07:28 2021
+++ b/sys/src/libc/port/mkfile Fri Nov 5 00:11:56 2021
@@ -127,3 +127,6 @@
</sys/src/cmd/mksyslib
profile.$O: /sys/include/tos.h
+
+acid:V:
+ $CC -a -w pool.c > pool.$objtype.acid
next reply other threads:[~2021-11-05 2:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 23:31 igor [this message]
2021-11-05 7:45 ` Humm
2021-11-05 9:25 ` igor
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=2F5F9512727EBAEA4C2CB61AA5D72A7D@9lab.org \
--to=igor@9lab.org \
--cc=9front@9front.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;
as well as URLs for NNTP newsgroup(s).