Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp421167lqp; Tue, 11 Jun 2024 08:15:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMVlEAOfLP3Zp5ryX7PHixoF90wM82DDE3bhM8Ukek8eCBbpaSanoP07CecIs5T5CLaJjXVWsYl6+E2aQiewkUfcCJOQHpz0+BhS3UOA== X-Google-Smtp-Source: AGHT+IGea0kRwonkOjJAJUpNBztEu3cT7xe5GKZZab5yefbfOYKiFaf8t7+gsD6NxSLAK/LD55tC X-Received: by 2002:a17:906:1394:b0:a6f:2153:855b with SMTP id a640c23a62f3a-a6f215385d1mr321870166b.26.1718118943258; Tue, 11 Jun 2024 08:15:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718118943; cv=pass; d=google.com; s=arc-20160816; b=G+4ZQ/bn8Qwd/1WSHe96QtA9h2zhDmOPaFxp6HFGzMggfKCf9WR2cyr4cLvqKxEZPU it4/8XE47FT9/NwVIM/Y31WoxhfoEHyurXIeKETfaz4KinQqPbQ8eyiS7bTkNmFF5ZKP 5jFkA3m9Uhafd4F4casmCvb72VJXROyez2s0Eo/h3J3wJX4wphpUnEXguxB9rvTbSNe8 paPvqdHa79eXkHeZyFWy2wR5YT8kr9uwS3JNAHFx1aT1LWWeIKpFTfWmjllyBISDenw6 5JH00xrz7SzsWK2V3jDADdGSA/Nqv5oTWTmsMUKYI5PRCYedA3GQf7MGNk79QhOWK97+ K3Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=x/XmqsIk1qvaiRJ9brwramf4dj9kNpfOUIg2rQS2th8=; fh=MP3O/sydtXFgWZ7Ng1O9OJxuax1kxD6lCk+7tz8mghA=; b=A2ZuITCtS1lUSJwwC5J2gxZRJmfwP+tOFZx0Fl8/fYyNv9EgVs9929w8G/3F6iSBY0 tTDZom5074mT8W1tXCYW6LjRkR128jB8GdV+WE6z+tqoxVpFypH2XFN7ofBdp4RkSLsv XksQ6foux01r2NvTL5ypvZdV/b5u+ypj/eX9034QVAb61c28aDu7fWWHIfEn96OAj+g7 vhueRv2wxN9O20pd1FoGxXNZggwGoXi5zODtwyGgIRl5t4DIBo4wU3294F2lKSXn0zHb SP8nCTYLeI3nig1mXLBVauzKZCMpAPP3mi9zfZfuxIyGqP4D1pl9U96XZmyLUs0Zjn6W tGLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pxbSlKoC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c7fc14e81si2526866a12.76.2024.06.11.08.15.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 08:15:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pxbSlKoC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F2A501F23BA7 for ; Tue, 11 Jun 2024 15:15:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74101364AE; Tue, 11 Jun 2024 15:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pxbSlKoC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 937F02C69B; Tue, 11 Jun 2024 15:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718118935; cv=none; b=iIwnAc2KHzWePXrvwkBE4aTrqjI2zZHXPK6Tx+uJIb9b8sa51RYGydN21uG66xaw8YMyFnsthzxUdHfsOHIgNZPdIQETPc2FOtX+1wQt324u5XfY2WSwqNNxu3bw1KSLIp8ISiVJxh5dHbeoI1rFZ73oDAvX+m6xxO8kWbDyssk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718118935; c=relaxed/simple; bh=xMLV2sd8FsrG6JWqA4Eoeeg1GA6HduhpKbcLiHnUZ7o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BT+/cODbt/PL8T3m27cmYh4IgvD1ZESDMKOpaGdPtFqc8Q/eY3tm/F4FEWKDvoMwyLUhgTknsKztGfiYlg0hZ+sfkNTLtxTXFDzBWxUbC8gTACgBQ+cFCVozZtybu5+6+H0DybNl5ZFKqLGto9qzZDrSu+u2j+f/9bkEgRk3XcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pxbSlKoC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 931C3C2BD10; Tue, 11 Jun 2024 15:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718118935; bh=xMLV2sd8FsrG6JWqA4Eoeeg1GA6HduhpKbcLiHnUZ7o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pxbSlKoCtG+T4zqh3yYeHSTBNVU+KKPf5mzgeyyJ/yqkaMcmpAUk4S0jPBTX+eEpP Etx38DHXSu0Kyc0Jck+DeWuc2lXIL/aR9zfSkr5IRhs9uRJvwfy++8sdBLQTEVu17O SsLjDpz1CofxuG4bzCQrI9XwGg6jN6E6nIYBbf0/Pkm7uCmZqVFN+LXwt3/ifSfyr+ w0KXyqjZfpiQVIt899j60zcmAVo1fAVJVU9+hqnr99zwXZ7pEQbWL3PL5johehutMa uQ2IWmAyx7PgWc0TiGFqnXWtP5uHl2CzopF6C4udcTs9hmi4PxXcvu4cw4EESSNnDu ZVJ8roq3AV2KQ== Date: Tue, 11 Jun 2024 09:15:32 -0600 From: Keith Busch To: Roman Smirnov Cc: "axboe@kernel.dk" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , Karina Yankevich , "lvc-patches@linuxtesting.org" , Sergey Shtylyov Subject: Re: [bug report] block: integer overflow in __bvec_gap_to_prev() Message-ID: References: <9d8ac82ab63a64583f753878dd03e3503c68ffbe.camel@omp.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d8ac82ab63a64583f753878dd03e3503c68ffbe.camel@omp.ru> On Tue, Jun 11, 2024 at 02:23:48PM +0000, Roman Smirnov wrote: > Hello. > > There is a case of integer overflow in __bvec_gap_to_prev(): > > ((bprv->bv_offset + bprv->bv_len) & lim->virt_boundary_mask); > > bio_vec can cross multiple pages: > > https://lore.kernel.org/lkml/20190215111324.30129-1-ming.lei@redhat.com/t/ > > So, in case bio has one bio_vec bv_len can have a maximum value of UINT_MAX. > The check happens in bio_full(). In the case when bv_len is equal to > UINT_MAX and bv_offset is greater than zero, an overflow may occur. Does it matter? The lower bits checked against the mask should be the same regardless of overflow.