lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 10 Aug 2020 10:14:35 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        James Bond <jameslouisebond@...il.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        Michel Lespinasse <walken@...gle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Denis Efremov <efremov@...ux.com>,
        linux-kernel@...r.kernel.org, Ben Hutchings <ben@...adent.org.uk>
Subject: Re: [PATCH] tty/vt: fix a memory leak in con_insert_unipair

On 10. 08. 20, 9:51, Greg Kroah-Hartman wrote:
> On Mon, Aug 10, 2020 at 07:16:48AM +0200, Jiri Slaby wrote:
>> On 10. 08. 20, 0:14, James Bond wrote:
>>> Syzkaller find a memory leak in con_insert_unipair:
>>>     BUG: memory leak
>>>     unreferenced object 0xffff88804893d100 (size 256):
>>>     comm "syz-executor.3", pid 16154, jiffies 4295043307 (age 2392.340s)
>>>     hex dump (first 32 bytes):
>>>     80 af 88 4e 80 88 ff ff 00 a8 88 4e 80 88 ff ff  ...N.......N....
>>>     80 ad 88 4e 80 88 ff ff 00 aa 88 4e 80 88 ff ff  ...N.......N....
>>>     backtrace:
>>>     [<00000000f76ff1de>] kmalloc include/linux/slab.h:555 [inline]
>>>     [<00000000f76ff1de>] kmalloc_array include/linux/slab.h:596 [inline]
>>>     [<00000000f76ff1de>] con_insert_unipair+0x9e/0x1a0 drivers/tty/vt/consolemap.c:482
>>>     [<000000002f1ad7da>] con_set_unimap+0x244/0x2a0 drivers/tty/vt/consolemap.c:595
>>>     [<0000000046ccb106>] do_unimap_ioctl drivers/tty/vt/vt_ioctl.c:297 [inline]
>>>     [<0000000046ccb106>] vt_ioctl+0x863/0x12f0 drivers/tty/vt/vt_ioctl.c:1018
>>>     [<00000000db1577ff>] tty_ioctl+0x4cd/0xa30 drivers/tty/tty_io.c:2656
>>>     [<00000000e5cdf5ed>] vfs_ioctl fs/ioctl.c:48 [inline]
>>>     [<00000000e5cdf5ed>] ksys_ioctl+0xa6/0xd0 fs/ioctl.c:753
>>>     [<00000000fb4aa12c>] __do_sys_ioctl fs/ioctl.c:762 [inline]
>>>     [<00000000fb4aa12c>] __se_sys_ioctl fs/ioctl.c:760 [inline]
>>>     [<00000000fb4aa12c>] __x64_sys_ioctl+0x1a/0x20 fs/ioctl.c:760
>>>     [<00000000f561f260>] do_syscall_64+0x4c/0xe0 arch/x86/entry/common.c:384
>>>     [<0000000056206928>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
>>>     BUG: leak checking failed
>>>
>>> To fix this issue, we need to release the pointer p1 when the call of
>>> the function kmalloc_array fail.
...
>> Do we have some annotations for this instead?
> 
> We need something there, a comment saying "this is fine, don't touch
> it!" or something like that?  We need that in a few other places in the
> vt code as well.

Sure, comment as the last resort (to silence patch writers). But I had
some kmemleak annotation (to silence the warning) in mind.

Or better fix/tune kmemleak: why it dares to think it's a mem leak in
the first place?

thanks,
-- 
js

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ