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: <20080522160851.GC8447@joi>
Date:	Thu, 22 May 2008 18:08:53 +0200
From:	Marcin Slusarz <marcin.slusarz@...il.com>
To:	Johannes Weiner <hannes@...urebad.de>
Cc:	Alexey Dobriyan <adobriyan@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Al Viro <viro@...IV.linux.org.uk>,
	Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not errno
	value

On Mon, May 19, 2008 at 02:11:21PM +0200, Johannes Weiner wrote:
> Hi,
> 
> Alexey Dobriyan <adobriyan@...il.com> writes:
> 
> > On Mon, May 19, 2008 at 01:13:20AM +0200, Johannes Weiner wrote:
> >> Marcin Slusarz <marcin.slusarz@...il.com> writes:
> >> 
> >> > Check at runtime whether error argument of ERR_PTR and ERR_OR_0_PTR
> >> > is valid. It can catch bugs which possibly lead to oops or panic earlier.
> >> >
> >> > Currently there are > 600 calls of ERR_PTR with non-constant argument
> >> > in Linux kernel sources.
> >
> >> > --- a/include/linux/err.h
> >> > +++ b/include/linux/err.h
> >> > @@ -3,6 +3,7 @@
> >> >  
> >> >  #include <linux/compiler.h>
> >> >  
> >> > +#include <asm/bug.h>
> >> >  #include <asm/errno.h>
> >> >  
> >> >  /*
> >> > @@ -21,6 +22,7 @@
> >> >  
> >> >  static inline void *__ERR_PTR(long error)
> >> >  {
> >> > +	WARN_ON(!IS_ERR_VALUE(error));
> >> >  	return (void *) error;
> >> >  }
> >> >  
> >> > @@ -28,6 +30,7 @@ static inline void *__ERR_PTR(long error)
> >> >  
> >> >  static inline void *__ERR_OR_0_PTR(long error)
> >> >  {
> >> > +	WARN_ON(!IS_ERR_VALUE(error) && error);
> >> >  	return (void *) error;
> >> >  }
> >> 
> >> How about WARN_ON_ONCE() instead?  That would warn once for each erroneous user
> >> which should be enough.
> >
> > And blow up .bss ?
> 
> Well, okay.  Perhaps ratelimiting?  I really prefer a bigger image size
> over a spammed dmesg.

Well, when I add 0 as a valid argument for ERR_PTR, this check won't add too many
false positives, so I think simple WARN_ON is safe.

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