X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5ba3f43ea354af8ad55bea84372a2bc834d8757c..d9a64523371fa019c4575bb400cbbc3a50ac9903:/bsd/kern/bsd_init.c diff --git a/bsd/kern/bsd_init.c b/bsd/kern/bsd_init.c index 25395d352..23e115db0 100644 --- a/bsd/kern/bsd_init.c +++ b/bsd/kern/bsd_init.c @@ -94,6 +94,7 @@ #include #include #include +#include #include @@ -106,17 +107,14 @@ #include #include #include -#include +#include /* for ux_handler_setup() */ #include #include #include -#include /* for ux_exception_port */ - #include -#include #include /* for pseudo_inits */ #include #include @@ -129,8 +127,6 @@ #include #include #include /* for thread_resume() */ -#include /* for task_set_exception_ports() */ -#include /* for ux_handler() */ #include /* for ubc_init() */ #include /* for mcache_init() */ #include /* for mbinit() */ @@ -150,8 +146,6 @@ #include /* for gif_init() */ #include /* for vnode_pager_bootstrap() */ #include /* for devfs_kernel_mount() */ -#include /* for host_set_exception_ports() */ -#include /* for host_priv_self() */ #include /* for kmem_suballoc() */ #include /* for psem_lock_init() */ #include /* for log_setsize() */ @@ -200,6 +194,9 @@ #include #include +#if CONFIG_XNUPOST +#include +#endif void * get_user_regs(thread_t); /* XXX kludge for */ void IOKitInitializeTime(void); /* XXX */ @@ -292,6 +289,9 @@ void bsd_exec_setup(int); #if __arm64__ __private_extern__ int bootarg_no64exec = 0; #endif +#if __x86_64__ +__private_extern__ int bootarg_no32exec = 0; +#endif __private_extern__ int bootarg_vnode_cache_defeat = 0; #if CONFIG_JETSAM && (DEVELOPMENT || DEBUG) @@ -399,6 +399,10 @@ lck_attr_t * proc_lck_attr; lck_mtx_t * proc_list_mlock; lck_mtx_t * proc_klist_mlock; +#if CONFIG_XNUPOST +lck_grp_t * sysctl_debug_test_stackshot_owner_grp; +lck_mtx_t * sysctl_debug_test_stackshot_owner_init_mtx; +#endif /* !CONFIG_XNUPOST */ extern lck_mtx_t * execargs_cache_lock; @@ -496,6 +500,12 @@ bsd_init(void) #endif proc_kqhashlock_grp = lck_grp_alloc_init("proc-kqhashlock", proc_lck_grp_attr); proc_knhashlock_grp = lck_grp_alloc_init("proc-knhashlock", proc_lck_grp_attr); +#if CONFIG_XNUPOST + sysctl_debug_test_stackshot_owner_grp = lck_grp_alloc_init("test-stackshot-owner-grp", LCK_GRP_ATTR_NULL); + sysctl_debug_test_stackshot_owner_init_mtx = lck_mtx_alloc_init( + sysctl_debug_test_stackshot_owner_grp, + LCK_ATTR_NULL); +#endif /* !CONFIG_XNUPOST */ /* Allocate proc lock attribute */ proc_lck_attr = lck_attr_alloc_init(); #if 0 @@ -549,9 +559,6 @@ bsd_init(void) #endif #endif /* MAC */ - /* Initialize System Override call */ - init_system_override(); - ulock_initialize(); /* @@ -711,6 +718,9 @@ bsd_init(void) panic("bsd_init: Failed to allocate bsd pageable map"); } + bsd_init_kprintf("calling fpxlog_init\n"); + fpxlog_init(); + /* * Initialize buffers and hash links for buffers * @@ -1044,6 +1054,9 @@ bsd_init(void) consider_zone_gc(FALSE); #endif + /* Initialize System Override call */ + init_system_override(); + bsd_init_kprintf("done\n"); } @@ -1051,21 +1064,11 @@ void bsdinit_task(void) { proc_t p = current_proc(); - struct uthread *ut; - thread_t thread; process_name("init", p); - ux_handler_init(); - - thread = current_thread(); - (void) host_set_exception_ports(host_priv_self(), - EXC_MASK_ALL & ~(EXC_MASK_RPC_ALERT),//pilotfish (shark) needs this port - (mach_port_t) ux_exception_port, - EXCEPTION_DEFAULT| MACH_EXCEPTION_CODES, - 0); - - ut = (uthread_t)get_bsdthread_info(thread); + /* Set up exception-to-signal reflection */ + ux_handler_setup(); #if CONFIG_MACF mac_cred_label_associate_user(p->p_ucred); @@ -1073,6 +1076,13 @@ bsdinit_task(void) vm_init_before_launchd(); +#if CONFIG_XNUPOST + int result = bsd_list_tests(); + result = bsd_do_post(); + if (result != 0) { + panic("bsd_do_post: Tests failed with result = 0x%08x\n", result); + } +#endif bsd_init_kprintf("bsd_do_post - done"); @@ -1191,6 +1201,11 @@ parse_bsd_args(void) if (PE_parse_boot_argn("-no64exec", namep, sizeof (namep))) bootarg_no64exec = 1; #endif +#if __x86_64__ + /* disable 32 bit grading */ + if (PE_parse_boot_argn("-no32exec", namep, sizeof (namep))) + bootarg_no32exec = 1; +#endif /* disable vnode_cache_is_authorized() by setting vnode_cache_defeat */ if (PE_parse_boot_argn("-vnode_cache_defeat", namep, sizeof (namep)))