svn commit: r355051 - stable/12/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sun Nov 24 12:27:14 UTC 2019
Author: kib
Date: Sun Nov 24 12:27:13 2019
New Revision: 355051
URL: https://svnweb.freebsd.org/changeset/base/355051
Log:
MFC r354789:
kern_exec: p_osrel and p_fctl0 were obliterated by failed execve(2) attempt.
Modified:
stable/12/sys/kern/kern_exec.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/kern_exec.c
==============================================================================
--- stable/12/sys/kern/kern_exec.c Sun Nov 24 07:52:35 2019 (r355050)
+++ stable/12/sys/kern/kern_exec.c Sun Nov 24 12:27:13 2019 (r355051)
@@ -363,7 +363,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,8 @@ do_execve(struct thread *td, struct image_args *args,
#ifdef HWPMC_HOOKS
struct pmckern_procexec pe;
#endif
+ int error, i, orig_osrel;
+ uint32_t orig_fctl0;
static const char fexecv_proc_title[] = "(fexecv)";
imgp = &image_params;
@@ -407,6 +408,8 @@ do_execve(struct thread *td, struct image_args *args,
imgp->attr = &attr;
imgp->args = args;
oldcred = p->p_ucred;
+ orig_osrel = p->p_osrel;
+ orig_fctl0 = p->p_fctl0;
#ifdef MAC
error = mac_execve_enter(imgp, mac_p);
@@ -883,6 +886,11 @@ interpret:
SDT_PROBE1(proc, , , exec__success, args->fname);
exec_fail_dealloc:
+ if (error != 0) {
+ p->p_osrel = orig_osrel;
+ p->p_fctl0 = orig_fctl0;
+ }
+
if (imgp->firstpage != NULL)
exec_unmap_first_page(imgp);
More information about the svn-src-stable-12
mailing list