From owner-svn-src-stable-10@freebsd.org Sat Jan 9 15:48:13 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31B75A699EB; Sat, 9 Jan 2016 15:48:13 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D8C91BF9; Sat, 9 Jan 2016 15:48:12 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u09FmCDe024988; Sat, 9 Jan 2016 15:48:12 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u09FmBug024982; Sat, 9 Jan 2016 15:48:11 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201601091548.u09FmBug024982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 9 Jan 2016 15:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293516 - in stable/10/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 15:48:13 -0000 Author: dchagin Date: Sat Jan 9 15:48:11 2016 New Revision: 293516 URL: https://svnweb.freebsd.org/changeset/base/293516 Log: MFC r283410: Put linux_platform into the vdso to avoid copying it onto the stack at every exec. Modified: stable/10/sys/amd64/linux32/linux32_locore.s stable/10/sys/amd64/linux32/linux32_sysvec.c stable/10/sys/amd64/linux32/linux32_vdso.lds.s stable/10/sys/compat/linux/linux_misc.c stable/10/sys/compat/linux/linux_misc.h stable/10/sys/i386/linux/linux_sysvec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux32/linux32_locore.s ============================================================================== --- stable/10/sys/amd64/linux32/linux32_locore.s Sat Jan 9 15:46:05 2016 (r293515) +++ stable/10/sys/amd64/linux32/linux32_locore.s Sat Jan 9 15:48:11 2016 (r293516) @@ -5,6 +5,12 @@ #include /* system call numbers */ +.data + + .globl linux_platform +linux_platform: + .asciz "i686" + .text .code32 Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux32/linux32_sysvec.c Sat Jan 9 15:46:05 2016 (r293515) +++ stable/10/sys/amd64/linux32/linux32_sysvec.c Sat Jan 9 15:48:11 2016 (r293516) @@ -110,8 +110,7 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 -const char *linux_platform = "i686"; -static int linux_szplatform; +const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -229,6 +228,7 @@ struct linux32_ps_strings { LINUX_VDSO_SYM_INTPTR(linux32_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_rt_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_vsyscall); +LINUX_VDSO_SYM_CHAR(linux_platform); /* * If FreeBSD & Linux have a difference of opinion about what a trap @@ -257,11 +257,10 @@ elf_linux_fixup(register_t **stack_base, { Elf32_Auxargs *args; Elf32_Addr *base; - Elf32_Addr *pos, *uplatform; + Elf32_Addr *pos; struct linux32_ps_strings *arginfo; arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform); KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); @@ -296,7 +295,7 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); if (args->execfd != -1) AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY_32(pos, AT_NULL, 0); @@ -883,15 +882,8 @@ linux_copyout_strings(struct image_param * Also deal with signal trampoline code for this exec type. */ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - - roundup((ARG_MAX - imgp->args->stringspace), - sizeof(char *)); - - /* - * Install LINUX_PLATFORM - */ - copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), - linux_szplatform); + destp = (caddr_t)arginfo - SPARE_USRSPACE - + roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* * If we have a valid auxargs ptr, prepare some room @@ -1075,6 +1067,9 @@ linux_vdso_install(void *param) bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; + + linux_kplatform = linux_shared_page_mapping + + (linux_platform - (caddr_t)LINUX32_SHAREDPAGE); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); @@ -1181,8 +1176,6 @@ linux_elf_modevent(module_t mod, int typ linux_proc_exec, NULL, 1000); linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - linux_szplatform = roundup(strlen(linux_platform) + 1, - sizeof(char *)); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); if (bootverbose) Modified: stable/10/sys/amd64/linux32/linux32_vdso.lds.s ============================================================================== --- stable/10/sys/amd64/linux32/linux32_vdso.lds.s Sat Jan 9 15:46:05 2016 (r293515) +++ stable/10/sys/amd64/linux32/linux32_vdso.lds.s Sat Jan 9 15:48:11 2016 (r293516) @@ -60,6 +60,7 @@ VERSION linux32_vsyscall; linux32_sigcode; linux32_rt_sigcode; + linux_platform; local: *; }; } Modified: stable/10/sys/compat/linux/linux_misc.c ============================================================================== --- stable/10/sys/compat/linux/linux_misc.c Sat Jan 9 15:46:05 2016 (r293515) +++ stable/10/sys/compat/linux/linux_misc.c Sat Jan 9 15:48:11 2016 (r293516) @@ -732,7 +732,7 @@ linux_newuname(struct thread *td, struct *p = '\0'; break; } - strlcpy(utsname.machine, linux_platform, LINUX_MAX_UTSNAME); + strlcpy(utsname.machine, linux_kplatform, LINUX_MAX_UTSNAME); return (copyout(&utsname, args->buf, sizeof(utsname))); } Modified: stable/10/sys/compat/linux/linux_misc.h ============================================================================== --- stable/10/sys/compat/linux/linux_misc.h Sat Jan 9 15:46:05 2016 (r293515) +++ stable/10/sys/compat/linux/linux_misc.h Sat Jan 9 15:48:11 2016 (r293516) @@ -55,7 +55,7 @@ #define LINUX_MREMAP_MAYMOVE 1 #define LINUX_MREMAP_FIXED 2 -extern const char *linux_platform; +extern const char *linux_kplatform; /* * Non-standard aux entry types used in Linux ELF binaries. Modified: stable/10/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/i386/linux/linux_sysvec.c Sat Jan 9 15:46:05 2016 (r293515) +++ stable/10/sys/i386/linux/linux_sysvec.c Sat Jan 9 15:48:11 2016 (r293516) @@ -118,7 +118,7 @@ static void linux_vdso_install(void *par static void linux_vdso_deinstall(void *param); static int linux_szplatform; -const char *linux_platform; +const char *linux_kplatform; static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_exec_tag; @@ -330,7 +330,7 @@ linux_copyout_strings(struct image_param /* * install LINUX_PLATFORM */ - copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), + copyout(linux_kplatform, ((caddr_t)arginfo - linux_szplatform), linux_szplatform); /* @@ -1153,8 +1153,8 @@ linux_elf_modevent(module_t mod, int typ NULL, 1000); linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - linux_get_machine(&linux_platform); - linux_szplatform = roundup(strlen(linux_platform) + 1, + linux_get_machine(&linux_kplatform); + linux_szplatform = roundup(strlen(linux_kplatform) + 1, sizeof(char *)); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz);