From owner-cvs-all@FreeBSD.ORG Wed Feb 16 01:35:55 2005 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 716FF16A4D2 for ; Wed, 16 Feb 2005 01:35:55 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 533C543D41 for ; Wed, 16 Feb 2005 01:35:54 +0000 (GMT) (envelope-from bosko.milekic@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so8599wra for ; Tue, 15 Feb 2005 17:35:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Gl6TMPNOhHkdNffOJtbh6x7lpJRu8FvHqjCRfszzo/Ocm1rxyHPYa36I9Ygf9o9t+Chfo+bTgrgJWjOYxZA7RH6S97DFEwBAcS3EEsURma7o2KQEL7lMLn5tpN963JNkizo82JKTJrKw6coFXnTHRlCIrUMOwbYaWk/j9565Vu4= Received: by 10.54.32.72 with SMTP id f72mr37058wrf; Tue, 15 Feb 2005 17:35:53 -0800 (PST) Received: by 10.54.24.68 with HTTP; Tue, 15 Feb 2005 17:35:53 -0800 (PST) Message-ID: Date: Tue, 15 Feb 2005 20:35:53 -0500 From: Bosko Milekic To: Julian Elischer In-Reply-To: <421287CD.1080106@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <200502152217.j1FMH7Qf054657@repoman.freebsd.org> <20050215224018.GJ32955@elvis.mu.org> <421287CD.1080106@elischer.org> cc: cvs-src@freebsd.org cc: Alfred Perlstein cc: src-committers@freebsd.org cc: Bosko Milekic cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/vm memguard.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Bosko Milekic List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2005 01:35:55 -0000 On Tue, 15 Feb 2005 15:37:49 -0800, Julian Elischer wrote: > > > Alfred Perlstein wrote: > > >Where can I read more about this feature? :) > > > > You have to nail Boscoe to a sheet of 1m x 2m plywood and subject him to > crude borg mind reading techniques. > > The upside is that if you succeed we get to do the same to you to find > out what you learned. :-) I believe that this will be unnecessary. Christian Brueffer is going to write the first version of a memguard(9) man page and we will update it thereafter. Right now, MemGuard allows you to override particular malloc type allocations. If you look at kern_malloc.c and search for "XXX CHANGEME" you will find ifdef'd code that checks for M_SUBPROC and thereby overrides M_SUBPROC allocations with MemGuard. So, suppose you suspect a tamper-after-free race involving M_INODEDEP buffers; what you can do for now is un-staticize the M_INODEDEP MALLOC_DEFINE, drop a MALLOC_DECLARE in malloc.h (so that M_INODEDEP is visible from kern_malloc.c), and replace those == M_SUBPROC comparisons in kern_malloc.c to == M_INODEDEP comparisons. Then put "options DEBUG_MEMGUARD" in your kernel config and build and install a new kernel. During early bootup, you should see something like this: MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: MEMGUARD map base: 0xc53e6000 MEMGUARD map limit: 0xc73e7000 MEMGUARD map size: 33558528 (Bytes) This will confirm that MemGuard is indeed running. I'd like to get MemGuard to accept a boot-time tunable way of configuring which malloc type(s) to override, but this is yet to be implemented. Similarly, it would be worth getting MemGuard to also override certain UMA zone allocations. For further details, either glance at src/sys/vm/memguard.c or wait for the man page. -- Bosko Milekic - If I were a number, I'd be irrational. Contact Info: http://bmilekic.unixdaemons.com/contact.txt