Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5461920pxb; Mon, 28 Mar 2022 12:48:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF6q+HcOPhFRv0ElAY/VDd0gQMTcuMIIAmICOf5dAvYtvzfK2nPzb4ZEk0WuNzElDUYYMg X-Received: by 2002:a54:4592:0:b0:2ec:aefc:be15 with SMTP id z18-20020a544592000000b002ecaefcbe15mr460458oib.130.1648496937630; Mon, 28 Mar 2022 12:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648496937; cv=none; d=google.com; s=arc-20160816; b=Yqnhnj3GDwfArJqcFjw1Fszgp+KMODHQGQ+aXbImaYUMQA7yUpi4uj5UfZsjxNtEUv qe6RZ4CXIykWH7G0ZcyJpcJ4k8tmG30Aa0BRhy4tmNgOy8yHNajiEl9GLJFMd92rwCrZ O05eKdSnPw3CWhp+YhTTNUWT8mYvpWu0hpI6kSsXONG4kcmSOj6FuYUxy36mlhoMi6QR Co03smcdjZXJY7cu3lydUXVwYr7pC8tCbqq71bM0oH/4+8bNQvy7+XRjfwqzdni+abHP N8i4RBgfewMuZha/lDhozvzgw1VyN392aBYQgZnnfR99x6QEUmDRGaOq+Hln3iMHa2EC /B3g== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=OYF/jvStaXgJs+lPLO95DLgpFNQWTZE9eUToA1rRs6g=; b=Q7LKwi/ZASJEDWMMxSjqkJFky/crpKN5LhCZGVoVG3MmdsZNSw/TCmnaaPKj7VlL9Q ixQ9p8iWmrAagUh6dsWuCxNa9PSOTRj0AYQsligyBziZnbcl81NVUui3XMwQruUWbEsm aljQ8g3SoJxtcoSAhGo4YvSlXAzquNl+rutOYX01oSFzhGSkDy7KiRDNSbJW32pYOp3x nSaSdy+TGCUNmOqC6hqYCZ3L7raL5a/BT8xhYhp06gcJ60Q6lpUDbtd9r8Ry9SvfuvcG XztnXNBWdKltVGViiAyWTkzi/TQgzIOns7m9+1+aF53P0+b4ga431clyy+9fVG6rddFw hqAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e+BGZaz9; 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 e23-20020a9d6e17000000b005cb2fc1382asi10221523otr.166.2022.03.28.12.48.38; Mon, 28 Mar 2022 12:48:57 -0700 (PDT) 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=e+BGZaz9; 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 S240438AbiC1QOL (ORCPT + 99 others); Mon, 28 Mar 2022 12:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238518AbiC1QOL (ORCPT ); Mon, 28 Mar 2022 12:14:11 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53D2762123 for ; Mon, 28 Mar 2022 09:12:30 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id s11so13059957pfu.13 for ; Mon, 28 Mar 2022 09:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=OYF/jvStaXgJs+lPLO95DLgpFNQWTZE9eUToA1rRs6g=; b=e+BGZaz9UF7wurI72M/5D45ULqW3ey6hXKY/Ts68ZgJK+22nFqMUvhRnEdRnUBpuvl qPQCU0In4ULU6FrtL4iIXhYl3zMBK19R+WUV7DTPh5cvUw6eRFk7AhjuMWBOTqlyWtQC nJKNVvqCmiJ+2LNK54Aq7rTRVFsfPFfRB/v6VG5I9BgHJXzNoHViwd1UmQgMDaSWQXpp 2CS5wZFjeU2yLm1azU7lY7IbkgKzdX1RwEucQh4Bj2ntyML4fmuRyUdWr6bNzZXduSsv B679isvImDqKin6vhmJQq3ouLNW2MPfA9u+B75y+vagvE5heMpuBBBY2due9oOaT3xWM w8Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=OYF/jvStaXgJs+lPLO95DLgpFNQWTZE9eUToA1rRs6g=; b=uU5fJgrwfn/+IS2XLJfIHBYirRRPc+0YQBqIwCibYaA/nHGoavNx3pvuwsbgVQiEGu +tOutwe7ldtVc+3JZovou4YHsx8koDHOia6KTgq09Ps+MNjfMchJLiKJsQLrRz7Mpct3 RxPLfRhmnOJZa3spMsjNshCKmTm8CriVWylILQ9bngK7OPzOH5SH810xPg/4of31kDVk ENJmR1hoq+TwM6mNlo8VRkcYjnlOXfSblFo3gwHauiO5KEoLQuAcW/B5PAyQjvXbBORv uipcFgS4nSZ38UY46TIC5g1r93zmYALsS/MZSTSSDpvxppYpcjP0wpVPJ2pllWhxNpka uuxQ== X-Gm-Message-State: AOAM532l7INkSaHsLPfN2XdNFcjXF8K48WyfIriGdhkmfosE5iKQBN8o f0/wnDflBDiTHy/djV4Z/q7o6nNmtKnsbaEP X-Received: by 2002:a63:3fcc:0:b0:398:ae5:6905 with SMTP id m195-20020a633fcc000000b003980ae56905mr10471109pga.463.1648483949404; Mon, 28 Mar 2022 09:12:29 -0700 (PDT) Received: from [192.168.254.17] ([50.39.160.154]) by smtp.gmail.com with ESMTPSA id z12-20020aa7888c000000b004f3fc6d95casm16878011pfe.20.2022.03.28.09.12.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Mar 2022 09:12:28 -0700 (PDT) Message-ID: <21f3fd84-2de9-646c-4d0c-94007a996c70@linaro.org> Date: Mon, 28 Mar 2022 09:12:27 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2] ext4: check if offset+length is valid in fallocate Content-Language: en-US To: linux-ext4@vger.kernel.org Cc: Andreas Dilger , Ritesh Harjani , stable@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+7a806094edd5d07ba029@syzkaller.appspotmail.com, tytso@mit.edu References: <20220315215439.269122-1-tadeusz.struk@linaro.org> From: Tadeusz Struk In-Reply-To: <20220315215439.269122-1-tadeusz.struk@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 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,T_SCC_BODY_TEXT_LINE 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 3/15/22 14:54, Tadeusz Struk wrote: > Syzbot found an issue [1] in ext4_fallocate(). > The C reproducer [2] calls fallocate(), passing size 0xffeffeff000ul, > and offset 0x1000000ul, which, when added together exceed the disk size, > and trigger a BUG in ext4_ind_remove_space() [3]. > According to the comment doc in ext4_ind_remove_space() the 'end' block > parameter needs to be one block after the last block to remove. > In the case when the BUG is triggered it points to the last block on > a 4GB virtual disk image. This is calculated in > ext4_ind_remove_space() in [4]. > This patch adds a check that ensure the length + offest to be > within the valid range and returns -ENOSPC error code in case > it is invalid. Hi, Any feedback on this? -- Thanks, Tadeusz