All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH 1/2] libs/gnttab: do not use alloca(3)
Date: Mon, 22 Aug 2016 11:44:07 +0100	[thread overview]
Message-ID: <20160822104407.GU20641@citrix.com> (raw)
In-Reply-To: <57BAD2F8.2070303@citrix.com>

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@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-22 10:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 14:33 [PATCH 0/2] tools/libs: don't use alloca(3) Wei Liu
2016-08-17 14:33 ` [PATCH 1/2] libs/gnttab: do not " Wei Liu
2016-08-22  9:46   ` David Vrabel
2016-08-22 10:10     ` Wei Liu
2016-08-22 10:24       ` David Vrabel
2016-08-22 10:44         ` Wei Liu [this message]
2016-08-17 14:33 ` [PATCH 2/2] libs/foreignmemory: " Wei Liu
2016-08-17 23:39 ` [PATCH 0/2] tools/libs: don't " Dario Faggioli
2016-08-18  9:29   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160822104407.GU20641@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.