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] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.00.0908241456390.22597@tundra.namei.org>
Date:	Mon, 24 Aug 2009 14:57:57 +1000 (EST)
From:	James Morris <jmorris@...ei.org>
To:	Mimi Zohar <zohar@...ux.vnet.ibm.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>
cc:	linux-kernel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
	Roland Kletzing <devzero@....de>,
	"<David Safford" <safford@...son.ibm.com>, stable@...nel.org,
	Mimi Zohar <zohar@...ibm.com>
Subject: Re: [PATCH 2/2] ima: hashing large files bug fix

On Fri, 21 Aug 2009, Mimi Zohar wrote:

> Hashing files larger than INT_MAX causes process to loop.
> Dependent on redefining kernel_read() offset type to loff_t.
> 
> (http://bugzilla.kernel.org/show_bug.cgi?id=13909)
> 
> Cc: stable@...nel.org
> Signed-off-by: Mimi Zohar <zohar@...ibm.com>
> ---
>  security/integrity/ima/ima_crypto.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

These look correct to me (I'll also push them to Linus via git).

Reviewed-by: James Morris <jmorris@...ei.org>

> 
> diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
> index 63003a6..46642a1 100644
> --- a/security/integrity/ima/ima_crypto.c
> +++ b/security/integrity/ima/ima_crypto.c
> @@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest)
>  {
>  	struct hash_desc desc;
>  	struct scatterlist sg[1];
> -	loff_t i_size;
> +	loff_t i_size, offset = 0;
>  	char *rbuf;
> -	int rc, offset = 0;
> +	int rc;
>  
>  	rc = init_desc(&desc);
>  	if (rc != 0)
> @@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest)
>  			rc = rbuf_len;
>  			break;
>  		}
> +		if (rbuf_len == 0)
> +			break;
>  		offset += rbuf_len;
>  		sg_init_one(sg, rbuf, rbuf_len);
>  
> -- 
> 1.6.0.6
> 

-- 
James Morris
<jmorris@...ei.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ