Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10241118rwl; Sun, 1 Jan 2023 21:52:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvA8LuSHaB8s1PKTo8IliU4eAghu3Vq1QRpjSJ3/M9gB6E7lCxHXNEM6Pp7f2eYw7RVb0zJ X-Received: by 2002:a17:907:3f9f:b0:840:4901:901f with SMTP id hr31-20020a1709073f9f00b008404901901fmr45035447ejc.3.1672638721199; Sun, 01 Jan 2023 21:52:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672638721; cv=none; d=google.com; s=arc-20160816; b=AGckdrR/1TJxOBpyfMLpIMwBC+QM1P4pv+UHwmVWbA+P5uYL0PZbDQzPshQnzK78Qe Xp0xNB2NI6iKRSWDvzwSJqFyF2XH2bf8qXtpgvM4J8FUDh/6yN4tOLOB/0foK3JPQsE4 /F0eJFVz9NoV9BvY6b+B86PlmTvaMkYhV7AUhJCWZrmxHvBL/3i8344QvI0JnWNkUNIG 7L685IG75Clq4yCV54kRqMlYw6DIsa7VmquCgC9UpgoKeNIomwX6RN0SFyRS4hpKaPC8 26oCSKtwaboI202V5MqROg0RdcZSemH7eJk+mmqT3YJZ/BPP0EsOcOVoRkuGIpTxEkmQ 7pzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=jvJuMP+L/v0VaSUSwJcVqo54T4tBiI2lngCqwC2iFRY=; b=yWzqPWEnmk2OV9bgIaihNwzRJxfv07MqvPi/bWsmX6/EKU+lU7airktOLc4bSNuYx+ m5AxiluWOMsBCsTG0L6Odv4Gh6ulpr1sF89eEi87fsQlvwC5w7cOnsIlXfCpbLnDPWoA 69YD0cKoqqBA0dYThcX34V/Git9wUvBPRSRrpLg2jtHbwKWwtwYY0F/5nOJAVguzYQuw 04c4WnmmDXtgZO8okZHrxkkLSRGCpPTwnMRFxKX0iS/gQ6h8WQWv+wnmw/Fwaog28qZ4 TfJ7NFQVB6j/2brzpa00zRVC1mzfk6AQAavL8Ptu2yK0q/pcCQPxoew50w6wavXyEJgf FBKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jdE+clNc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id en9-20020a056402528900b00484e1329439si11767431edb.156.2023.01.01.21.51.25; Sun, 01 Jan 2023 21:52:01 -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=pass header.i=@linaro.org header.s=google header.b=jdE+clNc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230475AbjABFl0 (ORCPT + 99 others); Mon, 2 Jan 2023 00:41:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjABFlY (ORCPT ); Mon, 2 Jan 2023 00:41:24 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75F0925CF for ; Sun, 1 Jan 2023 21:41:22 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id w1so13338266wrt.8 for ; Sun, 01 Jan 2023 21:41:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jvJuMP+L/v0VaSUSwJcVqo54T4tBiI2lngCqwC2iFRY=; b=jdE+clNc/4TDQB8whIIyEl2ZSBNq5czPHTE9de0nJW2ABylXLDESIP47gOK+ETeBfV yPv9YmhZfMp4/MO/t/Pd9AQwbdpkYiy0yZQaHx9AyWss5NyTwJwp0l00YR6RZCdXyqXD 7SaBlPu7Ct7rtHLV/zsIPdbZ6xmYILCwB+BJEhh+4Z2LHT9aerKZsfXbyxImb4HdF2Cr nmNSBvEcfroDdKaWzt1qBqoHyk5fNsHXLQjxl7Trd4q+b7ga53d21CxebVeiGubzl5vF WDG3+6HoQ9TniYJqiNx994VeG57FVOK+kcayF90vvY5Lpd/DHiv/9xeCzQy0hQVdpSAc 7nCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jvJuMP+L/v0VaSUSwJcVqo54T4tBiI2lngCqwC2iFRY=; b=pje3Y63I1YuXx+9vnKYZghJKUL6gQAguLy+MESESVPaNQ6ZOfXxOyxejIocbsQ0BEH k0O+urBelorB+pZH+zXXEulLTYKHHAAbc2sF20fvzrJPYL4LsDaGEtxMjXll/AshGMAN xmPDNMZDrxVpAXt1J6Vi+PbVa5Kix/6zbTgA/3W8UhlQnvkwpJyNomzNlO5krJgmmbLx fwkwlDlp6Rv6576pRQqA5m1xgZUGWZ/JCJazef1EKQkUynSMzWwJDBBvm61lsRW63cbm hmnyXwxArXFHuMk0T4qilYPDL3xFvHAb2iKWnVFchUHLJD9rqzcVyEkR8oyUND/7vn/S MgNw== X-Gm-Message-State: AFqh2kr/JohKpBswuJUNfjOSRAoZJL5NkU1HGQPgjBuXyJWhx/70av8W 02ekhWwafsXBTP8D+k9K2m2sEg== X-Received: by 2002:a5d:5908:0:b0:279:4938:eb98 with SMTP id v8-20020a5d5908000000b002794938eb98mr18309009wrd.11.1672638080618; Sun, 01 Jan 2023 21:41:20 -0800 (PST) Received: from [192.168.0.104] ([82.77.81.242]) by smtp.gmail.com with ESMTPSA id l17-20020adfe9d1000000b0024165454262sm27106850wrn.11.2023.01.01.21.41.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Jan 2023 21:41:20 -0800 (PST) Message-ID: Date: Mon, 2 Jan 2023 07:41:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2] ext4: Fix possible use-after-free in ext4_find_extent To: Eric Biggers Cc: tytso@mit.edu, 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 References: <20221230062931.2344157-1-tudor.ambarus@linaro.org> Content-Language: en-US From: Tudor Ambarus In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 30.12.2022 22:07, Eric Biggers wrote: > On Fri, Dec 30, 2022 at 01:42:45PM +0200, Tudor Ambarus wrote: >> >> Seems that __ext4_iget() is not called on writes. > > It is called when the inode is first accessed. Usually that's when the file is > opened. Okay, thanks. > > So the question is why didn't it validate the inode's extent header, or > alternatively how did the inode's extent header get corrupted afterwards. > >> You can find below the sequence of calls that leads to the bug. > > A stack trace is not a reproducer. Things must have happened before that point. > I will try to dig more to understand what's happening. If you like to take a look into the reproducer, here it is: https://syzkaller.appspot.com/text?tag=ReproC&x=17beb560480000 The reproducer was used for Android 5.15 and the bug is reported at [1], but as I mentioned earlier, using the same reproducer and config I hit the bug on v6.2-rc1 as well. Thanks for the help. ta [1] https://syzkaller.appspot.com/bug?id=be6e90ce70987950e6deb3bac8418344ca8b96cd