multipath-tools: Replace -fstack-protector with -fstack-protector-strong
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 multipath-tools: Replace -fstack-protector with -fstack-protector-strong
-fstack-protector-strong
Like -fstack-protector but includes additional functions to be protected --- those that have local array definitions, or have references to local frame addresses.
gcc-4.9.0(April 22, 2014) required.
This flag is used by default in Fedora:
https://pagure.io/fesco/issue/1128
--- Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.inc +1 -1
@@ -63,7 +63,7 @@ INSTALL_PROGRAM = install OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 \ -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \ - -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector \ + -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong \ --param=ssp-buffer-size=4 CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
Signature · 1 line
2.11.0
PATCH 2/2 multipath-tools: Add -Werror compilation flags
In reply to a message not in the archiveAdd -Werror=format-security: GCC will refuse to compile code that could be vulnerable to a string format security flaw. At present, this warns about calls to "printf" and "scanf" from untrusted input and contains %n.
Add -Werror=implicit-function-declaration: Implicit function declarations allows a programmer to call functions without declaring them (or including the relevant header files). The official C language specification has not supported implicit function declarations for almost two decades now. GCC still supports them as a GNU extension. Implicit function declarations introduce bugs because these functions use a different calling convention and have a fixed return type of int. Resulting issues are pointer truncation (on 64-bit architectures), exposure of padding bits (particular for bool-returning functions on x86_64), and unexpected lack of hardening. Implicit function declarations are not part of C++ (with or without GNU extensions), and adjusting C code accordingly simplifies reuse in C++ projects.
Add -Werror=implicit-int: Implicit ints were removed from the C programming language at the same time as implicit function definitions, and were also retained as a GNU extension. Implicit ints are usually source code bugs, and the presence of such code may interfere with future C language directions (for example, consider how C++ reused the auto keyword and an omitted type specifier).
These flags are used by default in Fedora. More info:
https://fedoraproject.org/wiki/Changes/FormatSecurity
https://fedoraproject.org/wiki/Format-Security-FAQ
https://fedoraproject.org/wiki/Changes/Fedora26CFlags
--- Makefile.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile.inc +2 -1
@@ -61,7 +61,8 @@ RM = rm -f LN = ln -sf INSTALL_PROGRAM = install -OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 \ +OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \ + -Werror=implicit-function-declaration -Werror=format-security \ -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \ -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong \ --param=ssp-buffer-size=4
Signature · 1 line
2.11.0