NetBSD/sys/conf/ssp.mk
kamil 0fe7e51662 Add KCOV - kernel code coverage tracing device
The KCOV driver implements collection of code coverage inside the kernel.
It can be enabled on a per process basis from userland, allowing the kernel
program counter to be collected during syscalls triggered by the same
process.

The device is oriented towards kernel fuzzers, in particular syzkaller.

Currently the only supported coverage type is -fsanitize-coverage=trace-pc.

The KCOV driver was initially developed in Linux. A driver based on the
same concept was then implemented in FreeBSD and OpenBSD.

Documentation is borrowed from OpenBSD and ATF tests from FreeBSD.

This patch has been prepared by Siddharth Muralee, improved by <maxv>
and polished by myself before importing into the mainline tree.

All ATF tests pass.
2019-02-23 03:10:05 +00:00

33 lines
866 B
Makefile

# $NetBSD: ssp.mk,v 1.4 2019/02/23 03:10:06 kamil Exp $
.if ${USE_SSP:Uno} == "yes"
COPTS.kern_ssp.c+= -fno-stack-protector -D__SSP__
.endif
# for multi-cpu machines, cpu_hatch() straddles the init of
# __stack_chk_guard, so ensure stack protection is disabled
.if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
COPTS.cpu.c+= -fno-stack-protector
.endif
COPTS.subr_kleak.c+= -fno-stack-protector
COPTS.subr_kcov.c+= -fno-stack-protector
# The following files use alloca(3) or variable array allocations.
# Their full name is noted as documentation.
VARSTACK= \
arch/xen/i386/gdt.c \
dev/ic/aic79xx.c \
dev/ic/aic7xxx.c \
dev/usb/xhci.c \
dev/ofw/ofw_subr.c \
kern/uipc_socket.c \
miscfs/genfs/genfs_vnops.c \
nfs/nfs_bio.c \
uvm/uvm_bio.c \
uvm/uvm_pager.c \
.for __varstack in ${VARSTACK}
COPTS.${__varstack:T} += -Wno-stack-protector
.endfor