From d28cd4fc0891aa02d577a1951f159ae13197aa60 Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 21 Jul 2017 06:52:40 +0000 Subject: MFC r321173: Convert assertion that only vmspace owner grows the stack, into a check blocking grow from other processes accesses. MFC r321230: Disable stack growth when accessed by AIO daemons. --- sys/vm/vm_map.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sys/vm/vm_map.c') diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index c9815c0..3a83252 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -3700,7 +3700,15 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) p = curproc; vm = p->p_vmspace; - MPASS(map == &p->p_vmspace->vm_map); + + /* + * Disallow stack growth when the access is performed by a + * debugger or AIO daemon. The reason is that the wrong + * resource limits are applied. + */ + if (map != &p->p_vmspace->vm_map || p->p_textvp == NULL) + return (KERN_FAILURE); + MPASS(!map->system_map); guard = stack_guard_page * PAGE_SIZE; -- cgit v1.1