Re: memory leak in binder_transaction

From: Todd Kjos
Date: Fri Jun 21 2019 - 13:57:21 EST


On Thu, Jun 13, 2019 at 2:56 PM syzbot
<syzbot+182ce46596c3f2e1eb24@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: d1fdb6d8 Linux 5.2-rc4
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=15e5ce1ea00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=cb38d33cd06d8d48
> dashboard link: https://syzkaller.appspot.com/bug?extid=182ce46596c3f2e1eb24
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1181703ea00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14e14392a00000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+182ce46596c3f2e1eb24@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> -executor774" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
> tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder
> permissive=1
> BUG: memory leak

Fix sent: https://lore.kernel.org/patchwork/patch/1092398/

>
> unreferenced object 0xffff888123934800 (size 32):
> comm "syz-executor774", pid 7083, jiffies 4294941834 (age 7.970s)
> hex dump (first 32 bytes):
> 00 48 93 23 81 88 ff ff 00 48 93 23 81 88 ff ff .H.#.....H.#....
> 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<0000000038ba7202>] kmemleak_alloc_recursive
> include/linux/kmemleak.h:43 [inline]
> [<0000000038ba7202>] slab_post_alloc_hook mm/slab.h:439 [inline]
> [<0000000038ba7202>] slab_alloc mm/slab.c:3326 [inline]
> [<0000000038ba7202>] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553
> [<0000000004e63839>] kmalloc include/linux/slab.h:547 [inline]
> [<0000000004e63839>] kzalloc include/linux/slab.h:742 [inline]
> [<0000000004e63839>] binder_transaction+0x28b/0x2eb0
> drivers/android/binder.c:3072
> [<0000000050997ec4>] binder_thread_write+0x357/0x1430
> drivers/android/binder.c:3794
> [<00000000ab2de227>] binder_ioctl_write_read
> drivers/android/binder.c:4827 [inline]
> [<00000000ab2de227>] binder_ioctl+0x8bc/0xbb4
> drivers/android/binder.c:5004
> [<000000002eec2b63>] vfs_ioctl fs/ioctl.c:46 [inline]
> [<000000002eec2b63>] file_ioctl fs/ioctl.c:509 [inline]
> [<000000002eec2b63>] do_vfs_ioctl+0x62a/0x810 fs/ioctl.c:696
> [<0000000048cfc9e6>] ksys_ioctl+0x86/0xb0 fs/ioctl.c:713
> [<0000000030bf392d>] __do_sys_ioctl fs/ioctl.c:720 [inline]
> [<0000000030bf392d>] __se_sys_ioctl fs/ioctl.c:718 [inline]
> [<0000000030bf392d>] __x64_sys_ioctl+0x1e/0x30 fs/ioctl.c:718
> [<000000007dec438c>] do_syscall_64+0x76/0x1a0
> arch/x86/entry/common.c:301
> [<00000000ae043c96>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
>
>
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches