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]
Message-ID: <03039f80-3abe-00ef-5174-f5c358fb6190@huawei.com>
Date:   Mon, 6 May 2019 23:50:24 +0800
From:   Zhiqiang Liu <liuzhiqiang26@...wei.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
CC:     <liuhangbin@...il.com>, <kuznet@....inr.ac.ru>,
        <nicolas.dichtel@...nd.com>, <phil@....cc>,
        "wangxiaogang (F)" <wangxiaogang3@...wei.com>,
        Mingfangsen <mingfangsen@...wei.com>,
        "Zhoukang (A)" <zhoukang7@...wei.com>, <kouhuiying@...wei.com>,
        <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2 v3] ipnetns: use-after-free problem in
 get_netnsid_from_name func

> On Sat, 4 May 2019 15:26:25 +0800
> Zhiqiang Liu <liuzhiqiang26@...wei.com> wrote:
> 
>> From: Zhiqiang Liu <liuzhiqiang26@...wei.com>
>>
>> Follow the following steps:
>> # ip netns add net1
>> # export MALLOC_MMAP_THRESHOLD_=0
>> # ip netns list
>> then Segmentation fault (core dumped) will occur.
>>
>> In get_netnsid_from_name func, answer is freed before rta_getattr_u32(tb[NETNSA_NSID]),
>> where tb[] refers to answer`s content. If we set MALLOC_MMAP_THRESHOLD_=0, mmap will
>> be adoped to malloc memory, which will be freed immediately after calling free func.
>> So reading tb[NETNSA_NSID] will access the released memory after free(answer).
>>
>> Here, we will call get_netnsid_from_name(tb[NETNSA_NSID]) before free(answer).
>>
>> Fixes: 86bf43c7c2f ("lib/libnetlink: update rtnl_talk to support malloc buff at run time")
>> Reported-by: Huiying Kou <kouhuiying@...wei.com>
>> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
>> Acked-by: Phil Sutter <phil@....cc>
> 
> Applied. You can get better and more detailed checks by running with
> valgrind. Which is what I did after applying your patch.

Thank you for your advice. I will learn how to use valgrind, and use it to
obtain more detailed checks.

> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ