kern_exec.c (ac2e4153278a07773d0ca8f9f5f5c1b41a3696b8) kern_exec.c (a5881ea55a2c554fd584cf985d99e92ad1db8737)
1/*
2 * Copyright (c) 1993, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 164 unchanged lines hidden (view full) ---

173 int error, len, i;
174 struct image_params image_params, *imgp;
175 struct vattr attr;
176 int (*img_first)(struct image_params *);
177 struct pargs *oldargs = NULL, *newargs = NULL;
178 struct procsig *oldprocsig, *newprocsig;
179#ifdef KTRACE
180 struct vnode *tracevp = NULL;
1/*
2 * Copyright (c) 1993, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 164 unchanged lines hidden (view full) ---

173 int error, len, i;
174 struct image_params image_params, *imgp;
175 struct vattr attr;
176 int (*img_first)(struct image_params *);
177 struct pargs *oldargs = NULL, *newargs = NULL;
178 struct procsig *oldprocsig, *newprocsig;
179#ifdef KTRACE
180 struct vnode *tracevp = NULL;
181 struct ucred *tracecred = NULL;
181#endif
182 struct vnode *textvp = NULL;
183 int credential_changing;
184 int textset;
185#ifdef MAC
186 struct label interplabel; /* label of the interpreted vnode */
187 struct label execlabel; /* optional label argument */
188 int will_transition, interplabelvalid = 0;

--- 295 unchanged lines hidden (view full) ---

484 (p->p_flag & P_TRACED) == 0) {
485 /*
486 * Turn off syscall tracing for set-id programs, except for
487 * root. Record any set-id flags first to make sure that
488 * we do not regain any tracing during a possible block.
489 */
490 setsugid(p);
491#ifdef KTRACE
182#endif
183 struct vnode *textvp = NULL;
184 int credential_changing;
185 int textset;
186#ifdef MAC
187 struct label interplabel; /* label of the interpreted vnode */
188 struct label execlabel; /* optional label argument */
189 int will_transition, interplabelvalid = 0;

--- 295 unchanged lines hidden (view full) ---

485 (p->p_flag & P_TRACED) == 0) {
486 /*
487 * Turn off syscall tracing for set-id programs, except for
488 * root. Record any set-id flags first to make sure that
489 * we do not regain any tracing during a possible block.
490 */
491 setsugid(p);
492#ifdef KTRACE
492 if (p->p_tracep && suser_cred(oldcred, PRISON_ROOT)) {
493 if (p->p_tracevp != NULL && suser_cred(oldcred, PRISON_ROOT)) {
493 mtx_lock(&ktrace_mtx);
494 p->p_traceflag = 0;
494 mtx_lock(&ktrace_mtx);
495 p->p_traceflag = 0;
495 tracevp = p->p_tracep;
496 p->p_tracep = NULL;
496 tracevp = p->p_tracevp;
497 p->p_tracevp = NULL;
498 tracecred = p->p_tracecred;
499 p->p_tracecred = NULL;
497 mtx_unlock(&ktrace_mtx);
498 }
499#endif
500 /*
501 * Close any file descriptors 0..2 that reference procfs,
502 * then make sure file descriptors 0..2 are in use.
503 *
504 * setugidsafety() may call closef() and then pfind()

--- 116 unchanged lines hidden (view full) ---

621 */
622 if (textvp != NULL)
623 vrele(textvp);
624 if (ndp->ni_vp && error != 0)
625 vrele(ndp->ni_vp);
626#ifdef KTRACE
627 if (tracevp != NULL)
628 vrele(tracevp);
500 mtx_unlock(&ktrace_mtx);
501 }
502#endif
503 /*
504 * Close any file descriptors 0..2 that reference procfs,
505 * then make sure file descriptors 0..2 are in use.
506 *
507 * setugidsafety() may call closef() and then pfind()

--- 116 unchanged lines hidden (view full) ---

624 */
625 if (textvp != NULL)
626 vrele(textvp);
627 if (ndp->ni_vp && error != 0)
628 vrele(ndp->ni_vp);
629#ifdef KTRACE
630 if (tracevp != NULL)
631 vrele(tracevp);
632 if (tracecred != NULL)
633 crfree(tracecred);
629#endif
630 if (oldargs != NULL)
631 pargs_drop(oldargs);
632 if (newargs != NULL)
633 pargs_drop(newargs);
634
635exec_fail_dealloc:
636

--- 624 unchanged lines hidden ---
634#endif
635 if (oldargs != NULL)
636 pargs_drop(oldargs);
637 if (newargs != NULL)
638 pargs_drop(newargs);
639
640exec_fail_dealloc:
641

--- 624 unchanged lines hidden ---