freebsd-dev/sys/arm64/include
Mark Johnston 03bf40c5d8 arm64: Disable per-thread stack-smashing protection in data_abort()
With PERTHREAD_SSP configured, the compiler's stack-smashing protection
uses a per-thread canary value instead of a global value.  The value is
stored in td->td_md.md_canary; the sp_el0 register always contains a
pointer to that value, and certain functions selected by the compiler
will store the canary value on the stack as a part of the function
prologue (and will verify the copy as part of the epilogue).  In
particular, the thread structure may be accessed.

This happens to occur in data_abort(), which leads to the same problem
addressed by commit 2c10be9e06 ("arm64: Handle translation faults for
thread structures").  This commit fixes that directly, by disabling SSP
in data_abort() and a couple of related functions by using a function
attribute.  It also moves the update of sp_el0 out of C code in case
the compiler decides to start checking the canary in pmap_switch()
someday.

A different solution might be to move the canary value to the PCB, which
currently lives on the kernel stack and isn't subject to the same
problem as thread structures (if only because guard pages inhibit
superpage promotion).  However, there isn't any particular reason the
PCB has to live on the stack today; on amd64 it is embedded in struct
thread, reintroducing the same problem.  Keeping the reference canary
value at the top of the stack is also rather dubious since it could be
clobbered by a sufficiently large stack overflow.

A third solution could be to go back to the approach of commit
5aa5420ff2, and modify UMA to use the direct map for thread structures
even if KASAN is enabled.  But, transient promotions and demotions in
the direct map are possible too.

Reviewed by:	alc, kib, andrew
MFC after:	1 month
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37255
2022-11-07 16:05:58 -05:00
..
_align.h
_bus.h
_inttypes.h
_limits.h
_stdint.h
_types.h
acpica_machdep.h
armreg.h Decode the arm64 ID_AA64ISAR1_EL1 register 2022-09-06 16:49:36 +01:00
asm.h
atomic.h
bus_dma_impl.h
bus_dma.h
bus.h arm64: bus: provide bus_space_set_{multi,region}_stream definitions 2022-09-26 14:24:37 -05:00
clock.h
cmn600_reg.h Add support of ARM CMN-600 controller, PMU access functions only. Add support of PMU counters of ARM CMN-600 controller. 2022-06-26 22:03:04 +03:00
counter.h
cpu.h Add more Arm CPUs to the arm64 cpu ident 2022-10-11 14:01:16 +01:00
cpufunc.h Add an IDC only arm64 icache sync function 2022-08-25 12:17:28 +01:00
csan.h
db_machdep.h
debug_monitor.h
disassem.h
dump.h
efi.h
elf.h arm, arm64: tweak hard-coded load addresses for PIE binaries 2022-10-25 19:00:44 +03:00
endian.h
exec.h
float.h
floatingpoint.h
fpu.h
frame.h
gdb_machdep.h
hypervisor.h Mark 64-bit arm64 hypervisor registers with UL 2022-10-11 14:01:16 +01:00
ieeefp.h
ifunc.h
in_cksum.h machine/in_cksum.h: don't include sys/cdefs.h 2022-04-18 21:02:19 +01:00
intr.h
iodev.h
iommu.h
kdb.h
machdep.h Remove unneeded variables in the arm64 pmap bootstrap 2022-09-27 14:47:30 +01:00
md_var.h
memdev.h
metadata.h
minidump.h Make page size dynamic in libkvm for arm64 2022-03-15 09:52:15 +00:00
ofw_machdep.h
param.h arm64: Disable per-thread stack-smashing protection in data_abort() 2022-11-07 16:05:58 -05:00
pcb.h Move the non-exported PCB_FP_* flags to the upper bits 2022-09-08 14:23:20 +01:00
pci_cfgreg.h
pcpu_aux.h
pcpu.h Store mpidr as a 64-bit value on arm64 2022-08-31 11:48:31 +01:00
pmap.h sys: Consolidate common implementation details of PV entries. 2022-10-07 10:14:03 -07:00
pmc_mdep.h Allocate event for DMC-620 and CMN-600 controllers PMU. Add events supported by DMC-620 and CMN-600 controllers PMU. 2022-06-26 21:52:26 +03:00
proc.h
procctl.h
profile.h Remove checks for __GNUCLIKE_ASM assuming it is always true. 2022-04-12 10:05:45 -07:00
psl.h
pte.h Disable promotion on pcpu memory on arm64 2022-08-16 15:41:24 +01:00
ptrace.h arm64: Implement cpu_ptrace(). 2022-10-27 23:25:56 +02:00
reg.h
reloc.h
resource.h
runq.h
setjmp.h
sf_buf.h
sigframe.h
signal.h
smp.h
stack.h
stdarg.h
sysarch.h
tls.h
trap.h
ucontext.h
undefined.h
vdso.h
vfp.h Split out vfp_new_thread 2022-06-29 15:15:43 +01:00
vm.h
vmparam.h