aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-08-08 16:48:19 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-08-08 16:48:19 +0000
commit10ae16c7fef61f980bd8883564c2ce02be29ae94 (patch)
treea1781a8e2a5d86147bc75e15ebd8701041c5fc94 /sys
parentb706be23b495ad8aed1cefdcf7cfdece305f8ed1 (diff)
downloadsrc-10ae16c7fef61f980bd8883564c2ce02be29ae94.tar.gz
src-10ae16c7fef61f980bd8883564c2ce02be29ae94.zip
Fix stack grow for init.
During early stages of kern_exec(), including strings copyout, p_textvp for init is NULL. This prevented stack grow from working for init execution. Without stack gap enabled, initial stack segment size is enough for strings passed by kernel to init. With the gap enabled, the used address might fall out of the initial segment, which kills init. Exclude initproc from the check for contexts which should not cause stack grow in the target map. Sponsored by: The FreeBSD Foundation MFC after: 1 week
Notes
Notes: svn path=/head/; revision=350758
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_map.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index a0173105683e..ad66e2d4a97b 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -4217,7 +4217,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry)
* 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)
+ if (p != initproc && (map != &p->p_vmspace->vm_map ||
+ p->p_textvp == NULL))
return (KERN_FAILURE);
MPASS(!map->system_map);