From owner-svn-src-all@freebsd.org Sun Jul 30 21:24:22 2017 Return-Path: Delivered-To: svn-src-all@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 58CF0DC29CF; Sun, 30 Jul 2017 21:24:22 +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 3202A8144E; Sun, 30 Jul 2017 21:24:22 +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 v6ULOLKd054089; Sun, 30 Jul 2017 21:24:21 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ULOKVf054084; Sun, 30 Jul 2017 21:24:20 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707302124.v6ULOKVf054084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 30 Jul 2017 21:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321728 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Commit-Revision: 321728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 21:24:22 -0000 Author: dchagin Date: Sun Jul 30 21:24:20 2017 New Revision: 321728 URL: https://svnweb.freebsd.org/changeset/base/321728 Log: Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code. This is needed for https://reviews.freebsd.org/D11780. Reported by: kib@ Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_vdso.c head/sys/compat/linux/linux_vdso.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/amd64/linux/linux_sysvec.c Sun Jul 30 21:24:20 2017 (r321728) @@ -844,14 +844,14 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (&linux_shared_page_mapping); - __elfN(linux_vdso_reloc)(&elf_linux_sysvec, SHAREDPAGE); + __elfN(linux_vdso_reloc)(&elf_linux_sysvec); 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)SHAREDPAGE); + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun Jul 30 21:24:20 2017 (r321728) @@ -1062,14 +1062,14 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (&linux_shared_page_mapping); - __elfN(linux_vdso_reloc)(&elf_linux_sysvec, LINUX32_SHAREDPAGE); + __elfN(linux_vdso_reloc)(&elf_linux_sysvec); 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); + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); Modified: head/sys/compat/linux/linux_vdso.c ============================================================================== --- head/sys/compat/linux/linux_vdso.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/compat/linux/linux_vdso.c Sun Jul 30 21:24:20 2017 (r321728) @@ -139,7 +139,7 @@ __elfN(linux_vdso_fixup)(struct sysentvec *sv) } void -__elfN(linux_vdso_reloc)(struct sysentvec *sv, long vdso_adjust) +__elfN(linux_vdso_reloc)(struct sysentvec *sv) { struct linux_vdso_sym *lsym; Elf_Ehdr *ehdr; @@ -152,13 +152,13 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd ehdr = (Elf_Ehdr *) sv->sv_sigcode; /* Adjust our so relative to the sigcode_base */ - if (vdso_adjust != 0) { - ehdr->e_entry += vdso_adjust; + if (sv->sv_shared_page_base != 0) { + ehdr->e_entry += sv->sv_shared_page_base; phdr = (Elf_Phdr *)((caddr_t)ehdr + ehdr->e_phoff); /* phdrs */ for (i = 0; i < ehdr->e_phnum; i++) { - phdr[i].p_vaddr += vdso_adjust; + phdr[i].p_vaddr += sv->sv_shared_page_base; if (phdr[i].p_type != PT_DYNAMIC) continue; dyn = (Elf_Dyn *)((caddr_t)ehdr + phdr[i].p_offset); @@ -178,13 +178,13 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd case DT_VERDEF: case DT_VERNEED: case DT_ADDRRNGLO ... DT_ADDRRNGHI: - dyn->d_un.d_ptr += vdso_adjust; + dyn->d_un.d_ptr += sv->sv_shared_page_base; break; case DT_ENCODING ... DT_LOOS-1: case DT_LOOS ... DT_HIOS: if (dyn->d_tag >= DT_ENCODING && (dyn->d_tag & 1) == 0) - dyn->d_un.d_ptr += vdso_adjust; + dyn->d_un.d_ptr += sv->sv_shared_page_base; break; default: break; @@ -197,7 +197,7 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd for(i = 0; i < ehdr->e_shnum; i++) { if (!(shdr[i].sh_flags & SHF_ALLOC)) continue; - shdr[i].sh_addr += vdso_adjust; + shdr[i].sh_addr += sv->sv_shared_page_base; if (shdr[i].sh_type != SHT_SYMTAB && shdr[i].sh_type != SHT_DYNSYM) continue; @@ -209,7 +209,7 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd if (sym->st_shndx == SHN_UNDEF || sym->st_shndx == SHN_ABS) continue; - sym->st_value += vdso_adjust; + sym->st_value += sv->sv_shared_page_base; } } } Modified: head/sys/compat/linux/linux_vdso.h ============================================================================== --- head/sys/compat/linux/linux_vdso.h Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/compat/linux/linux_vdso.h Sun Jul 30 21:24:20 2017 (r321728) @@ -41,7 +41,7 @@ struct linux_vdso_sym { vm_object_t __elfN(linux_shared_page_init)(char **); void __elfN(linux_shared_page_fini)(vm_object_t); void __elfN(linux_vdso_fixup)(struct sysentvec *); -void __elfN(linux_vdso_reloc)(struct sysentvec *, long); +void __elfN(linux_vdso_reloc)(struct sysentvec *); void __elfN(linux_vdso_sym_init)(struct linux_vdso_sym *); #define LINUX_VDSO_SYM_INTPTR(name) \ Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/i386/linux/linux_sysvec.c Sun Jul 30 21:24:20 2017 (r321728) @@ -1044,7 +1044,7 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (&linux_shared_page_mapping); - __elfN(linux_vdso_reloc)(&elf_linux_sysvec, LINUX_SHAREDPAGE); + __elfN(linux_vdso_reloc)(&elf_linux_sysvec); bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode);