From 0caf6628778d6ea23ef869606d2baf4ec2d43eef Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 21 Feb 2017 12:32:51 -0800 Subject: [PATCH] kernel - Disallow remote growstack from procfs * Do not allow procfs operations to grow the stack of a remote process, at least for now, because we are not passing in the struct vmspace * pointer, for now. * Fixes trivial panic caused by ps -e due to the recent addition of an assertion to test the condition that failed (the assertion is correct). --- sys/vm/vm_map.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index ffc4fa6eaa..d6598d44f4 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -3767,7 +3767,15 @@ vm_map_growstack (vm_map_t map, vm_offset_t addr) p = curthread->td_proc; KKASSERT(lp != NULL); vm = lp->lwp_vmspace; - KKASSERT(map == &vm->vm_map); + + /* + * Growstack is only allowed on the current process. We disallow + * other use cases, e.g. trying to access memory via procfs that + * the stack hasn't grown into. + */ + if (map != &vm->vm_map) { + return KERN_FAILURE; + } count = vm_map_entry_reserve(MAP_RESERVE_COUNT); Retry: -- 2.11.4.GIT