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

Re: [Xen-devel] [PATCH 1/2] libs/gnttab: do not use alloca(3)



On Mon, Aug 22, 2016 at 11:24:56AM +0100, David Vrabel wrote:
> On 22/08/16 11:10, Wei Liu wrote:
> > On Mon, Aug 22, 2016 at 10:46:50AM +0100, David Vrabel wrote:
> >> On 17/08/16 15:33, Wei Liu wrote:
> >>> The semantics of alloca(3) is not very nice. If the stack overflows,
> >>> program behaviour is undefined.
> >>>
> >>> Remove the use of alloca(3) and always use mmap.
> >>
> >> This is only using alloca() if the allocation is < PAGE_SIZE.  I think
> >> assuming there's this much extra stack is fine.
> >>
> > 
> > A library is not in a position assume how deep the stack is IMHO.
> 
> This suggests a library cannot use any stack, which is clearly silly.
> 

Of course not. Please don't take my words out of context and further
imply things I never said. This is not how a conversation should work
out. And name calling is toxic. Please just stop.

I care about the undefined behaviour aspect of alloca -- I believe you
dislike that as much as I do.

> But ok, in which case you should consider using malloc() instead of
> alloca()/mmap(), then small allocation might come out of some
> pre-existing or cached allocations.
> 

Ok, that seems sensible.

Wei.

> David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.