[M3devel] munmap in user threads?

Jay K jay.krell at cornell.edu
Tue Nov 3 16:04:48 CET 2009


yep, sorry, and adjusting it as I suggested makes it fail

 

 - Jay

 


From: hosking at cs.purdue.edu
To: jay.krell at cornell.edu
Date: Tue, 3 Nov 2009 10:02:06 -0500
CC: m3devel at elegosoft.com
Subject: Re: [M3devel] munmap in user threads?

No, notice how ss holds the original allocated space.  Whereas uc gets the adjusted values for passing to makecontext.





Antony Hosking | Associate Professor | Computer Science | Purdue University
305 N. University Street | West Lafayette | IN 47907 | USA
Office +1 765 494 6001 | Mobile +1 765 427 5484



On 3 Nov 2009, at 08:23, Jay K wrote:

Tony,


void DisposeContext (Context **c)
{
  if (munmap((*c)->ss.ss_sp, (*c)->ss.ss_size)) abort();
  free(*c);
  *c = NULL;
}

Should that be (char*)ss_sp - pagesize, ss_size + 2 * pagesize?
Or ok asis?
Should there be checks for *c == NULL, or ss_sp == NULL?
I think it is ok -- assuming the data isn't available to safe code that could double dispose it.
 
 - Jay

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091103/6aa28062/attachment-0002.html>


More information about the M3devel mailing list