aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-03-17 10:17:28 +0100
committerFrédéric Bérat <fberat@redhat.com>2023-07-05 16:59:48 +0200
commit20c894d21eb64153abf7c7f96e6a151897cf1488 (patch)
tree41038a7e2daf61f19d10f4804313e8e33430046b /libio
parent64d9580cdf7e417170abbef0327e04b29712e949 (diff)
downloadglibc-20c894d21eb64153abf7c7f96e6a151897cf1488.zip
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar.gz
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar.bz2
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 <siddhesh@sourceware.org>
Diffstat (limited to 'libio')
-rw-r--r--libio/Makefile23
1 files changed, 21 insertions, 2 deletions
diff --git a/libio/Makefile b/libio/Makefile
index 2877fec..287ec11 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -53,6 +53,21 @@ routines := \
gen-as-const-headers += libio-macros.sym
+# Exclude fortified routines from being built with _FORTIFY_SOURCE
+routines_no_fortify += \
+ fwprintf \
+ iofgets \
+ iofgets_u \
+ iofgetws \
+ iofgetws_u \
+ swprintf \
+ vasprintf \
+ vsnprintf \
+ vswprintf \
+ vwprintf \
+ wprintf \
+ # routines_no_fortify
+
tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
@@ -165,11 +180,15 @@ CFLAGS-iofgets_u.c += $(config-cflags-wno-ignored-attributes)
CFLAGS-iofputs_u.c += $(config-cflags-wno-ignored-attributes)
# XXX Do we need filedoalloc and wfiledoalloc? Others?
+# Prevent fortification as these are built with -O0
+CFLAGS-tst-bz24051.c += $(no-fortify-source)
+CFLAGS-tst-bz24153.c += $(no-fortify-source)
+
CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\"
# These test cases intentionally use overlapping arguments
-CFLAGS-tst-sprintf-ub.c += -Wno-restrict
-CFLAGS-tst-sprintf-chk-ub.c += -Wno-restrict
+CFLAGS-tst-sprintf-ub.c += -Wno-restrict $(no-fortify-source)
+CFLAGS-tst-sprintf-chk-ub.c += -Wno-restrict $(no-fortify-source)
LDFLAGS-tst-bz24228 = -Wl,--version-script=tst-bz24228.map