Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Add PAXCTL_FLAG rules for MKSANITIZER



details:   https://anonhg.NetBSD.org/src/rev/0fead5ec375b
branches:  trunk
changeset: 463294:0fead5ec375b
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Aug 17 00:14:48 2019 +0000

description:
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>

diffstat:

 share/mk/bsd.prog.mk |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r ff7647c71db2 -r 0fead5ec375b share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk      Fri Aug 16 23:07:20 2019 +0000
+++ b/share/mk/bsd.prog.mk      Sat Aug 17 00:14:48 2019 +0000
@@ -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 @@
 _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}}



Home | Main Index | Thread Index | Old Index