aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
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 /sysdeps/ieee754
parent64d9580cdf7e417170abbef0327e04b29712e949 (diff)
downloadglibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar.gz
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar.bz2
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.zip
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 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm-compat/Makefile81
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile29
2 files changed, 94 insertions, 16 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 42cca25a09..34273a5f58 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -88,13 +88,19 @@ tests-internal += test-wprintf-ieee128 test-wprintf-ibm128
CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+# The following tests are setting _FORTIFY_SOURCE internally
tests-internal += test-obstack-ieee128 test-obstack-ibm128
-CFLAGS-test-obstack-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-CFLAGS-test-obstack-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-obstack-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi \
+ $(no-fortify-source)
+CFLAGS-test-obstack-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
+ $(no-fortify-source)
+# The following tests are setting _FORTIFY_SOURCE internally
tests-internal += test-obstack-chk-ieee128 test-obstack-chk-ibm128
-CFLAGS-test-obstack-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-CFLAGS-test-obstack-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-obstack-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi \
+ $(no-fortify-source)
+CFLAGS-test-obstack-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
+ $(no-fortify-source)
tests-internal += test-scanf-ieee128 test-scanf-ibm128
CFLAGS-test-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
@@ -216,25 +222,37 @@ ldbl-extra-routines += asprintf_chk \
obstack_chk \
vobstack_chk
+# The following tests are setting _FORTIFY_SOURCE internally
tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
-CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi \
+ $(no-fortify-source)
+CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
+ $(no-fortify-source)
+# The following tests are setting _FORTIFY_SOURCE internally
tests-internal += test-printf-chk-redir-ieee128 test-printf-chk-redir-ibm128
CFLAGS-test-printf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
- -Wno-psabi -Wno-unused-result
+ -Wno-psabi -Wno-unused-result \
+ $(no-fortify-source)
CFLAGS-test-printf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
- -Wno-unused-result
+ -Wno-unused-result \
+ $(no-fortify-source)
+# The following tests are setting _FORTIFY_SOURCE internally
tests-internal += test-wprintf-chk-ieee128 test-wprintf-chk-ibm128
-CFLAGS-test-wprintf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-CFLAGS-test-wprintf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-wprintf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi \
+ $(no-fortify-source)
+CFLAGS-test-wprintf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
+ $(no-fortify-source)
+# The following tests are setting _FORTIFY_SOURCE internally
tests-internal += test-wprintf-chk-redir-ieee128 test-wprintf-chk-redir-ibm128
CFLAGS-test-wprintf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
- -Wno-psabi -Wno-unused-result
+ -Wno-psabi -Wno-unused-result \
+ $(no-fortify-source)
CFLAGS-test-wprintf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
- -Wno-unused-result
+ -Wno-unused-result \
+ $(no-fortify-source)
endif
ifeq ($(subdir),argp)
@@ -281,13 +299,19 @@ CFLAGS-tst-ieee128-error.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-tst-ieee128-efgcvt.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-tst-ieee128-errorfptr.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+# The following tests are setting _FORTIFY_SOURCE internally
tests-container += test-syslog-ieee128 test-syslog-ibm128
-CFLAGS-test-syslog-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-CFLAGS-test-syslog-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-syslog-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi \
+ $(no-fortify-source)
+CFLAGS-test-syslog-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
+ $(no-fortify-source)
+# The following tests are setting _FORTIFY_SOURCE internally
tests-container += test-syslog-chk-ieee128 test-syslog-chk-ibm128
-CFLAGS-test-syslog-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-CFLAGS-test-syslog-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-syslog-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi \
+ $(no-fortify-source)
+CFLAGS-test-syslog-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
+ $(no-fortify-source)
endif
ifeq ($(subdir),stdlib)
@@ -395,6 +419,31 @@ endif
# Add IEEE binary128 files as make targets.
routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))
+routines_no_fortify += \
+ ieee128-asprintf \
+ ieee128-dprintf \
+ ieee128-fprintf \
+ ieee128-fwprintf \
+ ieee128-obstack \
+ ieee128-printf \
+ ieee128-snprintf \
+ ieee128-sprintf \
+ ieee128-swprintf \
+ ieee128-syslog \
+ ieee128-vasprintf \
+ ieee128-vdprintf \
+ ieee128-vfprintf \
+ ieee128-vfwprintf \
+ ieee128-vobstack \
+ ieee128-vprintf \
+ ieee128-vsnprintf \
+ ieee128-vsprintf \
+ ieee128-vswprintf \
+ ieee128-vsyslog \
+ ieee128-vwprintf \
+ ieee128-wprintf \
+ # routines_no_fortify
+
# On powerpc64le, the routines responsible for converting between long
# double and string (e.g.: printf, scanf, strtold, strfroml) default to
# IBM long double mode. When support for TS 18661-3 was added, several
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
index 22e778ad0e..0ed1cd2cae 100644
--- a/sysdeps/ieee754/ldbl-opt/Makefile
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -269,3 +269,32 @@ CFLAGS-tst-nldbl-wscanf-binary-gnu89.c += -mlong-double-64 -std=gnu89 \
-DOBJPFX=\"$(objpfx)\"
endif
+
+routines_no_fortify += \
+ nldbl-asprintf \
+ nldbl-dprintf \
+ nldbl-fprintf \
+ nldbl-fwprintf \
+ nldbl-obstack_printf \
+ nldbl-obstack_vprintf \
+ nldbl-printf \
+ nldbl-snprintf \
+ nldbl-sprintf \
+ nldbl-swprintf \
+ nldbl-syslog \
+ nldbl-vasprintf \
+ nldbl-vdprintf \
+ nldbl-vfprintf \
+ nldbl-vfwprintf \
+ nldbl-vprintf \
+ nldbl-vsnprintf \
+ nldbl-vsprintf \
+ nldbl-vswprintf \
+ nldbl-vsyslog \
+ nldbl-vwprintf \
+ nldbl-wprintf \
+ # routines_no_fortify
+
+# We can't rely on Makeconfig here for whatever reason
+CFLAGS-.oS += $(call elide-fortify-source,.oS,$(routines_no_fortify))
+CFLAGS-.oS += $(call elide-fortify-source,_chk.oS,$(routines_no_fortify))