Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7677787rwl; Fri, 30 Dec 2022 12:23:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXv9EGOKmn3oIEkarA8HOL4jDrns4BTcWwxb4yWPN23US9kuDWtb2LeWTj9/p0Kp04rVCzpq X-Received: by 2002:a17:907:8c0c:b0:7fd:f1b5:7fd5 with SMTP id ta12-20020a1709078c0c00b007fdf1b57fd5mr28478087ejc.19.1672431801789; Fri, 30 Dec 2022 12:23:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672431801; cv=none; d=google.com; s=arc-20160816; b=rl86PJipVopcNtpVyZE7lDIpiTD3OnTSaP8gPUKLa43mis4UHLiQMlCeV6fhxLk5gO 9lmoPvshlSHaoWz0l4H6eGESTa7jwwLRmT9zVY1cVdkBa+caOwcTodGtlQDNtdr272Ri B5qpEwMsMZl3WxoM8zXmXlGi6iPpbAqdz2iqjLiGI/lszQ5lHZJEiqf5h/5y+38OaC3S Bwu6WOloiRO5KXHEtylsy7F2QuM2bF2N0qit8/d5o117tKrrFR9AFoS8RIYO8s9rCEDr T4uZ513PQ7/VZABUBiCYUnEPcoiG1jJX/h+NrPOscgK0G0w68XJzSQCqFXJ4RJXw2Iv0 391g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tE6+QatUZ4TgbJ1osuqxvSZAcNLGiSz1o9L4JHZPmCk=; b=lxTBSffgEEKf4JAJQNbjh9A082HzGJORAugEz+ZFatEDSRgvNQtpcXKWyRuB9Zh3jn BqFwJGZLZNALQlpRCVzjFLwxUC+hNj1JW6JcNEOj69jb/Io5VGKKp4530AAD3SEkylzy oZ+tIVeybF/SYkm0wB4EKUEBhyQ5D1Hk2OgfRgYNHVvQ8Wa14ImJCtv5Wib0gV6omA2W OO8y26YTQhDhlaJBXUHpjaPSWsjja+D6oU8d54Qxqt+l9wfE1FosdgwzJjcrOTFdtMAM tcb/8ZutMkGBcnQ6vlXhXBd1wNS7smPmelU3sAUhTrXreawKuVMXa0DL0dwOYi1/tBsw T4HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=YS7zl6Xo; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a05640205ce00b0047ff6d56c55si18634093edx.599.2022.12.30.12.22.52; Fri, 30 Dec 2022 12:23:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=YS7zl6Xo; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbiL3UW2 (ORCPT + 99 others); Fri, 30 Dec 2022 15:22:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiL3UW2 (ORCPT ); Fri, 30 Dec 2022 15:22:28 -0500 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7B0314D14 for ; Fri, 30 Dec 2022 12:22:26 -0800 (PST) Received: from letrec.thunk.org (host-67-21-23-146.mtnsat.com [67.21.23.146] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 2BUKM0a3010174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Dec 2022 15:22:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1672431732; bh=tE6+QatUZ4TgbJ1osuqxvSZAcNLGiSz1o9L4JHZPmCk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=YS7zl6XoXD9b02Ln9yW0VIUuTsQf4GK9cqBfKdiaoUA3Dq25b8/POkGNYDmUiZrsf TkbKX4/0IrrD9jYybc5zeVVxxLXfOelYtx1++YfV3TNfnFBs9pbgy8WCGLIbMb3boB FyFO6fvpRYaXC70FI6BLLEEsLyFD0iuoOUdLxSoYwdaiM5HnBL5O9j094TL/PB6G9P 9VhT5W52KJkhA+HtxxVdqWfK28qDFA3zTizGl3SjNxGYSY23CjD2ik/jbT+Cm9meXL x1MB2UwE5SR0wxg5Rncv6BW7JeIYDp3LPuCLSOrbYnWLXXU76A+aBWLVuZW64eSISb SZn4vHHNh7q2Q== Received: by letrec.thunk.org (Postfix, from userid 15806) id 80A838C08C0; Fri, 30 Dec 2022 15:22:00 -0500 (EST) Date: Fri, 30 Dec 2022 15:22:00 -0500 From: "Theodore Ts'o" To: Tudor Ambarus Cc: Eric Biggers , adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, joneslee@google.com, syzbot+0827b4b52b5ebf65f219@syzkaller.appspotmail.com, stable@vger.kernel.org Subject: Re: [PATCH v2] ext4: Fix possible use-after-free in ext4_find_extent Message-ID: References: <20221230062931.2344157-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAY_BE_FORGED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Dec 30, 2022 at 01:42:45PM +0200, Tudor Ambarus wrote: > > This is (incompletely) validating the extent header in the inode. Isn't that > > supposed to happen when the inode is loaded? See how __ext4_iget() calls > > ext4_ext_check_inode(). Why isn't that working here? > > > > Seems that __ext4_iget() is not called on writes. You can find below the > sequence of calls that leads to the bug. The debug was done on v6.2-rc1. > I assume the extents check is no longer done on writes since > commit 7a262f7c69163cd4811f2f838faef5c5b18439c9. The commit doesn't > specify the reason though. Commit 7a262f7c6916 no longer does the check if the inode is already in memory (which is the case when there is an open file descriptor). That's because it should have been checked when it was first read into memory. So the the question is, did the inode get corrupted somehow after it was read in from disk? If so that's the real problem, and that's what needs to be root caused and fixed. It's not sufficient to just to make the syzbot reproducer only longer reproduce. The question is understanding what is fundamentally going on and fixing the real root problem. Regards, - Ted