From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 4400 invoked from network); 5 Nov 2021 02:38:31 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 5 Nov 2021 02:38:31 -0000 Received: from mail.9lab.org ([168.119.8.41]) by 4ess; Thu Nov 4 19:41:11 -0400 2021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9lab.org; s=20210803; t=1636068698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=kp4va+ZKahLZ0xVYf8dQbv21B6SF8EhZ3SlS7PXjJB8=; b=M0P7xiWyhmipcPucJ8Qx6GUl2/dpb9fCW0gGPsl7RyNEG7sN/0ty8UjIm0SviDGpAa2Ppq Zicm4qQY1j3ZMZyKlzSa2sju6iQUaKLChWMAhLMld+CVyGHf7JlUYUE+Hsq3bu2s/rrM3Y mJjq4sEcM2D5pd2WmttXQh3EPwekl+M= Received: from ken.9lab.home (host-185-64-155-70.ecsnet.at [185.64.155.70]) by mail.9lab.org (OpenSMTPD) with ESMTPSA id c785a6c1 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Fri, 5 Nov 2021 00:31:38 +0100 (CET) Message-ID: <2F5F9512727EBAEA4C2CB61AA5D72A7D@9lab.org> To: 9front@9front.org CC: igor@9lab.org Date: Fri, 05 Nov 2021 00:31:36 +0100 From: igor@9lab.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-ujujmnwfowtsqnlmztaiagtalq" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: mobile module storage GPU-scale backend Subject: [9front] leak(1): document how to generate pool.$objtype.acid required for leak Reply-To: 9front@9front.org Precedence: bulk This is a multi-part message in MIME format. --upas-ujujmnwfowtsqnlmztaiagtalq Content-Disposition: inline Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit /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 ☺. From: Igor Böhm 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 @@ pool.$objtype.acid Cheers, Igor --upas-ujujmnwfowtsqnlmztaiagtalq Content-Disposition: attachment; filename=leak.patch Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit From: Igor Böhm 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 @@ pool.$objtype.acid --upas-ujujmnwfowtsqnlmztaiagtalq--