lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ca63af4-df02-32e6-3531-1e5df154c13e@omp.ru>
Date: Mon, 10 Jun 2024 20:50:35 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Roman Smirnov <r.smirnov@....ru>, Jan Kara <jack@...e.com>,
	<linux-kernel@...r.kernel.org>
CC: <lvc-project@...uxtesting.org>
Subject: Re: [PATCH] udf: balloc: prevent integer overflow in
 udf_bitmap_free_blocks()

On 6/10/24 10:25 AM, Roman Smirnov wrote:

> An overflow may occur if the function is called with the last
> block and an offset greater than zero. It is necessary to add
> a check to avoid this.
> 
> Found by Linux Verification Center (linuxtesting.org) with Svace.
> 
> Signed-off-by: Roman Smirnov <r.smirnov@....ru>
> ---
>  fs/udf/balloc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
> index ab3ffc355949..cd83bbc7d890 100644
> --- a/fs/udf/balloc.c
> +++ b/fs/udf/balloc.c
> @@ -151,6 +151,13 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
>  	block = bloc->logicalBlockNum + offset +
>  		(sizeof(struct spaceBitmapDesc) << 3);

   Hm, I can't say I understand this code well... Is the block variable here
counted in blocks or bytes?

>  

   As I've already said, we hardly need an empty line here -- just
don't add an empty line after your *if*...

> +	if (block < offset + (sizeof(struct spaceBitmapDesc) << 3)) {

   Thinking about this again, this addition may overflow 32 bits as well,
so it's better to compare block with bloc->logicalBlockNum...

[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ