From owner-freebsd-current@FreeBSD.ORG Tue Oct 18 10:22:32 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CADE106566C for ; Tue, 18 Oct 2011 10:22:32 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id F3C628FC15 for ; Tue, 18 Oct 2011 10:22:31 +0000 (UTC) Received: by ggeq3 with SMTP id q3so531403gge.13 for ; Tue, 18 Oct 2011 03:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=m5vsXsIa9u+l5ueUPcTIJwI7wBZhrpQpBZzeQNpthQQ=; b=EtZ2yWTw2WJiXLHZaNPaEqtyqlHJDqulsh/s7iecZHxJHRy8gZ2UG5pRd8CCcxc+vX wmY/kbhjVHSb4rqcI1FEXjFFg+NCe+dIcGgvlknhmFaDF4LmA8JRkxLLRfkG4GnR0gvE ws71PhmD23NZW7i26ttXgj64OlHXVJxUyCOMM= MIME-Version: 1.0 Received: by 10.150.176.15 with SMTP id y15mr1364758ybe.54.1318933351349; Tue, 18 Oct 2011 03:22:31 -0700 (PDT) Received: by 10.150.228.16 with HTTP; Tue, 18 Oct 2011 03:22:31 -0700 (PDT) In-Reply-To: <20111018090750.GG50300@deviant.kiev.zoral.com.ua> References: <20111018090750.GG50300@deviant.kiev.zoral.com.ua> Date: Tue, 18 Oct 2011 12:22:31 +0200 Message-ID: From: Oliver Pinter To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: current@freebsd.org Subject: Re: [RFC] Enable nxstack by default X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2011 10:22:32 -0000 Looks good to me. On 10/18/11, Kostik Belousov wrote: > On Mon, Oct 17, 2011 at 09:30:56PM +0200, Oliver Pinter wrote: >> Hi all! >> >> I think, it's the time to enable the nxstack feature. Any comments, >> pros, cons? > > I dragged the change long enough for it to miss the 9.0. > After the 9.0 is released, I will flip the switch with the following > change. > > diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c > index 8455f48..926fe64 100644 > --- a/sys/kern/imgact_elf.c > +++ b/sys/kern/imgact_elf.c > @@ -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"); > diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c > index 7500462..0e27351 100644 > --- a/sys/powerpc/aim/mmu_oea64.c > +++ b/sys/powerpc/aim/mmu_oea64.c > @@ -1445,6 +1445,8 @@ moea64_uma_page_alloc(uma_zone_t zone, int bytes, > u_int8_t *flags, int wait) > return (void *)va; > } > > +extern int elf32_nxstack; > + > void > moea64_init(mmu_t mmu) > { > @@ -1464,6 +1466,8 @@ moea64_init(mmu_t mmu) > uma_zone_set_allocf(moea64_mpvo_zone,moea64_uma_page_alloc); > } > > + elf32_nxstack = 1; > + > moea64_initialized = TRUE; > } > > diff --git a/sys/powerpc/booke/machdep.c b/sys/powerpc/booke/machdep.c > index c2b5e6f..82a37e1 100644 > --- a/sys/powerpc/booke/machdep.c > +++ b/sys/powerpc/booke/machdep.c > @@ -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 * > >