File: 03_apply_hardening_to_tests.diff

package info (click to toggle)
axc 0.3.7-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: ansic: 3,751; makefile: 143
file content (32 lines) | stat: -rw-r--r-- 2,216 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Evangelos Ribeiro Tzaras <devrtz@fortysixandtwo.eu>
Date: Thu, 20 Mar 2025 20:46:22 +0100
Subject: tests: Apply missing hardening flags to tests

Origin: vendor
Last-Update: 2025-03-20

Otherwise blhc complains:

CFLAGS missing (-fstack-clash-protection -fcf-protection): x86_64-linux-gnu-gcc -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread    -I/usr/include/signal  -g -O0 --coverage -Wall -Wextra -Wpedantic -Wstrict-overflow -fstack-protector-strong -Wformat -Werror=format-security -o test/test_store.o  test/test_store.c src/axc_crypto.c -lcmocka -Wl,-z,relro -Wl,-z,now -pthread -ldl -lglib-2.0  -lsqlite3  -lgcrypt  -lsignal-protocol-c -lprotobuf-c  -lm
CFLAGS missing (-fstack-clash-protection -fcf-protection): x86_64-linux-gnu-gcc -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread    -I/usr/include/signal  -g -O0 --coverage -Wall -Wextra -Wpedantic -Wstrict-overflow -fstack-protector-strong -Wformat -Werror=format-security -o test/test_client.o src/axc_crypto.c test/test_client.c -lcmocka -Wl,-z,relro -Wl,-z,now -pthread -ldl -lglib-2.0  -lsqlite3  -lgcrypt  -lsignal-protocol-c -lprotobuf-c  -lm
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: axc-0.3.7/Makefile
===================================================================
--- axc-0.3.7.orig/Makefile
+++ axc-0.3.7/Makefile
@@ -64,7 +64,11 @@ CPPFLAGS += -D_XOPEN_SOURCE=700 -D_BSD_S
 CFLAGS += $(PKGCFG_C) -std=c11 -g -Wall -Wextra -Wpedantic \
 	  -Wstrict-overflow -fno-strict-aliasing -funsigned-char \
 	  -fno-builtin-memset -fstack-protector-strong -Wformat -Werror=format-security
-TESTFLAGS=$(PKGCFG_C) -g -O0 --coverage -Wall -Wextra -Wpedantic -Wstrict-overflow -fstack-protector-strong -Wformat -Werror=format-security
+TESTFLAGS=$(PKGCFG_C) -g -O0 --coverage -Wall -Wextra -Wpedantic -Wstrict-overflow -fstack-protector-strong -Wformat -Werror=format-security -fstack-clash-protection
+ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),amd64 i386))
+TESTFLAGS += -fcf-protection
+endif
+
 LDFLAGS += -pthread -ldl $(PKGCFG_L) -lm
 LDFLAGS_T= -lcmocka $(LDFLAGS)
 PICFLAGS=-fPIC $(CFLAGS)