Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Nov 2019 19:46:39 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r354260 - in stable/12/sys: arm64/arm64 kern riscv/riscv
Message-ID:  <201911021946.xA2JkdjX050083@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mhorne
Date: Sat Nov  2 19:46:39 2019
New Revision: 354260
URL: https://svnweb.freebsd.org/changeset/base/354260

Log:
  MFC r340228-r340229, r340231
  
  r340228 by jhb:
  Enable use of a global shared page for RISC-V.
  
  machine/vmparam.h already defines the SHAREDPAGE constant.  This
  change just enables it for ELF executables.  The only use of the
  shared page currently is to hold the signal trampoline.
  
  Reviewed by:	markj, kib
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D17875
  
  r340229 by jhb:
  Drop the legacy ELF brandinfo for the old rtld from arm64 and riscv.
  
  These architectures never shipped binaries with an rtld path of
  /usr/libexec/ld-elf.so.1.
  
  Reviewed by:	markj
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D17876
  
  r340231 by jhb:
  Enable non-executable stacks by default on RISC-V.
  
  Reviewed by:	markj
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D17878

Modified:
  stable/12/sys/arm64/arm64/elf_machdep.c
  stable/12/sys/kern/imgact_elf.c
  stable/12/sys/riscv/riscv/elf_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/elf_machdep.c
==============================================================================
--- stable/12/sys/arm64/arm64/elf_machdep.c	Sat Nov  2 19:33:02 2019	(r354259)
+++ stable/12/sys/arm64/arm64/elf_machdep.c	Sat Nov  2 19:46:39 2019	(r354260)
@@ -107,21 +107,6 @@ static Elf64_Brandinfo freebsd_brand_info = {
 SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
     (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info);
 
-static Elf64_Brandinfo freebsd_brand_oinfo = {
-	.brand		= ELFOSABI_FREEBSD,
-	.machine	= EM_AARCH64,
-	.compat_3_brand	= "FreeBSD",
-	.emul_path	= NULL,
-	.interp_path	= "/usr/libexec/ld-elf.so.1",
-	.sysvec		= &elf64_freebsd_sysvec,
-	.interp_newpath	= NULL,
-	.brand_note	= &elf64_freebsd_brandnote,
-	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
-};
-
-SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
-    (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo);
-
 void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
     size_t *off __unused)

Modified: stable/12/sys/kern/imgact_elf.c
==============================================================================
--- stable/12/sys/kern/imgact_elf.c	Sat Nov  2 19:33:02 2019	(r354259)
+++ stable/12/sys/kern/imgact_elf.c	Sat Nov  2 19:46:39 2019	(r354260)
@@ -119,7 +119,8 @@ SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump), 
 
 int __elfN(nxstack) =
 #if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit */ || \
-    (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
+    (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__) || \
+    defined(__riscv)
 	1;
 #else
 	0;

Modified: stable/12/sys/riscv/riscv/elf_machdep.c
==============================================================================
--- stable/12/sys/riscv/riscv/elf_machdep.c	Sat Nov  2 19:33:02 2019	(r354259)
+++ stable/12/sys/riscv/riscv/elf_machdep.c	Sat Nov  2 19:46:39 2019	(r354260)
@@ -84,10 +84,12 @@ struct sysentvec elf64_freebsd_sysvec = {
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_FREEBSD | SV_LP64 | SV_ASLR,
+	.sv_flags	= SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR,
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_shared_page_base = SHAREDPAGE,
+	.sv_shared_page_len = PAGE_SIZE,
 	.sv_schedtail	= NULL,
 	.sv_thread_detach = NULL,
 	.sv_trap	= NULL,
@@ -110,22 +112,6 @@ static Elf64_Brandinfo freebsd_brand_info = {
 SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
 	(sysinit_cfunc_t) elf64_insert_brand_entry,
 	&freebsd_brand_info);
-
-static Elf64_Brandinfo freebsd_brand_oinfo = {
-	.brand		= ELFOSABI_FREEBSD,
-	.machine	= EM_RISCV,
-	.compat_3_brand	= "FreeBSD",
-	.emul_path	= NULL,
-	.interp_path	= "/usr/libexec/ld-elf.so.1",
-	.sysvec		= &elf64_freebsd_sysvec,
-	.interp_newpath	= NULL,
-	.brand_note	= &elf64_freebsd_brandnote,
-	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
-};
-
-SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
-	(sysinit_cfunc_t) elf64_insert_brand_entry,
-	&freebsd_brand_oinfo);
 
 static int debug_kld;
 SYSCTL_INT(_kern, OID_AUTO, debug_kld,



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