From: kettenis Date: Sun, 9 Apr 2023 19:48:37 +0000 (+0000) Subject: So clang 13 miscompiles dev/usb/umass_scsi.c with the combination if -Oz X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fcf1774824c54da91f0bcc86ea07983a1f305fe8;p=openbsd So clang 13 miscompiles dev/usb/umass_scsi.c with the combination if -Oz and -mbranch-protection=bti. So turn off the BTI protection in ramdisk kernels for now. ok deraadt@, miod@, phessler@ --- diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c index edda6e8fe9a..beb0bd7f5c0 100644 --- a/sys/arch/arm64/arm64/pmap.c +++ b/sys/arch/arm64/arm64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.93 2023/03/27 19:02:47 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.94 2023/04/09 19:48:37 kettenis Exp $ */ /* * Copyright (c) 2008-2009,2014-2016 Dale Rahn * @@ -1688,8 +1688,10 @@ pmap_pte_update(struct pte_desc *pted, uint64_t *pl3) else access_bits = ap_bits_user[pted->pted_pte & PROT_MASK]; +#ifndef SMALL_KERNEL if (pm == pmap_kernel()) access_bits |= ATTR_GP; +#endif pte = (pted->pted_pte & PTE_RPGN) | attr | access_bits | L3_P; *pl3 = access_bits ? pte : 0; diff --git a/sys/arch/arm64/conf/Makefile.arm64 b/sys/arch/arm64/conf/Makefile.arm64 index 6bd73a674f6..1719e3d045d 100644 --- a/sys/arch/arm64/conf/Makefile.arm64 +++ b/sys/arch/arm64/conf/Makefile.arm64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.arm64,v 1.45 2023/03/27 19:02:47 kettenis Exp $ +# $OpenBSD: Makefile.arm64,v 1.46 2023/04/09 19:48:37 kettenis Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -61,7 +61,7 @@ CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option CMACHFLAGS= -march=armv8-a+nofp+nosimd \ -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer \ - -ffixed-x18 -mbranch-protection=bti + -ffixed-x18 CMACHFLAGS+= -ffreestanding ${NOPIE_FLAGS} SORTR= sort -R .if ${IDENT:M-DNO_PROPOLICE} @@ -70,6 +70,9 @@ CMACHFLAGS+= -fno-stack-protector .if ${IDENT:M-DSMALL_KERNEL} SORTR= cat COPTIMIZE?= -Oz +CMACHFLAGS+= -mbranch-protection=none +.else +CMACHFLAGS+= -mbranch-protection=bti .endif DEBUG?= -g