From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D0E2C43441 for ; Mon, 26 Nov 2018 11:07:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 598EC20672 for ; Mon, 26 Nov 2018 11:07:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 598EC20672 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731027AbeKZWA6 (ORCPT ); Mon, 26 Nov 2018 17:00:58 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15605 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727412AbeKZWA5 (ORCPT ); Mon, 26 Nov 2018 17:00:57 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id AB4B5ED0B8FC; Mon, 26 Nov 2018 19:07:08 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 19:07:09 +0800 Subject: Re: [PATCH] f2fs: read page index before freeing To: PanBian CC: Jaegeuk Kim , , References: <1542884326-74903-1-git-send-email-bianpan2016@163.com> <3ebe6814-586e-77e8-52fa-47fb61d760f5@huawei.com> <20181126102841.GA94853@bp> From: Chao Yu Message-ID: Date: Mon, 26 Nov 2018 19:07:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181126102841.GA94853@bp> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/11/26 18:28, PanBian wrote: > On Mon, Nov 26, 2018 at 05:13:53PM +0800, Chao Yu wrote: >> Hi Pan, >> >> On 2018/11/22 18:58, Pan Bian wrote: >>> The function truncate_node frees the page with f2fs_put_page. However, >>> the page index is read after that. So, the patch reads the index before >>> freeing the page. >> >> I notice that you found another use-after-free bug in ext4, out of >> curiosity, I'd like to ask how do you find those bugs? by tool or code review? > > I found such bugs by the aid of a tool I wrote recently. I designed a method > to automatically find paired alloc/free functions. With such functions, I > wrote two checkers, one to check mismatched alloc/free bugs, the other to > check use-after-free and double-free bugs. Excellent! Do you have any plan to open its source or announce it w/ binary to linux kernel developers, I think w/ it we can help to improve kernel's code quality efficiently. Thanks, > > Best regards, > Pan Bian > > > . >