public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Brian Gitonga Marete <marete@toshnix.com>,
	Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] [PERF] (Userspace Tools) Fix a compilation error with -fstack-protector and -Werror
Date: Tue, 19 Oct 2010 02:20:31 +0200	[thread overview]
Message-ID: <20101019002030.GD5370@nowhere> (raw)
In-Reply-To: <AANLkTi=Ssz4WdMDXq-93GE9bPHoaQ8QyTSrWXDSCa7eH@mail.gmail.com>

On Tue, Oct 19, 2010 at 03:06:41AM +0300, Brian Gitonga Marete wrote:
> On Tue, Oct 19, 2010 at 2:38 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > On Tue, Oct 19, 2010 at 02:24:00AM +0300, Brian Gitonga Marete wrote:
> >> The following patch fixes compilation of the perf user-space tools on,
> >> for example, gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) . It should not
> >> break anything else.
> >
> >
> >
> > Hi,
> >
> > What kind of warning have you encountered and why it fixes it?
> > Can you describe that in your changelog?
> >
> 
> Hello Frederic,
> 
> Some versions of gcc, e.g. gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4), have
> the (default) minimum size of buffers protected by `-fstack-protector' set
> to 8. But in perf, there exist much smaller automatic buffers.
> 
> This in combination with the -fstack-protector-all, -Werror and
> -Wstack-protector causes the compile to fail for such a compiler.
> 
> The error encountered with the above-mentioned compiler is:
> 
> gcc -o util/ui/util.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6
> -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wformat-y2k -Wshadow
> -Winit-self -Wpacked -Wredundant-decls -Wstack-protector
> -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers
> -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast
> -Wmissing-declarations -Wmissing-prototypes -Wnested-externs
> -Wold-style-definition -Wstrict-prototypes
> -Wdeclaration-after-statement  -fstack-protector-all
> -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Iutil/include
> -Iarch/x86/include -DLIBELF_NO_MMAP -I/usr/include/elfutils
> -DDWARF_SUPPORT -I/usr/include/slang -DSHA1_HEADER='<openssl/sha.h>'
> util/ui/util.c
> cc1: warnings being treated as errors
> util/ui/util.c: In function ‘ui__dialog_yesno’:
> util/ui/util.c:110: error: not protecting function: no buffer at least
> 8 bytes long


Doh! So that was the reason of this warning. Yeah looks like a right fix.
And that fixes the issue for me.

Tested-by: Frederic Weisbecker <fweisbec@gmail.com>

Thanks!


> 
> Signed-off-by: Brian Gitonga Marete <marete@toshnix.com>
> ---
>  tools/perf/Makefile |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 1950e19..64eb2ea 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -288,7 +288,7 @@ endif
>  -include feature-tests.mak
> 
>  ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y)
> -	CFLAGS := $(CFLAGS) -fstack-protector-all
> +	CFLAGS := $(CFLAGS) -fstack-protector-all --param ssp-buffer-size=1
>  endif
> 
> 
> -- 
> 1.6.0.4
> 
> 
> -- 
> Brian Gitonga Marete
> Toshnix Systems
> Tel: +254722151590


  reply	other threads:[~2010-10-19  0:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 23:24 [PATCH] [PERF] (Userspace Tools) Fix a compilation error with -fstack-protector and -Werror Brian Gitonga Marete
2010-10-18 23:38 ` Frederic Weisbecker
2010-10-19  0:06   ` Brian Gitonga Marete
2010-10-19  0:20     ` Frederic Weisbecker [this message]
2010-10-19  6:40     ` Ingo Molnar
2010-10-19  9:03       ` Américo Wang
2010-10-19 11:12       ` Brian Gitonga Marete
2010-10-19 11:33         ` Brian Gitonga Marete
2010-10-19 11:37           ` Brian Gitonga Marete
2010-10-19 11:49           ` Ingo Molnar
2010-10-19 13:11             ` Arnaldo Carvalho de Melo
2010-10-24 21:23               ` [PATCH] Fix a compile error with -fstack-protector, -Wstack-protector " Brian Gitonga Marete
2010-11-11 10:25               ` [PATCH] [PERF] (Userspace Tools) Fix a compilation error with -fstack-protector " Eric Dumazet
2010-11-11 17:05                 ` Arnaldo Carvalho de Melo
2010-11-11 17:13                   ` Eric Dumazet

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=20101019002030.GD5370@nowhere \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marete@toshnix.com \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox