From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 18 19:34:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id DACED1065670; Wed, 18 Nov 2009 19:34:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-hackers@freebsd.org Date: Wed, 18 Nov 2009 14:33:46 -0500 User-Agent: KMail/1.6.2 References: <200911171529.20098.sharadc@in.niksun.com> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200911181433.52557.jkim@FreeBSD.org> Cc: Robert Watson , Manprit Singh , Sharad Chandra Subject: Re: mprotect(2) clears the flag for whole page which causes program crash. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2009 19:34:03 -0000 On Wednesday 18 November 2009 01:52 pm, Robert Watson wrote: > On Tue, 17 Nov 2009, Sharad Chandra wrote: > > Is it known bug or is there any workaround? How will a userland > > process make sure that process will not crash as malloc(3) can > > allocate where ever it get the memory free to use. > > mprotect(2) operates on pages, so you'll want to use mmap(2) and > munmap(2) to allocate and free pages directly rather than > mallac(3), which manages byte ranges from pages managed using those > same interfaces. For example: http://docs.freebsd.org/cgi/mid.cgi?200911181926.nAIJQHOR081471 Jung-uk Kim