Add PAXCTL_FLAG rules for MKSANITIZER

Add per-program rules to disable ASLR for ASan, TSan and MSan in all
sanitized programs. This flag is not needed for other supported sanitizers.

Without this change, sanitized init(8) dies early on startup.

Approach originally suggested by <joerg>
This commit is contained in:
kamil 2019-08-17 00:14:48 +00:00
parent 0da4a66149
commit 92253c7761
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.prog.mk,v 1.321 2019/08/15 08:42:59 kamil Exp $
# $NetBSD: bsd.prog.mk,v 1.322 2019/08/17 00:14:48 kamil Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.ifndef HOSTPROG
@ -452,10 +452,18 @@ PROGNAME.${_P}?= ${_P}
_PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
.endif
# paxctl specific arguments
.if defined(PAXCTL_FLAGS)
PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
.endif
.if ${MKSANITIZER:Uno} == "yes" && \
(${USE_SANITIZER} == "address" || ${USE_SANITIZER} == "thread" || \
${USE_SANITIZER} == "memory")
PAXCTL_FLAGS.${_P}= +a
.endif
##### PROG specific flags.
_DPADD.${_P}= ${DPADD} ${DPADD.${_P}}