X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fexec_domain.c;h=3c2eaea66b1e16347bcd564b0c492b8f026dcf21;hb=698adff3c3949c437fe8be4f27db090b1ae0c503;hp=a5686ae5dc727722e5099746abdf9355761e31e9;hpb=daddc0d38b3571bed170afa273a49a0eba090c1e;p=linux-2.6.git diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index a5686ae5d..3c2eaea66 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c @@ -7,13 +7,13 @@ * 2001-05-06 Complete rewrite, Christoph Hellwig (hch@infradead.org) */ -#include #include #include #include #include #include #include +#include #include #include @@ -21,7 +21,7 @@ static void default_handler(int, struct pt_regs *); static struct exec_domain *exec_domains = &default_exec_domain; -static rwlock_t exec_domains_lock = RW_LOCK_UNLOCKED; +static DEFINE_RWLOCK(exec_domains_lock); static u_long ident_map[32] = { @@ -44,29 +44,7 @@ struct exec_domain default_exec_domain = { static void default_handler(int segment, struct pt_regs *regp) { - u_long pers = 0; - - /* - * This may have been a static linked SVr4 binary, so we would - * have the personality set incorrectly. Or it might have been - * a Solaris/x86 binary. We can tell which because the former - * uses lcall7, while the latter used lcall 0x27. - * Try to find or load the appropriate personality, and fall back - * to just forcing a SEGV. - * - * XXX: this is IA32-specific and should be moved to the MD-tree. - */ - switch (segment) { -#ifdef __i386__ - case 0x07: - pers = abi_defhandler_lcall7; - break; - case 0x27: - pers = PER_SOLARIS; - break; -#endif - } - set_personality(pers); + set_personality(0); if (current_thread_info()->exec_domain->handler != default_handler) current_thread_info()->exec_domain->handler(segment, regp); @@ -161,6 +139,7 @@ __set_personality(u_long personality) ep = lookup_exec_domain(personality); if (ep == current_thread_info()->exec_domain) { current->personality = personality; + module_put(ep->module); return 0; } @@ -228,100 +207,3 @@ sys_personality(u_long personality) EXPORT_SYMBOL(register_exec_domain); EXPORT_SYMBOL(unregister_exec_domain); EXPORT_SYMBOL(__set_personality); - -/* - * We have to have all sysctl handling for the Linux-ABI - * in one place as the dynamic registration of sysctls is - * horribly crufty in Linux <= 2.4. - * - * I hope the new sysctl schemes discussed for future versions - * will obsolete this. - * - * --hch - */ - -u_long abi_defhandler_coff = PER_SCOSVR3; -u_long abi_defhandler_elf = PER_LINUX; -u_long abi_defhandler_lcall7 = PER_SVR4; -u_long abi_defhandler_libcso = PER_SVR4; -u_int abi_traceflg; -int abi_fake_utsname; - -static struct ctl_table abi_table[] = { - { - .ctl_name = ABI_DEFHANDLER_COFF, - .procname = "defhandler_coff", - .data = &abi_defhandler_coff, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_doulongvec_minmax, - }, - { - .ctl_name = ABI_DEFHANDLER_ELF, - .procname = "defhandler_elf", - .data = &abi_defhandler_elf, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_doulongvec_minmax, - }, - { - .ctl_name = ABI_DEFHANDLER_LCALL7, - .procname = "defhandler_lcall7", - .data = &abi_defhandler_lcall7, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_doulongvec_minmax, - }, - { - .ctl_name = ABI_DEFHANDLER_LIBCSO, - .procname = "defhandler_libcso", - .data = &abi_defhandler_libcso, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_doulongvec_minmax, - }, - { - .ctl_name = ABI_TRACE, - .procname = "trace", - .data = &abi_traceflg, - .maxlen = sizeof(u_int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .ctl_name = ABI_FAKE_UTSNAME, - .procname = "fake_utsname", - .data = &abi_fake_utsname, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { .ctl_name = 0 } -}; - -static struct ctl_table abi_root_table[] = { - { - .ctl_name = CTL_ABI, - .procname = "abi", - .mode = 0555, - .child = abi_table, - }, - { .ctl_name = 0 } -}; - -static int __init -abi_register_sysctl(void) -{ - register_sysctl_table(abi_root_table, 1); - return 0; -} - -__initcall(abi_register_sysctl); - - -EXPORT_SYMBOL(abi_defhandler_coff); -EXPORT_SYMBOL(abi_defhandler_elf); -EXPORT_SYMBOL(abi_defhandler_lcall7); -EXPORT_SYMBOL(abi_defhandler_libcso); -EXPORT_SYMBOL(abi_traceflg); -EXPORT_SYMBOL(abi_fake_utsname);