Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Apr 2019 09:35:40 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346807 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Message-ID:  <201904280935.x3S9Ze3E094825@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sun Apr 28 09:35:39 2019
New Revision: 346807
URL: https://svnweb.freebsd.org/changeset/base/346807

Log:
  MFC r321728:
  
  Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code.
  This is needed for https://reviews.freebsd.org/D11780.

Modified:
  stable/11/sys/amd64/linux/linux_sysvec.c
  stable/11/sys/amd64/linux32/linux32_sysvec.c
  stable/11/sys/compat/linux/linux_vdso.c
  stable/11/sys/compat/linux/linux_vdso.h
  stable/11/sys/i386/linux/linux_sysvec.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- stable/11/sys/amd64/linux/linux_sysvec.c	Sun Apr 28 08:22:37 2019	(r346806)
+++ stable/11/sys/amd64/linux/linux_sysvec.c	Sun Apr 28 09:35:39 2019	(r346807)
@@ -821,14 +821,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: stable/11/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/11/sys/amd64/linux32/linux32_sysvec.c	Sun Apr 28 08:22:37 2019	(r346806)
+++ stable/11/sys/amd64/linux32/linux32_sysvec.c	Sun Apr 28 09:35:39 2019	(r346807)
@@ -1021,14 +1021,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: stable/11/sys/compat/linux/linux_vdso.c
==============================================================================
--- stable/11/sys/compat/linux/linux_vdso.c	Sun Apr 28 08:22:37 2019	(r346806)
+++ stable/11/sys/compat/linux/linux_vdso.c	Sun Apr 28 09:35:39 2019	(r346807)
@@ -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: stable/11/sys/compat/linux/linux_vdso.h
==============================================================================
--- stable/11/sys/compat/linux/linux_vdso.h	Sun Apr 28 08:22:37 2019	(r346806)
+++ stable/11/sys/compat/linux/linux_vdso.h	Sun Apr 28 09:35:39 2019	(r346807)
@@ -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: stable/11/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/11/sys/i386/linux/linux_sysvec.c	Sun Apr 28 08:22:37 2019	(r346806)
+++ stable/11/sys/i386/linux/linux_sysvec.c	Sun Apr 28 09:35:39 2019	(r346807)
@@ -990,7 +990,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904280935.x3S9Ze3E094825>