Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp184664imu; Mon, 26 Nov 2018 19:15:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/WZWCFsFixKnMzb7WUIVnyVnjSTxmjTZ1YGSBRE8XNiyj5RZCEtiEPWpqAIM5pYX49G+/6v X-Received: by 2002:a17:902:780a:: with SMTP id p10mr31449502pll.54.1543288502212; Mon, 26 Nov 2018 19:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543288502; cv=none; d=google.com; s=arc-20160816; b=bDaWsiGOMs/bt+Yy/aGrXak0zuQOPOi2JKOI7NtX9VixxrClHFJTHp+ugyb6BSLVeo wKQTedV+EaV28LJlxBONw9LjqSP3IDubNx6eGK0kxLGbf60Xrc1oAmldwg+PPGwt4iMz b9ADX/cD5r1DxUjvV3+yU9IBaj3rMoGsu5NKEeLnma9QQveAi8iy5EEHQx5DGW8tE1ya a1Q3jXzQC3WIbRTSObVbp78GunqvLWvFkCWK1eP1dS6syAU0Ado5h/s7cWdgNXfSzBgU HtxdOZEaLim4Lntnj9gkoLpMiEeSHC0worZb7jofUa1dXlsRXN5NFQ0mbmjEKYQkMltF v43g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Fb3rqX6/bWsRxdOMfnOX3dV5WqA01dDRZlrrEN+1yu4=; b=WVlBJwgU6cVHEHBT6l/u1KuSPKF4NFGNb/Fp5kxwN/DCqu5Cq8YC1dywp8IpNlOpkp sJwJ1O7tZbLcMAv9PvJOPvUdEfq16nSJpdlV7f3bmzUy4TNNl9OLBd84RjtPvi8WXvLj IRMGdIfhT4UYsq9I9k+260woICEgb+hPGzHvVjvFA1ifgveCBa7d9TSG1qalZG+4PABz Jsas2SWvzMiOylW5AGDQAXq6Fj4W1qlVxozNT3G57hj0XdjbdBOdLDcQvsputSpbxdYj tbisbC+WMzFaWD1qF1BZAOzeCjJKCHn6V6c+1AtB87ZtHmLWU5kBjV8jBGDMzPFcfmh3 EGJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z38si2290849pga.193.2018.11.26.19.14.47; Mon, 26 Nov 2018 19:15:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728365AbeK0OJH (ORCPT + 99 others); Tue, 27 Nov 2018 09:09:07 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:57036 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727784AbeK0OJG (ORCPT ); Tue, 27 Nov 2018 09:09:06 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id AA0F6C6A2FB9F; Tue, 27 Nov 2018 11:12:41 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.408.0; Tue, 27 Nov 2018 11:12:41 +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> <20181127002247.GA109273@bp> From: Chao Yu Message-ID: <28fc6dc0-6f91-1551-57bb-769dc18b9f7b@huawei.com> Date: Tue, 27 Nov 2018 11:12:40 +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: <20181127002247.GA109273@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/27 8:22, PanBian wrote: > On Mon, Nov 26, 2018 at 07:07:08PM +0800, Chao Yu wrote: >> 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. > > Yes. I am now writing a paper about the method. I will open the source code > as soon as I complete the paper and some optimizations. Cool, if there is any progress, please let f2fs guys know, thank you in advance. :) Thanks, > > Best, > Pan > > > . >