From owner-svn-src-stable@freebsd.org Mon Jul 10 06:08:45 2017 Return-Path: Delivered-To: svn-src-stable@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 E6D9FD9EBC5; Mon, 10 Jul 2017 06:08:45 +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 B54797D458; Mon, 10 Jul 2017 06:08:45 +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 v6A68iMM021527; Mon, 10 Jul 2017 06:08:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A68i8L021526; Mon, 10 Jul 2017 06:08:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707100608.v6A68i8L021526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Jul 2017 06:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320864 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 320864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 06:08:46 -0000 Author: kib Date: Mon Jul 10 06:08:44 2017 New Revision: 320864 URL: https://svnweb.freebsd.org/changeset/base/320864 Log: MFC r320619: Resolve confusion between different error code spaces. Modified: stable/10/sys/kern/kern_exec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_exec.c ============================================================================== --- stable/10/sys/kern/kern_exec.c Mon Jul 10 05:59:06 2017 (r320863) +++ stable/10/sys/kern/kern_exec.c Mon Jul 10 06:08:44 2017 (r320864) @@ -1043,9 +1043,9 @@ exec_unmap_first_page(imgp) } /* - * Destroy old address space, and allocate a new stack - * The new stack is only SGROWSIZ large because it is grown - * automatically in trap.c. + * Destroy old address space, and allocate a new stack. + * The new stack is only sgrowsiz large because it is grown + * automatically on a page fault. */ int exec_new_vmspace(imgp, sv) @@ -1099,9 +1099,9 @@ exec_new_vmspace(imgp, sv) VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_READ | VM_PROT_EXECUTE, MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); - if (error) { + if (error != KERN_SUCCESS) { vm_object_deallocate(obj); - return (error); + return (vm_mmap_to_errno(error)); } } @@ -1125,10 +1125,9 @@ exec_new_vmspace(imgp, sv) stack_addr = sv->sv_usrstack - ssiz; error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz, obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : - sv->sv_stackprot, - VM_PROT_ALL, MAP_STACK_GROWS_DOWN); - if (error) - return (error); + sv->sv_stackprot, VM_PROT_ALL, MAP_STACK_GROWS_DOWN); + if (error != KERN_SUCCESS) + return (vm_mmap_to_errno(error)); #ifdef __ia64__ /* Allocate a new register stack */