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: <1251149314.22398.8232.camel@nimitz>
Date:	Mon, 24 Aug 2009 14:28:34 -0700
From:	Dave Hansen <dave@...ux.vnet.ibm.com>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [patch 2/4 -mm] flex_array: add flex_array_clear function

On Mon, 2009-08-24 at 13:50 -0700, David Rientjes wrote:
> On Mon, 24 Aug 2009, Dave Hansen wrote:
> > int flex_array_clear(struct flex_array *fa, unsigned int element_nr)
> > {
> > 	void *element = flex_array_get(fa, element_nr);
> > 	memset(element, FLEX_ARRAY_FREE, fa->element_size);
> > }
> > 
> 
> The idea was to eventually be able to distinguish between 
> use-uninitialized and use-after-free and flex_array_clear() was a 
> convenient way of providing an interface to identify the later.  So when 
> an array is fully initialized (or fully cleared after a previous use where 
> all elements we're used), you couldn't do flex_array_clear() on an element 
> before flex_array_put() if its part isn't allocated yet with this 
> implementation.

OK, just to make sure I'm understanding what you are saying.  If we
haven't allocated the 'part' of a given element, then this code is
bogus.  flex_array_get() will return NULL, and we have nothing to
memset().  We effectively need flex_array_get()'s behavior, but we also
need to ensure that there is space for the element allocated if it
wasn't before flex_array_clear() is called.  Right?

I'm not literally saying that we have to use flex_array_get() forever.
But, it does seem that flex_array_clear() could certainly share some
code with the existing functions.  So, instead of just copying those
functions, let's make sure that we refactor them in a way so that we can
reuse the code.

-- Dave

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