[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201301181241.24082.vapier@gentoo.org>
Date: Fri, 18 Jan 2013 12:41:23 -0500
From: Mike Frysinger <vapier@...too.org>
To: "David Laight" <David.Laight@...lab.com>
Cc: stephen.hemminger@...tta.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] [iproute] ipxfrm: use alloca to allocate stack space
On Friday 18 January 2013 05:00:53 David Laight wrote:
> > Clang doesn't support the gcc extension for embeddeding flexible arrays
> > inside of structures. Use the slightly more portable alloca().
> >
> > Signed-off-by: Mike Frysinger <vapier@...too.org>
> > ---
> > v2
> > - use alloca rather than flexible arrays in structures
> ...
> > +#include <alloca.h>
>
> I'm not sure what happens in Linux, but alloca.h is likely
> to try to use the libc version of alloca().
> While that worked 20 years ago, these days compilers then
> to use %sp relative addressing so you must only use the
> compiler builtin alloca() code.
>
> With gcc, compiling with -std=c89 (I think that is the one)
> causes the builtin alloca() not to be defined.
> By default alloca() is part of the language and the header
> isn't needed.
>
> Use of alloca() also stops some of the stack overwrite
> protection being enabled.
seems like a short coming of the C library then ? with glibc, if it detects
the active compiler is gcc, it will define alloca() to the gcc builtin.
-mike
Download attachment "signature.asc " of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists