From owner-svn-src-stable-11@freebsd.org Sun Nov 24 12:35:17 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9201C1AE659; Sun, 24 Nov 2019 12:35:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47LV4P3Nv9z40PX; Sun, 24 Nov 2019 12:35:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5201624470; Sun, 24 Nov 2019 12:35:17 +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 xAOCZHGw053768; Sun, 24 Nov 2019 12:35:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAOCZHL7053767; Sun, 24 Nov 2019 12:35:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911241235.xAOCZHL7053767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 24 Nov 2019 12:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355053 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 355053 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Nov 2019 12:35:17 -0000 Author: kib Date: Sun Nov 24 12:35:16 2019 New Revision: 355053 URL: https://svnweb.freebsd.org/changeset/base/355053 Log: MFC r354789: kern_exec: p_osrel and p_fctl0 were obliterated by failed execve(2) attempt. Modified: stable/11/sys/kern/kern_exec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_exec.c ============================================================================== --- stable/11/sys/kern/kern_exec.c Sun Nov 24 12:30:41 2019 (r355052) +++ stable/11/sys/kern/kern_exec.c Sun Nov 24 12:35:16 2019 (r355053) @@ -361,7 +361,6 @@ do_execve(struct thread *td, struct image_args *args, struct ucred *oldcred; struct uidinfo *euip = NULL; register_t *stack_base; - int error, i; struct image_params image_params, *imgp; struct vattr attr; int (*img_first)(struct image_params *); @@ -382,6 +381,7 @@ do_execve(struct thread *td, struct image_args *args, #ifdef HWPMC_HOOKS struct pmckern_procexec pe; #endif + int error, i, orig_osrel; static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; @@ -407,6 +407,7 @@ do_execve(struct thread *td, struct image_args *args, imgp->attr = &attr; imgp->args = args; oldcred = p->p_ucred; + orig_osrel = p->p_osrel; #ifdef MAC error = mac_execve_enter(imgp, mac_p); @@ -892,6 +893,10 @@ interpret: SDT_PROBE1(proc, , , exec__success, args->fname); exec_fail_dealloc: + if (error != 0) { + p->p_osrel = orig_osrel; + } + if (imgp->firstpage != NULL) exec_unmap_first_page(imgp);