selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Zaman <jason@perfinion.com>
To: bill.c.roberts@gmail.com
Cc: selinux@vger.kernel.org, sds@tycho.nsa.gov,
	William Roberts <william.c.roberts@intel.com>
Subject: Re: [V2 PATCH 1/3] Makefile: fix _FORTIFY_SOURCE redefined build error
Date: Thu, 27 Dec 2018 22:29:11 +0800	[thread overview]
Message-ID: <20181227142911.GA14910@baraddur.perfinion.com> (raw)
In-Reply-To: <1545836068-7824-1-git-send-email-william.c.roberts@intel.com>

On Wed, Dec 26, 2018 at 06:54:26AM -0800, bill.c.roberts@gmail.com wrote:
> From: William Roberts <william.c.roberts@intel.com>
> 
> Certain builds of gcc enable _FORTIFY_SOURCE which results in the error:
> <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
> <command-line>:0:0: note: this is the location of the previous definition
> 
> Correct this by undefining it first and redefining it. Also, the previous
> command line option was using -Wp which is passing the value *AS IS* to the
> pre-processor rather than to the compiler driver. The C pre-processor has
> an undocumented interface subject to change per man 1 gcc. Just use the
> -D option to specify this value.
> 
> Signed-off-by: William Roberts <william.c.roberts@intel.com>

Acked-by: Jason Zaman <jason@perfinion.com>

The whole series looks good to me, go ahead and apply it. I dont think
the other parts have had _FORTIFY_SOURCE so after next release (probably
too soon to apply it now?) we might want to add these same warnings to
everything else not only libselinux.

-- Jason

> ---
>  libselinux/src/Makefile   | 2 +-
>  libselinux/utils/Makefile | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 977b5c8cfcca..6263d11393e6 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -64,7 +64,7 @@ ifeq ($(COMPILER), gcc)
>  EXTRA_CFLAGS = -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync-nand \
>  	-Wcoverage-mismatch -Wcpp -Wformat-contains-nul -Wnormalized=nfc -Wsuggest-attribute=const \
>  	-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines -Wjump-misses-init \
> -	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE
> +	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE
>  else
>  EXTRA_CFLAGS = -Wunused-command-line-argument
>  endif
> diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile
> index d06ffd66893b..890ff36f3bbc 100644
> --- a/libselinux/utils/Makefile
> +++ b/libselinux/utils/Makefile
> @@ -30,7 +30,7 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi
>            -Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar \
>            -Woverflow -Wpointer-to-int-cast -Wpragmas \
>            -Wno-missing-field-initializers -Wno-sign-compare \
> -          -Wno-format-nonliteral -Wframe-larger-than=$(MAX_STACK_SIZE) -Wp,-D_FORTIFY_SOURCE \
> +          -Wno-format-nonliteral -Wframe-larger-than=$(MAX_STACK_SIZE) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE \
>            -fstack-protector-all --param=ssp-buffer-size=4 -fexceptions \
>            -fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time \
>            -Werror -Wno-aggregate-return -Wno-redundant-decls \
> -- 
> 2.7.4
> 

  parent reply	other threads:[~2018-12-27 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 14:54 [V2 PATCH 1/3] Makefile: fix _FORTIFY_SOURCE redefined build error bill.c.roberts
2018-12-26 14:54 ` [V2 PATCH 2/3] build: set _FORTIFY_SOURCE=2 in libselinux bill.c.roberts
2018-12-26 14:54 ` [V2 PATCH 3/3] Makefile: add -Wstrict-overflow=5 to CFLAGS bill.c.roberts
2018-12-27 14:29 ` Jason Zaman [this message]
2018-12-31 16:08   ` [V2 PATCH 1/3] Makefile: fix _FORTIFY_SOURCE redefined build error William Roberts

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=20181227142911.GA14910@baraddur.perfinion.com \
    --to=jason@perfinion.com \
    --cc=bill.c.roberts@gmail.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=william.c.roberts@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).