From: Paul Bolle <pebolle@tiscali.nl>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Karsten Keil <isdn@linux-pingi.de>,
"David S. Miller" <davem@davemloft.net>,
gigaset307x-common@lists.sourceforge.net,
netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>,
Kostya Serebryany <kcc@google.com>,
Alexander Potapenko <glider@google.com>,
Sasha Levin <sasha.levin@oracle.com>
Subject: Re: gigaset: memory leak in gigaset_initcshw
Date: Thu, 04 Feb 2016 14:09:49 +0100 [thread overview]
Message-ID: <1454591389.14366.49.camel@tiscali.nl> (raw)
In-Reply-To: <CACT4Y+aDi8L_GELzVv7QM8YdtMD7q-wH4uO7LhioeSvaEU5PJg@mail.gmail.com>
On do, 2016-02-04 at 11:40 +0100, Dmitry Vyukov wrote:
> Forgot to mention that you need to run it in a parallel loop, sorry.
I see.
> This one should do:
>
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <pthread.h>
> #include <stdint.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/syscall.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/wait.h>
>
> void work()
> {
> long r[7];
> memset(r, -1, sizeof(r));
> r[0] = syscall(SYS_mmap, 0x20000000ul, 0x10000ul, 0x3ul, 0x32ul,
> 0xfffffffffffffffful, 0x0ul);
> r[2] = syscall(SYS_open, "/dev/ptmx", 0x8002ul, 0x0ul, 0, 0, 0);
> *(uint32_t*)0x20002b1e = (uint32_t)0x10;
> r[4] = syscall(SYS_ioctl, r[2], 0x5423ul, 0x20002b1eul, 0, 0, 0);
> *(uint32_t*)0x20009000 = (uint32_t)0x7;
> r[6] = syscall(SYS_ioctl, r[2], 0x5423ul, 0x20009000ul, 0, 0, 0);
> }
>
> int main() {
> int running, status;
(gcc complained about "running" being used uninitialized, though a few
mock runs suggest it got initialized to 0 anyhow. I initialized
"running" to 0 explicitly for the real runs.)
> for (;;) {
> while (running < 32) {
> if (fork() == 0) {
> work();
> exit(0);
> }
> running++;
> }
> if (wait(&status) > 0)
> running--;
> }
> }
(Note to self: this hammers my laptop with about 2.000 runs per second.
After some time systemd's logging appears to have trouble handling the
output this reproducer generates, so maybe messages end up getting
dropped.)
> While running it, sample/proc/slabinfo with:
>
> # cat /proc/slabinfo | egrep "^kmalloc-2048"
>
> It constantly grows.
I don't really know how /proc/slabinfo should be interpreted, sorry. But
the interesting fields appear to be "<active_objs>" and "<num_objs>".
"<num_objs>" seems to be stable here (during the runs of a few minutes
that I dare to inflict on my laptop). "<active_objs>" is more volatile.
But I also saw it going down while the reproducer was running.
What are you seeing here?
Thanks,
Paul Bolle
next prev parent reply other threads:[~2016-02-04 13:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 15:31 gigaset: memory leak in gigaset_initcshw Dmitry Vyukov
2016-02-03 16:16 ` Paul Bolle
2016-02-03 19:11 ` Paul Bolle
2016-02-04 10:40 ` Dmitry Vyukov
2016-02-04 13:09 ` Paul Bolle [this message]
2016-02-04 13:15 ` Dmitry Vyukov
2016-02-04 13:46 ` Paul Bolle
2016-02-04 14:54 ` Dmitry Vyukov
2016-02-04 15:06 ` Paul Bolle
2016-02-05 13:28 ` Dmitry Vyukov
2016-02-05 16:06 ` Paul Bolle
2016-02-05 18:36 ` Paul Bolle
2016-02-05 21:25 ` Dmitry Vyukov
2016-02-11 22:34 ` Paul Bolle
2016-02-11 22:54 ` Paul Bolle
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=1454591389.14366.49.camel@tiscali.nl \
--to=pebolle@tiscali.nl \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=gigaset307x-common@lists.sourceforge.net \
--cc=glider@google.com \
--cc=isdn@linux-pingi.de \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sasha.levin@oracle.com \
--cc=syzkaller@googlegroups.com \
/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).