svn commit: r237140 - in stable/9/sys: i386/i386 kern powerpc/aim
powerpc/booke
Konstantin Belousov
kib at FreeBSD.org
Fri Jun 15 17:31:16 UTC 2012
Author: kib
Date: Fri Jun 15 17:31:15 2012
New Revision: 237140
URL: http://svn.freebsd.org/changeset/base/237140
Log:
MFC r230767:
Enable nxstacks where supported.
Modified:
stable/9/sys/i386/i386/initcpu.c
stable/9/sys/kern/imgact_elf.c
stable/9/sys/powerpc/aim/mmu_oea64.c
stable/9/sys/powerpc/booke/machdep.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/i386/i386/initcpu.c
==============================================================================
--- stable/9/sys/i386/i386/initcpu.c Fri Jun 15 17:16:41 2012 (r237139)
+++ stable/9/sys/i386/i386/initcpu.c Fri Jun 15 17:31:15 2012 (r237140)
@@ -649,6 +649,8 @@ enable_sse(void)
#endif
}
+extern int elf32_nxstack;
+
void
initializecpu(void)
{
@@ -738,6 +740,7 @@ initializecpu(void)
msr = rdmsr(MSR_EFER) | EFER_NXE;
wrmsr(MSR_EFER, msr);
pg_nx = PG_NX;
+ elf32_nxstack = 1;
}
#endif
break;
Modified: stable/9/sys/kern/imgact_elf.c
==============================================================================
--- stable/9/sys/kern/imgact_elf.c Fri Jun 15 17:16:41 2012 (r237139)
+++ stable/9/sys/kern/imgact_elf.c Fri Jun 15 17:31:15 2012 (r237140)
@@ -118,7 +118,12 @@ static int elf_legacy_coredump = 0;
SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump), CTLFLAG_RW,
&elf_legacy_coredump, 0, "");
-static int __elfN(nxstack) = 0;
+int __elfN(nxstack) =
+#if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit */
+ 1;
+#else
+ 0;
+#endif
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO,
nxstack, CTLFLAG_RW, &__elfN(nxstack), 0,
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack");
Modified: stable/9/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- stable/9/sys/powerpc/aim/mmu_oea64.c Fri Jun 15 17:16:41 2012 (r237139)
+++ stable/9/sys/powerpc/aim/mmu_oea64.c Fri Jun 15 17:31:15 2012 (r237140)
@@ -1448,6 +1448,8 @@ moea64_uma_page_alloc(uma_zone_t zone, i
return (void *)va;
}
+extern int elf32_nxstack;
+
void
moea64_init(mmu_t mmu)
{
@@ -1467,6 +1469,8 @@ moea64_init(mmu_t mmu)
uma_zone_set_allocf(moea64_mpvo_zone,moea64_uma_page_alloc);
}
+ elf32_nxstack = 1;
+
moea64_initialized = TRUE;
}
Modified: stable/9/sys/powerpc/booke/machdep.c
==============================================================================
--- stable/9/sys/powerpc/booke/machdep.c Fri Jun 15 17:16:41 2012 (r237139)
+++ stable/9/sys/powerpc/booke/machdep.c Fri Jun 15 17:31:15 2012 (r237140)
@@ -192,6 +192,8 @@ void print_kernel_section_addr(void);
void print_kenv(void);
u_int booke_init(uint32_t, uint32_t);
+extern int elf32_nxstack;
+
static void
cpu_e500_startup(void *dummy)
{
@@ -227,6 +229,9 @@ cpu_e500_startup(void *dummy)
/* Set up buffers, so they can be used to read disk labels. */
bufinit();
vm_pager_bufferinit();
+
+ /* Cpu supports execution permissions on the pages. */
+ elf32_nxstack = 1;
}
static char *
More information about the svn-src-stable-9
mailing list