From owner-svn-src-head@freebsd.org Tue Jul 18 20:26:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4B8ED9F7AC; Tue, 18 Jul 2017 20:26:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83EF182A7A; Tue, 18 Jul 2017 20:26:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6IKQf3S032156; Tue, 18 Jul 2017 20:26:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6IKQfJj032155; Tue, 18 Jul 2017 20:26:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707182026.v6IKQfJj032155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 18 Jul 2017 20:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321173 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 321173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jul 2017 20:26:42 -0000 Author: kib Date: Tue Jul 18 20:26:41 2017 New Revision: 321173 URL: https://svnweb.freebsd.org/changeset/base/321173 Log: Convert assertion that only vmspace owner grows the stack, into a check blocking grow from other processes accesses. Debugger may access stack grow area with ptrace(2). In this case, real state of the process is to not have the stack grown, which provides more accurate inspection. Technical reason to avoid the grow is to avoid applying wrong process (debugger) stack limit. This change also has a consequence of making aio workers accesses past the bottom of stacks into EFAULT, arguably the situation is a programmers mistake. Reported by: jhb Discussed with: alc, jhb Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Jul 18 19:50:02 2017 (r321172) +++ head/sys/vm/vm_map.c Tue Jul 18 20:26:41 2017 (r321173) @@ -3698,7 +3698,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma p = curproc; vm = p->p_vmspace; - MPASS(map == &p->p_vmspace->vm_map); + if (map != &p->p_vmspace->vm_map) + return (KERN_FAILURE); MPASS(!map->system_map); guard = stack_guard_page * PAGE_SIZE;