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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+ZhfZoqJeSYiO_H9sFt-BirPnitpS4smqLj4b2A82EA0Q@mail.gmail.com>
Date:   Sat, 16 Dec 2017 08:40:24 +0100
From:   Dmitry Vyukov <dvyukov@...gle.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     "Eric W. Biederman" <ebiederm@...ssion.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        stable <stable@...r.kernel.org>
Subject: Re: [PATCH] exit: move exit_task_namespaces() after exit_task_work()

On Sat, Dec 16, 2017 at 1:00 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
>>>>> syzbot reported we have a use-after-free when mqueue_evict_inode()
>>>>> is called on __cleanup_mnt() path, where the ipc ns is already
>>>>> freed by the previous exit_task_namespaces(). We can just move
>>>>> it after after exit_task_work() to avoid this use-after-free.
>>>>
>>>> How does that possibly work. (I haven't seen this syzbot report).
>>>>
>>>> Looking at the code we have get_ns_from_inode.  Which takes the mq_lock,
>>>> sees if the pointer is NULL and takes a reference if it is non-NULL.
>>>>
>>>> Meanwhile put_ipc_ns calls mq_clear_sbinfo(ns) with the mq_lock held
>>>> when the count drops to zero.
>>>>
>>>> Where is the race in that?
>>>>
>>>> The rest of mqueue_evict_inode uses the returned pointer and
>>>> tests that the pointer is non-NULL before user it.
>>>>
>>>> So either szbot is giving you a bad report or there is a subtle race
>>>> there I am not seeing.  The change below is not at all the proper way to
>>>> fix a subtle race.
>>>>
>>>> Eric
>>>
>>> Cong, what was that report? Searching by
>>> "exit_task_work|exit_task_namespaces" there are too many of them:
>>> https://groups.google.com/forum/#!searchin/syzkaller-bugs/%22exit_task_work$7Cexit_task_namespaces%22%7Csort:date
>>>
>>> I can only say that syzbot does not make up reports. That's something
>>> that actually happened and was provoked by userspace.
>>
>>
>> Ah, found that bug:
>> https://groups.google.com/d/msg/syzkaller-bugs/1XBaqnPSXzs/VF-eCSPuCQAJ
>
> Yeah, and it is introduced by:
>
> http://git.cmpxchg.org/cgit.cgi/linux-mmots.git/commit/?id=9c583773d036336176e9e50441890659bc4eeae8


If it's going to be discussed here, note that it was reported by
syzbot and requires "#syz fix" tag after fixing here:
https://groups.google.com/d/msg/syzkaller-bugs/1XBaqnPSXzs/jGDCMoz_AQAJ

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ