From 20c894d21eb64153abf7c7f96e6a151897cf1488 Mon Sep 17 00:00:00 2001 From: Frédéric Bérat Date: Fri, 17 Mar 2023 10:17:28 +0100 Subject: Exclude routines from fortification Since the _FORTIFY_SOURCE feature uses some routines of Glibc, they need to be excluded from the fortification. On top of that: - some tests explicitly verify that some level of fortification works appropriately, we therefore shouldn't modify the level set for them. - some objects need to be build with optimization disabled, which prevents _FORTIFY_SOURCE to be used for them. Assembler files that implement architecture specific versions of the fortified routines were not excluded from _FORTIFY_SOURCE as there is no C header included that would impact their behavior. Reviewed-by: Siddhesh Poyarekar --- stdio-common/Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'stdio-common') diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 8871ec7668..fe304b8373 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -117,6 +117,19 @@ routines := \ wprintf_function_invoke \ # routines +# Exclude fortified routines from being built with _FORTIFY_SOURCE +routines_no_fortify += \ + asprintf \ + dprintf \ + fprintf \ + printf \ + snprintf \ + sprintf \ + vfprintf \ + vfwprintf \ + vprintf \ + # routines_no_fortify + aux := \ errlist \ errlist-data \ @@ -461,7 +474,7 @@ CFLAGS-tst-gets.c += -Wno-deprecated-declarations # BZ #11319 was first fixed for regular vdprintf, then reopened because # the fortified version had the same bug. -CFLAGS-tst-bz11319-fortify2.c += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf -- cgit 1.4.1