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]
Date:	Mon, 28 Apr 2014 14:41:26 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	walter harms <wharms@....de>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Peng Tao <bergwolf@...il.com>,
	Andreas Dilger <andreas.dilger@...el.com>,
	Oleg Drokin <oleg.drokin@...el.com>,
	"John L. Hammond" <john.hammond@...el.com>,
	Dmitry Eremin <dmitry.eremin@...el.com>,
	Jinshan Xiong <jinshan.xiong@...el.com>,
	Dulshani Gunawardhana <dulshani.gunawardhana89@...il.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [patch 2/2 v2] staging: lustre: integer overflow in
 obd_ioctl_is_invalid()

On Mon, Apr 28, 2014 at 01:35:19PM +0200, walter harms wrote:
> 
> 
> Am 28.04.2014 12:58, schrieb Dan Carpenter:
> > The obd_ioctl_getdata() function caps "data->ioc_len" at
> > OBD_MAX_IOCTL_BUFFER and then calls this obd_ioctl_is_invalid() to check
> > that the other values inside data are valid.
> > 
> > There are several lengths inside data but when they are added together
> > they must not be larger than "data->ioc_len".  The checks against
> > "(data->ioc_inllen1 > (1<<30))" are supposed to ensure that the addition
> > does not have an integer overflow.  But "(1<<30) * 4" actually can
> > overflow 32 bits, so the checks are insufficient.
> > 
> > I have changed it to "> OBD_MAX_IOCTL_BUFFER" instead.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> > ---
> > v2: Updated the error messages as Walter Harms pointed out.
> > 
> > diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
> > index bdc9812..3c26bbd 100644
> > --- a/drivers/staging/lustre/lustre/include/lustre_lib.h
> > +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
> > @@ -179,24 +179,25 @@ static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
> >  
> >  static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
> >  {
> > -	if (data->ioc_len > (1<<30)) {
> > -		CERROR("OBD ioctl: ioc_len larger than 1<<30\n");
> > +	if (data->ioc_len > OBD_MAX_IOCTL_BUFFER) {
> > +		CERROR("OBD ioctl: ioc_len larger than %d\n",
> > +		       OBD_MAX_IOCTL_BUFFER);
> >  		return 1;
> >  	}
> > -	if (data->ioc_inllen1 > (1<<30)) {
> > -		CERROR("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
> > +	if (data->ioc_inllen1 > OBD_MAX_IOCTL_BUFFER) {
> > +		CERROR("OBD ioctl: ioc_inllen1 larger than ioc_len\n");
> >  		return 1;
> >  	}
> 
> The error mention ioc_len the compare is OBD_MAX_IOCTL_BUFFER ?
> Is that intentional ?

Yep.

regards,
dan carpenter

--
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