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@vger.kernel.org,
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: Wed, 03 Feb 2016 17:16:29 +0100 [thread overview]
Message-ID: <1454516189.14366.8.camel@tiscali.nl> (raw)
In-Reply-To: <CACT4Y+Y+P7-pM0D4HTz4ZF6i+Rya22eOkPdnrv_OmDCMB7eQtg@mail.gmail.com>
On wo, 2016-02-03 at 16:31 +0100, Dmitry Vyukov wrote:
> The following program causes a memory leak of ser_cardstate object
> allocated in gigaset_initcshw:
>
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <pthread.h>
> #include <stdint.h>
> #include <string.h>
> #include <sys/syscall.h>
> #include <unistd.h>
>
> int main()
> {
> 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);
strace translated this for me to
mmap(0x20000000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x20000000
open("/dev/ptmx", O_RDWR|O_LARGEFILE) = 3
ioctl(3, TIOCSETD, [16]) = 0
ioctl(3, TIOCSETD, [7]) = 0
Where 16 is N_GIGASET_M101, while 7 is N_6PACK.
> return 0;
> }
>
> unreferenced object 0xffff88002b4109d8 (size 2048):
> comm "a.out", pid 9565, jiffies 4301785161 (age 10.646s)
> hex dump (first 32 bytes):
> e0 30 0a 87 ff ff ff ff 00 00 00 00 00 00 00 00 .0..............
> 80 af 0d 88 ff ff ff ff 88 08 5e 00 00 88 ff ff ..........^.....
> backtrace:
> [< inline >] kzalloc include/linux/slab.h:607
> [<ffffffff84bfbeab>] gigaset_initcshw+0x4b/0x2b0
> drivers/isdn/gigaset/ser-gigaset.c:394
> [<ffffffff84bb1e22>] gigaset_initcs+0xf82/0x1660
> drivers/isdn/gigaset/common.c:748
> [<ffffffff84bfb65b>] gigaset_tty_open+0x9b/0x460
> drivers/isdn/gigaset/ser-gigaset.c:516
> [<ffffffff82f9a648>] tty_ldisc_open.isra.2+0x78/0xd0
> drivers/tty/tty_ldisc.c:454
> [<ffffffff82f9ac32>] tty_set_ldisc+0x292/0x8a0
> drivers/tty/tty_ldisc.c:561
> [< inline >] tiocsetd drivers/tty/tty_io.c:2656
> [<ffffffff82f8390e>] tty_ioctl+0xb2e/0x2160
> drivers/tty/tty_io.c:2911
> [< inline >] vfs_ioctl fs/ioctl.c:43
> [<ffffffff817fa9ec>] do_vfs_ioctl+0x18c/0xfb0 fs/ioctl.c:674
> [< inline >] SYSC_ioctl fs/ioctl.c:689
> [<ffffffff817fb89f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:680
> [<ffffffff8665ebb6>] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
The above should provide me with enough information to figure out what's
going on here.
> On commit 34229b277480f46c1e9a19f027f30b074512e68b.
That's "Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net",
of two days ago.
Thanks for the report,
Paul Bolle
next prev parent reply other threads:[~2016-02-03 16:16 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 [this message]
2016-02-03 19:11 ` Paul Bolle
2016-02-04 10:40 ` Dmitry Vyukov
2016-02-04 13:09 ` Paul Bolle
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=1454516189.14366.8.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).