diff options
author | kib <kib@FreeBSD.org> | 2017-07-21 06:52:40 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-07-21 06:52:40 +0000 |
commit | d28cd4fc0891aa02d577a1951f159ae13197aa60 (patch) | |
tree | 4045cc2f5281cfef196bde1481fdcc305c20fb05 | |
parent | 11164e3de31acd3c99b7ce76781db35b623b4aa1 (diff) | |
download | FreeBSD-src-d28cd4fc0891aa02d577a1951f159ae13197aa60.zip FreeBSD-src-d28cd4fc0891aa02d577a1951f159ae13197aa60.tar.gz |
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.
-rw-r--r-- | sys/vm/vm_map.c | 10 |
1 files changed, 9 insertions, 1 deletions
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; |