[v2] debug: Fix missing fortify checks in nldbl compat wrappers (bug 34529)
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
fail
|
Test failed
|
| linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
| redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
Commit Message
Re-use debug/tst-fortify to exercise at least some of the build
variants.
---
v2: Inject the additional tests differently, so that debug/Makfiles
produces the required $(gen-locales) dependencies.
sysdeps/ieee754/ldbl-opt/Makefile | 18 ++++++++++++++++++
sysdeps/ieee754/ldbl-opt/nldbl-compat.c | 8 ++++++++
sysdeps/ieee754/ldbl-opt/tst-nldbl-fortify-1.c | 1 +
sysdeps/ieee754/ldbl-opt/tst-nldbl-fortify-2.c | 1 +
4 files changed, 28 insertions(+)
base-commit: 6144ef08960e1db191db2054abef02d361042018
@@ -555,6 +555,24 @@ CFLAGS-tst-nldbl-wscanf-binary-gnu89.c += -mlong-double-64 -std=gnu89 \
endif
+ifeq ($(subdir), debug)
+tests-all-chk += \
+ tst-nldbl-fortify-1 \
+ tst-nldbl-fortify-2
+ # tests
+
+CFLAGS-tst-nldbl-fortify-1.c += -mlong-double-64 \
+ $(no-fortify-source) -D_FORTIFY_SOURCE=1 \
+ -Wno-format -Wno-deprecated-declarations -Wno-error
+
+CFLAGS-tst-nldbl-fortify-2.c += -mlong-double-64 \
+ $(no-fortify-source) -D_FORTIFY_SOURCE=2 \
+ -Wno-format -Wno-deprecated-declarations -Wno-error
+
+$(objpfx)tst-nldbl-fortify-1: $(common-objpfx)math/libnldbl_nonshared.a
+$(objpfx)tst-nldbl-fortify-2: $(common-objpfx)math/libnldbl_nonshared.a
+endif # $(subdir) == debug
+
routines_no_fortify += \
nldbl-asprintf \
nldbl-dprintf \
@@ -517,6 +517,10 @@ __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
if (flag > 0)
mode |= PRINTF_FORTIFY;
+ /* Regardless of the value of flag, let __vsprintf_internal know
+ that this is a call from *printf_chk. */
+ mode |= PRINTF_CHK;
+
va_start (ap, fmt);
ret = __vsprintf_internal (s, slen, fmt, ap, mode);
va_end (ap);
@@ -605,6 +609,10 @@ __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
if (flag > 0)
mode |= PRINTF_FORTIFY;
+ /* Regardless of the value of flag, let __vsprintf_internal know
+ that this is a call from *printf_chk. */
+ mode |= PRINTF_CHK;
+
return __vsprintf_internal (string, slen, fmt, ap, mode);
}
new file mode 100644
@@ -0,0 +1 @@
+#include <debug/tst-fortify.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <debug/tst-fortify.c>