Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp15335imu; Mon, 26 Nov 2018 16:23:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0ZqqnK1cO/PcUCep2zGhj490NP3iqWQCIJik+QVLkZP2w552oLA0EQGD/rz4Q0ITSjYjn X-Received: by 2002:a65:66ce:: with SMTP id c14mr26846353pgw.450.1543278234874; Mon, 26 Nov 2018 16:23:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543278234; cv=none; d=google.com; s=arc-20160816; b=Vb1hZ01BpogM8j0hJtre4uwJz9M/hjzIfwEP9+6uyKFQMcMbIx9MfBU5lU+DpC6ySs eH5fzuR7xp9PFxxjbEdOmRPYtVG+R7kbHk9SHOaiJFD8Ir822BdG1UwLytEBb+ehqzkY GDP8mST9ZEmgxp9+6XHa8F3SWe1t2y/AA9ULZmJXxBGKMhmkuB/BSrdJu2sqgj1/eCIZ vQ36mFvCyOPe8x2n0vvHbC3M7lA3mzj9sqI0vNFiSUvveYQIjXlVCrwMKDbab4O/NEMw ckA2WGENdI2/qtu3k/0l4M1UVz63JsFcohbj9K/MxAa1DkmDzvx+eFaascE++QKhgHw0 9C+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=KB7KAYOGK0Ogit6Tq1AlE/dSKtlFSJeHLgNt3K5EFKM=; b=It0RPKJCSFdm4AG2h/2PiAQgeFy88bk4dN2+1udyH6EfV74LcS2bnPQEE5fYwL2oMP ctRc3WTqkqf/AAQgrKIQJ2r7xAp1aV8XgsSiOpiQyYVvoCNd7IQVzyNmpAyWg52T37K1 qIWve7CStRgtGSeex95R+aFyhpzreQRYrPxiCwPQyDfD464N+4NEbrXO0j3+8qR8Mnvq h5Fj3YggJuVciAgA6mE+30uGMmQLszfnfU+7hzaKug1M2FCpO5cRYxVBHiZ+sCx1/e4M V1SbumsTmFzX2SJWIKXPZH0WQPfiTaY1zmRHrxZpiNox0+0oZwbqw83HQ+z13hnDs76d WWuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Js77HRNs; 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 h85si2032912pfd.27.2018.11.26.16.23.39; Mon, 26 Nov 2018 16:23:54 -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; dkim=pass header.i=@163.com header.s=s110527 header.b=Js77HRNs; 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 S1727646AbeK0LS5 (ORCPT + 99 others); Tue, 27 Nov 2018 06:18:57 -0500 Received: from m12-13.163.com ([220.181.12.13]:60905 "EHLO m12-13.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727456AbeK0LS5 (ORCPT ); Tue, 27 Nov 2018 06:18:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=KB7KA YOGK0Ogit6Tq1AlE/dSKtlFSJeHLgNt3K5EFKM=; b=Js77HRNsjmGUu0itxDiGf hJx1mFuDKwZSCttFJOLpUDdAw3Oj5aXH3UtihAr4LRMh77v1305bouq0tupSbZMY qcK5eRNQrDhd7xaiq0dGDxYyTQZOvlcwEd1CmVwcF8XNiEuvFe8DAJw8JwraRtqX hH/dx5PVIdxscT9XQyEzlE= Received: from bp (unknown [106.120.213.96]) by smtp9 (Coremail) with SMTP id DcCowABHExVWjvxbbRf5Bw--.10268S2; Tue, 27 Nov 2018 08:22:47 +0800 (CST) Date: Tue, 27 Nov 2018 08:22:47 +0800 From: PanBian To: Chao Yu Cc: Jaegeuk Kim , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] f2fs: read page index before freeing Message-ID: <20181127002247.GA109273@bp> Reply-To: PanBian References: <1542884326-74903-1-git-send-email-bianpan2016@163.com> <3ebe6814-586e-77e8-52fa-47fb61d760f5@huawei.com> <20181126102841.GA94853@bp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-CM-TRANSID: DcCowABHExVWjvxbbRf5Bw--.10268S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gr1DXw4kur17XrWDXFW7CFg_yoWkArg_Wa y0vrs7Aws8JF1fGanxtrW3GFZ5W3WUXw1rC3yFqrs3t3sxJ395X39rWwn5XFn7Jw4qyF43 Crn0va1a9rnFvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeGNt7UUUUU== X-Originating-IP: [106.120.213.96] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBZxwLcletsIu-MgACsM Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Best, Pan