From 71e7d8aacb4f4bc7fc9e9ba94456b80cd0f61427 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 28 Jan 2024 01:07:26 +0000 Subject: [PATCH] Force -fno-stack-protector on "boot block" that absolutely can't have a stack protector (probably not even a -fstack-protector-strong) because the bloat would render them unuseable. This also means the system compiler can now take on any more it wants, and all the pieces which can't use the stack protector are properly marked. ok kettenis --- sys/arch/alpha/stand/Makefile.inc | 4 ++-- sys/arch/alpha/stand/boot/Makefile | 4 ++-- sys/arch/alpha/stand/nboot/Makefile | 5 +++-- sys/arch/alpha/stand/netboot/Makefile | 4 ++-- sys/arch/sparc64/stand/libsa/Makefile | 4 ++-- sys/arch/sparc64/stand/libz/Makefile | 4 ++-- sys/arch/sparc64/stand/ofwboot/Makefile | 6 +++--- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/arch/alpha/stand/Makefile.inc b/sys/arch/alpha/stand/Makefile.inc index 9a068939d77..8555471c40a 100644 --- a/sys/arch/alpha/stand/Makefile.inc +++ b/sys/arch/alpha/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.16 2023/03/11 20:49:33 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.17 2024/01/28 01:07:26 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.8 1997/04/06 08:39:38 cgd Exp $ BINDIR= /usr/mdec @@ -23,7 +23,7 @@ EXTRACFLAGS+= -DHEAP_LIMIT="0x${HEAP_LIMIT}" CFLAGS+= -fno-stack-protector -fno-builtin-printf \ -fno-builtin-vprintf -fno-builtin-putchar \ - -fno-builtin-puts -fno-builtin-exit + -fno-builtin-puts -fno-builtin-exit -fno-stack-protector OBJCOPY?= objcopy STRIP?= strip diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile index f31702acf61..df99e0c850c 100644 --- a/sys/arch/alpha/stand/boot/Makefile +++ b/sys/arch/alpha/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.26 2023/03/11 20:49:33 miod Exp $ +# $OpenBSD: Makefile,v 1.27 2024/01/28 01:07:26 deraadt Exp $ # $NetBSD: Makefile,v 1.17 1997/04/17 07:27:46 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -29,7 +29,7 @@ DEFNS= -DCOMPAT_UFS AFLAGS += -DASSEMBLER ${DEFNS} -fno-pie CPPFLAGS += -I${.CURDIR}/../.. -I${S} ${DEFNS} CFLAGS = -Oz -Werror -mno-fp-regs -fno-pie \ - -msmall-data -msmall-text + -msmall-data -msmall-text -fno-stack-protector ${PROG}.nosym: ${PROG}.sym cp ${PROG}.sym ${PROG}.nosym diff --git a/sys/arch/alpha/stand/nboot/Makefile b/sys/arch/alpha/stand/nboot/Makefile index 71c94b9fa2d..b291a970f83 100644 --- a/sys/arch/alpha/stand/nboot/Makefile +++ b/sys/arch/alpha/stand/nboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2023/03/13 20:20:13 miod Exp $ +# $OpenBSD: Makefile,v 1.3 2024/01/28 01:07:26 deraadt Exp $ # $NetBSD: Makefile,v 1.17 1997/04/17 07:27:46 thorpej Exp $ MAN?= boot.8 @@ -39,7 +39,8 @@ DEFNS= -DCOMPAT_UFS AFLAGS += -DASSEMBLER ${DEFNS} -fno-pie CPPFLAGS += -I${.CURDIR}/../.. -I${.CURDIR} -I${S} ${DEFNS} -CFLAGS = -Oz -Werror -mno-fp-regs -fno-pie -msmall-data -msmall-text +CFLAGS = -Oz -Werror -mno-fp-regs -fno-pie -msmall-data -msmall-text \ + -fno-stack-protector ${PROG}.nosym: ${PROG}.sym cp ${PROG}.sym ${PROG}.nosym diff --git a/sys/arch/alpha/stand/netboot/Makefile b/sys/arch/alpha/stand/netboot/Makefile index 751ee044478..c5d70c78ed0 100644 --- a/sys/arch/alpha/stand/netboot/Makefile +++ b/sys/arch/alpha/stand/netboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2023/03/11 20:49:33 miod Exp $ +# $OpenBSD: Makefile,v 1.20 2024/01/28 01:07:26 deraadt Exp $ # $NetBSD: Makefile,v 1.11 1997/04/17 07:27:50 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -30,7 +30,7 @@ DEFNS= -DPRIMARY_BOOTBLOCK -DSUN_BOOTPARAMS AFLAGS += -DASSEMBLER ${DEFNS} -fno-pie CPPFLAGS += -I${.CURDIR}/../.. -I${S} ${DEFNS} -CFLAGS = -Werror -mno-fp-regs -fno-pie +CFLAGS = -Werror -mno-fp-regs -fno-pie -fno-stack-protector ${PROG}.nosym: ${PROG}.sym cp ${PROG}.sym ${PROG}.nosym diff --git a/sys/arch/sparc64/stand/libsa/Makefile b/sys/arch/sparc64/stand/libsa/Makefile index 76d2541e9ec..787f16aa8d4 100644 --- a/sys/arch/sparc64/stand/libsa/Makefile +++ b/sys/arch/sparc64/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2020/05/25 16:27:07 deraadt Exp $ +# $OpenBSD: Makefile,v 1.16 2024/01/28 01:07:26 deraadt Exp $ LIB= sa @@ -7,7 +7,7 @@ LIB= sa CLEANFILES += machine CFLAGS= ${CEXTRAFLAGS} ${AFLAGS} -O2 -D__INTERNAL_LIBSA_CREAD -nostdinc \ - -fno-pie \ + -fno-pie -fno-stack-protector \ -I${.CURDIR} -I${.CURDIR}/../include -I${.CURDIR}/../.. \ -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. \ -I${.CURDIR}/../../../../lib/libsa \ diff --git a/sys/arch/sparc64/stand/libz/Makefile b/sys/arch/sparc64/stand/libz/Makefile index cd16375cd45..3a1ea035a9e 100644 --- a/sys/arch/sparc64/stand/libz/Makefile +++ b/sys/arch/sparc64/stand/libz/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2022/10/06 23:32:17 kn Exp $ +# $OpenBSD: Makefile,v 1.10 2024/01/28 01:07:26 deraadt Exp $ S=${.CURDIR}/../../../.. ZDST=${.OBJDIR} @@ -6,5 +6,5 @@ ZDST=${.OBJDIR} .PATH: ${S}/lib/libz .include "${S}/lib/libz/Makefile" -CFLAGS+=${CEXTRAFLAGS} ${AFLAGS} -I${S} -fno-pie +CFLAGS+=${CEXTRAFLAGS} ${AFLAGS} -I${S} -fno-pie -fno-stack-protector CPPFLAGS+=-DDYNAMIC_CRC_TABLE -DBUILDFIXED diff --git a/sys/arch/sparc64/stand/ofwboot/Makefile b/sys/arch/sparc64/stand/ofwboot/Makefile index 5907e1371fc..199a5368d18 100644 --- a/sys/arch/sparc64/stand/ofwboot/Makefile +++ b/sys/arch/sparc64/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.27 2019/10/29 02:55:52 deraadt Exp $ +# $OpenBSD: Makefile,v 1.28 2024/01/28 01:07:26 deraadt Exp $ # $NetBSD: Makefile,v 1.2 2001/03/04 14:50:05 mrg Exp $ CURDIR= ${.CURDIR} @@ -37,8 +37,8 @@ SRCS+= aes_xts.c bcrypt_pbkdf.c blowfish.c explicit_bzero.c \ CWARNFLAGS+= -Wno-main AFLAGS+= -Wa,-Av9a -AFLAGS+= -x assembler-with-cpp -D_LOCORE -D__ELF__ -fno-pie -CFLAGS+= ${COPTS} -fno-pie +AFLAGS+= -x assembler-with-cpp -D_LOCORE -D__ELF__ -fno-pie +CFLAGS+= ${COPTS} -fno-pie -fno-stack-protector CPPFLAGS+= -D_STANDALONE -DSUN4U -nostdinc #CPPFLAGS+= -DNETIF_DEBUG -- 2.20.1