[libvirt] [PATCH] FreeBSD: disable buggy -fstack-protector-all

Daniel P. Berrange berrange at redhat.com
Wed May 15 16:01:36 UTC 2013


On Wed, May 15, 2013 at 07:41:49PM +0400, Roman Bogorodskiy wrote:
> FreeBSD ships an old gcc 4.2.1 which generates
> bogus code, e.g. getsockopt() call returns
> struct xucred with bogus values, which doesn't even
> allow to connect to libvirtd:
> 
> error: Failed to find group record for gid '1284660778': No error: 0
> 
> So roll back to just -fstack-protector on FreeBSD.
> ---
>  m4/virt-compile-warnings.m4 | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index dc0e7d7..ce4e244 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -191,7 +191,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
>      dnl on Mingw32, but fails when actually used
>      case $host in
> -       *-*-linux*|*-*-freebsd*)
> +       *-*-linux*)
>         dnl Fedora only uses -fstack-protector, but doesn't seem to
>         dnl be great overhead in adding -fstack-protector-all instead
>         dnl gl_WARN_ADD([-fstack-protector])
> @@ -205,6 +205,13 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>         dnl off the following clang specific warning
>         gl_WARN_ADD([-Wno-unused-command-line-argument])
>         ;;
> +       *-*-freebsd*)
> +       dnl FreeBSD ships old gcc 4.2.1 which doesn't handle
> +       dnl -fstack-protector-all well
> +       gl_WARN_ADD([-fstack-protector])
> +
> +       gl_WARN_ADD([-Wno-unused-command-line-argument])
> +       ;;
>      esac
>      gl_WARN_ADD([-fexceptions])
>      gl_WARN_ADD([-fasynchronous-unwind-tables])

ACK, 


Best we can tell is that the GCC in FreeBSD is mangling arrays that
occurs inside the xcred struct when using stack-protector-all.

It is possible the same version of GCC does this on Linux too, but
no one still seriously uses the 6 year old 4.2.x release, apart
from perhaps enterprise distros, who would likely have fixed the
buggy gcc anyway.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list