public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Qasim Ijaz <qasdev00@gmail.com>
Cc: kevin.tian@intel.com, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	syzbot <syzbot+85992ace37d5b7b51635@syzkaller.appspotmail.com>
Subject: Re: [PATCH v2] iommufd/iova_bitmap: Fix shift-out-of-bounds in iova_bitmap_offset_to_index()
Date: Tue, 14 Jan 2025 13:54:03 -0400	[thread overview]
Message-ID: <20250114175403.GO26854@ziepe.ca> (raw)
In-Reply-To: <20250113223820.10713-1-qasdev00@gmail.com>

On Mon, Jan 13, 2025 at 10:38:20PM +0000, Qasim Ijaz wrote:
> Resolve a UBSAN shift-out-of-bounds issue in iova_bitmap_offset_to_index() where
> shifting the constant "1" (of type int) by bitmap->mapped.pgshift 
> (an unsigned long value) could result in undefined behavior. 
> 
> The constant "1" defaults to a 32-bit "int", and when "pgshift" exceeds 31 (e.g., pgshift = 63)
> the shift operation overflows, as the result cannot be represented in a 32-bit type.
> 
> To resolve this, the constant is updated to "1UL", promoting it to an unsigned long type 
> to match the operand's type.
> 
> Reported-by: syzbot <syzbot+85992ace37d5b7b51635@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=85992ace37d5b7b51635
> Fixes: 58ccf0190d19 ("vfio: Add an IOVA bitmap support")
> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
> ---
>  drivers/iommu/iommufd/iova_bitmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to iommufd for-next

Thanks,
Jason

      reply	other threads:[~2025-01-14 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 22:38 [PATCH v2] iommufd/iova_bitmap: Fix shift-out-of-bounds in iova_bitmap_offset_to_index() Qasim Ijaz
2025-01-14 17:54 ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250114175403.GO26854@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qasdev00@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=syzbot+85992ace37d5b7b51635@syzkaller.appspotmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox