Deleted Added
full compact
kern_sharedpage.c (182371) kern_sharedpage.c (182905)
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

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
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

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/kern_exec.c 182371 2008-08-28 15:23:18Z attilio $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_exec.c 182905 2008-09-10 13:16:41Z trasz $");
29
30#include "opt_hwpmc_hooks.h"
31#include "opt_kdtrace.h"
32#include "opt_ktrace.h"
33#include "opt_mac.h"
34#include "opt_vm.h"
35
36#include <sys/param.h>

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

57#include <sys/resourcevar.h>
58#include <sys/sdt.h>
59#include <sys/sf_buf.h>
60#include <sys/syscallsubr.h>
61#include <sys/sysent.h>
62#include <sys/shm.h>
63#include <sys/sysctl.h>
64#include <sys/vnode.h>
29
30#include "opt_hwpmc_hooks.h"
31#include "opt_kdtrace.h"
32#include "opt_ktrace.h"
33#include "opt_mac.h"
34#include "opt_vm.h"
35
36#include <sys/param.h>

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

57#include <sys/resourcevar.h>
58#include <sys/sdt.h>
59#include <sys/sf_buf.h>
60#include <sys/syscallsubr.h>
61#include <sys/sysent.h>
62#include <sys/shm.h>
63#include <sys/sysctl.h>
64#include <sys/vnode.h>
65#include <sys/stat.h>
65#ifdef KTRACE
66#include <sys/ktrace.h>
67#endif
68
69#include <vm/vm.h>
70#include <vm/vm_param.h>
71#include <vm/pmap.h>
72#include <vm/vm_page.h>

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

617 * Don't honor setuid/setgid if the filesystem prohibits it or if
618 * the process is being traced.
619 *
620 * XXXMAC: For the time being, use NOSUID to also prohibit
621 * transitions on the file system.
622 */
623 oldcred = p->p_ucred;
624 credential_changing = 0;
66#ifdef KTRACE
67#include <sys/ktrace.h>
68#endif
69
70#include <vm/vm.h>
71#include <vm/vm_param.h>
72#include <vm/pmap.h>
73#include <vm/vm_page.h>

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

618 * Don't honor setuid/setgid if the filesystem prohibits it or if
619 * the process is being traced.
620 *
621 * XXXMAC: For the time being, use NOSUID to also prohibit
622 * transitions on the file system.
623 */
624 oldcred = p->p_ucred;
625 credential_changing = 0;
625 credential_changing |= (attr.va_mode & VSUID) && oldcred->cr_uid !=
626 credential_changing |= (attr.va_mode & S_ISUID) && oldcred->cr_uid !=
626 attr.va_uid;
627 attr.va_uid;
627 credential_changing |= (attr.va_mode & VSGID) && oldcred->cr_gid !=
628 credential_changing |= (attr.va_mode & S_ISGID) && oldcred->cr_gid !=
628 attr.va_gid;
629#ifdef MAC
630 will_transition = mac_vnode_execve_will_transition(oldcred, imgp->vp,
631 interpvplabel, imgp);
632 credential_changing |= will_transition;
633#endif
634
635 if (credential_changing &&

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

670 vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
671 if (error != 0)
672 goto done1;
673 PROC_LOCK(p);
674 /*
675 * Set the new credentials.
676 */
677 crcopy(newcred, oldcred);
629 attr.va_gid;
630#ifdef MAC
631 will_transition = mac_vnode_execve_will_transition(oldcred, imgp->vp,
632 interpvplabel, imgp);
633 credential_changing |= will_transition;
634#endif
635
636 if (credential_changing &&

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

671 vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
672 if (error != 0)
673 goto done1;
674 PROC_LOCK(p);
675 /*
676 * Set the new credentials.
677 */
678 crcopy(newcred, oldcred);
678 if (attr.va_mode & VSUID)
679 if (attr.va_mode & S_ISUID)
679 change_euid(newcred, euip);
680 change_euid(newcred, euip);
680 if (attr.va_mode & VSGID)
681 if (attr.va_mode & S_ISGID)
681 change_egid(newcred, attr.va_gid);
682#ifdef MAC
683 if (will_transition) {
684 mac_vnode_execve_transition(oldcred, newcred, imgp->vp,
685 interpvplabel, imgp);
686 }
687#endif
688 /*

--- 714 unchanged lines hidden ---
682 change_egid(newcred, attr.va_gid);
683#ifdef MAC
684 if (will_transition) {
685 mac_vnode_execve_transition(oldcred, newcred, imgp->vp,
686 interpvplabel, imgp);
687 }
688#endif
689 /*

--- 714 unchanged lines hidden ---