kern_exec.c (142453) | kern_exec.c (145256) |
---|---|
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 142453 2005-02-25 11:49:42Z sobomax $"); | 28__FBSDID("$FreeBSD: head/sys/kern/kern_exec.c 145256 2005-04-19 04:01:25Z jkoshy $"); |
29 30#include "opt_ktrace.h" 31#include "opt_mac.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/eventhandler.h> 36#include <sys/lock.h> --- 30 unchanged lines hidden (view full) --- 67#include <vm/pmap.h> 68#include <vm/vm_page.h> 69#include <vm/vm_map.h> 70#include <vm/vm_kern.h> 71#include <vm/vm_extern.h> 72#include <vm/vm_object.h> 73#include <vm/vm_pager.h> 74 | 29 30#include "opt_ktrace.h" 31#include "opt_mac.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/eventhandler.h> 36#include <sys/lock.h> --- 30 unchanged lines hidden (view full) --- 67#include <vm/pmap.h> 68#include <vm/vm_page.h> 69#include <vm/vm_map.h> 70#include <vm/vm_kern.h> 71#include <vm/vm_extern.h> 72#include <vm/vm_object.h> 73#include <vm/vm_pager.h> 74 |
75#ifdef HWPMC_HOOKS 76#include <sys/pmckern.h> 77#endif 78 |
|
75#include <machine/reg.h> 76 77MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments"); 78 79static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); 80static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); 81static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); 82static int do_execve(struct thread *td, struct image_args *args, --- 574 unchanged lines hidden (view full) --- 657 p->p_args = NULL; 658 659 /* Cache arguments if they fit inside our allowance */ 660 if (ps_arg_cache_limit >= i + sizeof(struct pargs)) { 661 bcopy(imgp->args->begin_argv, newargs->ar_args, i); 662 p->p_args = newargs; 663 newargs = NULL; 664 } | 79#include <machine/reg.h> 80 81MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments"); 82 83static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); 84static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); 85static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); 86static int do_execve(struct thread *td, struct image_args *args, --- 574 unchanged lines hidden (view full) --- 661 p->p_args = NULL; 662 663 /* Cache arguments if they fit inside our allowance */ 664 if (ps_arg_cache_limit >= i + sizeof(struct pargs)) { 665 bcopy(imgp->args->begin_argv, newargs->ar_args, i); 666 p->p_args = newargs; 667 newargs = NULL; 668 } |
669 670#ifdef HWPMC_HOOKS 671 /* 672 * Check if the process is using PMCs and if so do exec() time 673 * processing. This processing needs to happen AFTER the 674 * P_INEXEC flag is cleared. 675 * 676 * The proc lock needs to be released before taking the PMC 677 * SX. 678 */ 679 if (PMC_PROC_IS_USING_PMCS(p)) { 680 PROC_UNLOCK(p); 681 PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC, 682 (void *) &credential_changing); 683 } else 684 PROC_UNLOCK(p); 685#else /* !HWPMC_HOOKS */ |
|
665 PROC_UNLOCK(p); | 686 PROC_UNLOCK(p); |
687#endif |
|
666 667 /* Set values passed into the program in registers. */ 668 if (p->p_sysent->sv_setregs) 669 (*p->p_sysent->sv_setregs)(td, imgp->entry_addr, 670 (u_long)(uintptr_t)stack_base, imgp->ps_strings); 671 else 672 exec_setregs(td, imgp->entry_addr, 673 (u_long)(uintptr_t)stack_base, imgp->ps_strings); --- 581 unchanged lines hidden --- | 688 689 /* Set values passed into the program in registers. */ 690 if (p->p_sysent->sv_setregs) 691 (*p->p_sysent->sv_setregs)(td, imgp->entry_addr, 692 (u_long)(uintptr_t)stack_base, imgp->ps_strings); 693 else 694 exec_setregs(td, imgp->entry_addr, 695 (u_long)(uintptr_t)stack_base, imgp->ps_strings); --- 581 unchanged lines hidden --- |