DragonFly kernel List (threaded) for 2008-06
DragonFly BSD
DragonFly kernel List (threaded) for 2008-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ocstat


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 Jun 2008 10:32:15 -0700 (PDT)

:We could enable invariant functions on the objcache, i.e. checking for=20
:conformity on put and get (detects tampering while free and with a flag, =
:
:detects double free).  In itself it would be quite hard to detect a doubl=
:e=20
:free, as we are storing typed objects and thus we can't change anything i=
:n=20
:the object to signal "has been freed".
:
:cheers
:   simon

     I think we could do this fairly easily.  Because the structures are
     typed the objcache could be 'told' which offset within the structure
     it is allowed to use to store its free marker and what value it should
     use.  Something like this:

     objcache_marker(oc, offset_of_marker, marker_flag)

	The objcache will set the specified flag at the specified offset
	within the object when freeing the object, and clear the flag
	upon allocation.  The flag is typically a bit and the offset is
	typically the offset of an integer flags field within the object.

	The flag must not normally be set in an active object.

	Objcache will use the flag to detect double-frees.

						-Matt




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]