This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] BZ #13979- A warning should be issued if FORTIFY_SOURCE isrequested but not enabled
- From: Andreas Jaeger <aj at suse dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 07 May 2012 23:07:00 +0200
- Subject: [PATCH] BZ #13979- A warning should be issued if FORTIFY_SOURCE isrequested but not enabled
From bugzilla:
"If a user requests FORTIFY_SOURCE checking, but for whatever reason the
checks
are not enabled (for example optimizer not enabled), we should issue a
warning."
Tested on x86-64.
Ok to commit?
Andreas
2012-03-30 Jeff Law <law@redhat.com>
* include/features.h: Warn if user requests FORTIFY_SOURCE checking
but the checks are disabled for any reason.
diff --git a/include/features.h b/include/features.h
index c347555..e3ad8b0 100644
--- a/include/features.h
+++ b/include/features.h
@@ -336,6 +336,10 @@
# define __USE_FORTIFY_LEVEL 0
#endif
+#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 &&
__USE_FORTIFY_LEVEL == 0
+# warning _FORTIFY_SOURCE requested but disabled
+#endif
+
/* Get definitions of __STDC_* predefined macros, if the compiler has
not preincluded this header automatically. */
#include <stdc-predef.h>
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126