Re: memguard monitoring of more than 1 memory_type?

From: Pawel Jakub Dawidek <pjd_at_FreeBSD.org>
Date: Fri, 17 Feb 2006 12:52:02 +0100
On Fri, Feb 10, 2006 at 06:09:19PM +1100, Peter Jeremy wrote:
+> On Thu, 2006-Feb-09 22:55:14 +0100, Pawel Jakub Dawidek wrote:
+> >On Tue, Feb 07, 2006 at 11:14:08AM -0800, Steve Kargl wrote:
+> >+> Thanks for pointing out the obvious.   I've read that manpage several
+> >+> times and somehow missed the word "particular".   It's unfortunate
+> >+> that it can't monitor more than one type of memory allocation because
+> >+> the new pts code has either uncovered a latent bug in devfs or the
+> >+> pts patch is stomping on memory.
+> >
+> >It shouldn't be hard to implement. You need to change function
+> >memguard_cmp() in sys/vm/memguard.c, which decides which memory type
+> >should be monitored.

I'm sorry for the late response...

+> It's quite a bit messier than this.  memguard.c privately stores a
+> record of which memory type is being debugged in vm_memguard_mtype
+> and vm_memguard_desc and doesn't bother passing this information via
+> the alloc/free hooks.

No, no. vm_memguard_desc is only used for fast comparsion, but it is
turned off by default. Anyway, it is only used to decide if specific
allocation should be done on memguard's map.

+> The current kern_malloc code looks like:
+> #ifdef DEBUG_MEMGUARD
+>         if (memguard_cmp(mtp))
+>                 return memguard_alloc(size, flags);
+> #endif
+> If you are going to support multiple memory types, you need to pass
+> mtp to memguard_{alloc,free}() - in which case, you might as well
+> combine memguard_cmp() into these functions.
+> 
+> The easiest way to support multiple memory types is to hang the
+> memguard information off the struct malloc_type - except that means
+> that DEBUG_MEMGUARD changes the kernel ABI.

The only thing that has to be done is to modify memguard_cmp() to
operate on list of memory type short description, IMHO.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd_at_FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Received on Fri Feb 17 2006 - 10:52:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC