Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5624397imu; Mon, 26 Nov 2018 03:09:34 -0800 (PST) X-Google-Smtp-Source: AJdET5dWBhuIPtQZ9ajKhHuEt6iS9m+t+A5UYx0WAspItWMxxZCNpjddZmB/l6MlXqURHtez5DFe X-Received: by 2002:a62:1a44:: with SMTP id a65mr27959826pfa.30.1543230574663; Mon, 26 Nov 2018 03:09:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230574; cv=none; d=google.com; s=arc-20160816; b=t3aBsO7aAtSbR3SiuFNZKgW0UjjEeQJ0P6UbuijwiXBlJQbeUSPU+O8iiV41FPlloZ PUu6J5TZzaSfK0ESq6y97ucqz3lboa0SfbQnU2swj+DZIg2Ogz68VuomKnYXBOB7r+Fd 0kdrRtXyfA5e9a41CXvwNLNd2o7yuABFgou6kRU94sOlPz7vNvYfB0FQqVDdHSmcJq7Y aEP6x78C2bhsRQcfviXBvtwpqtcNdLP+ttIn9PTLvo6n6hXOIcg4fV3LQXRNvfEjwbpN UJlbwR8tS8G9tA7lvfP1XV+W7Kf3HeHu7hvhTNjkZgRI2upPXhHYqYhj9RK9x3BC31gQ qm3A== 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=Anz7UM8bE3qZ2vwVo1834Yn/0+b2upopQcNCusxPVNY=; b=RqYzDi+cgXrTHGknov6Hnf0iOkgHA+1p59zhmUtIbFSekcBbACdV3sLxNIUdPJeHbQ ayRwu5Kuhz1PGbsS5p/mcQMRsOcF8Sv8ugwgjw3PCNdXw4x0b7LJPZ4UArdKQzFFpfQt f8xGcyi9VW57SuLhkA9/1SbSQovEpvENGERRMcEcVd5q7dK76jJt55X6he51KphhVxdk FpS1uDhNQ2d2pSYVfkQ5WTDdP4cCbFcbusUiIH98mZSiovrs2bZScx0LEFbTs5LfUbyF 8OMnD541SqbjWtggMu/ovmoWxOomNc1V4ceFP/kCU6rc3EpT3z0muD3D++zvJsO+m/Ez tifQ== 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 z8si16271514pgk.183.2018.11.26.03.09.17; Mon, 26 Nov 2018 03:09:34 -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 S1730996AbeKZWA6 (ORCPT + 99 others); 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 > > > . >