bug-gnustep
[Top][All Lists]
Advanced

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

Re: Problem with NSInvocation on Windows


From: David Chisnall
Subject: Re: Problem with NSInvocation on Windows
Date: Mon, 8 Mar 2010 11:38:29 +0000

Hi Roland,

You forgot to attach the patch, but I'd strongly recommend against applying it 
if you had.  There is a very good reason why NSInvocation allocates an entire 
page: we need to make the region writable when constructing the invocation and 
then executable later.  The VirtualProtect() call only operates on a whole 
page, so if you use this with malloc()'d memory then you will be randomly 
changing the permissions of other allocations.

The patch that you submitted in your second email sets execute permission on an 
entire page, which is a terrible idea and is likely to turn small bugs into 
trivial arbitrary code execution vulnerabilities.  

If you are running out of memory as a result of NSInvocation instances being 
created, then the problem is likely that they are not being deallocated 
correctly.  

David

On 8 Mar 2010, at 10:41, Roland Schwingel wrote:

> Hi...
> 
> There is a problem using NSInvocation on windows. It always allocates a 
> windows native virtual memory page for it's informations. Depending on the 
> windows version such a page can be very big and the number of these pages are 
> limited. If you have a lot of NSInvocation instances this fragments your 
> memory and you can also run out of virtual pages when you are using ffi 
> invocations.
> 
> The attached (trivial) patch fixes this. It allocates pages now using malloc 
> and later on adjusts the allocated memory flags using VirtualProtect().
> 
> Thanks for applying,
> 
> Roland
> 
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep


-- Sent from my IBM 1620





reply via email to

[Prev in Thread] Current Thread [Next in Thread]