svn commit: r355053 - stable/11/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sun Nov 24 12:35:17 UTC 2019
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);
More information about the svn-src-stable-11
mailing list