summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-09-09 20:02:28 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-09-09 20:02:28 +0000
commita0258cfaca2842e071c42088e9041699bd79b414 (patch)
treedf4abf3faddad02913ffaa864146f6e74a231cfa /sys/uvm
parent59e994ee8a1a1edcf89e9aa49e2dd4586bda90b7 (diff)
Inform about system call memory write protection and stack mapping
violations in system accounting. This will help to find missbehaving programs and possible attacks. The flags bit field is full, so recycle the PDP-11 compatibility on VAX. lastcomm(1) prints the AMAP flag as 'M'. daily(8) prints a list of affected processes. OK deraadt@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_map.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index bd072c50fb0..dc4199743b6 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.246 2019/06/14 05:52:43 deraadt Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.247 2019/09/09 20:02:26 bluhm Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -86,6 +86,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/acct.h>
#include <sys/mman.h>
#include <sys/proc.h>
#include <sys/malloc.h>
@@ -1872,6 +1873,7 @@ uvm_map_inentry(struct proc *p, struct p_inentry *ie, vaddr_t addr,
if (!ok) {
printf(fmt, p->p_p->ps_comm, p->p_p->ps_pid, p->p_tid,
addr, ie->ie_start, ie->ie_end);
+ p->p_p->ps_acflag |= AMAP;
sv.sival_ptr = (void *)PROC_PC(p);
trapsignal(p, SIGSEGV, 0, SEGV_ACCERR, sv);
}