From owner-freebsd-current@FreeBSD.ORG Tue Oct 18 16:35:05 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 69BFC106566B for ; Tue, 18 Oct 2011 16:35:05 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by mx1.freebsd.org (Postfix) with ESMTP id 32F158FC13 for ; Tue, 18 Oct 2011 16:35:04 +0000 (UTC) Received: by pzk4 with SMTP id 4so4295185pzk.3 for ; Tue, 18 Oct 2011 09:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=Rq6lJK7fz7lYOAkuC0XWKgIfvQbhc+YHAn3v2fbtJCE=; b=BofOySqhkXZ5GhBzYfLZUsySZqaAYRauRwl8KZT1iW4h3uAZXBEbzPf61XGeylJhW/ 09SvQR29sR0UL5L02eIK5TOUS/IwMUlgGWxhU3wwFDutMbhWdv5R+U13zf3DaS0hQh/V QXad/kFJUKkl+BD6+8nDjg3gcFvTnaIvrmU2E= Received: by 10.68.36.6 with SMTP id m6mr5881852pbj.111.1318955704687; Tue, 18 Oct 2011 09:35:04 -0700 (PDT) Received: from kruse-180.4.ixsystems.com (drawbridge.ixsystems.com. [206.40.55.65]) by mx.google.com with ESMTPS id w4sm8836391pbf.6.2011.10.18.09.35.02 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Oct 2011 09:35:03 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Garrett Cooper In-Reply-To: Date: Tue, 18 Oct 2011 09:35:00 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20111018090750.GG50300@deviant.kiev.zoral.com.ua> To: Arnaud Lacombe X-Mailer: Apple Mail (2.1084) Cc: Kostik Belousov , current@freebsd.org, Oliver Pinter 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 16:35:05 -0000 On Oct 18, 2011, at 9:26 AM, Arnaud Lacombe wrote: > Hi, >=20 > On Tue, Oct 18, 2011 at 11:44 AM, Garrett Cooper = wrote: >> On Tue, 18 Oct 2011, Arnaud Lacombe wrote: >>=20 >>> Hi, >>>=20 >>> On Tue, Oct 18, 2011 at 5:07 AM, Kostik Belousov = >>> wrote: >>>>=20 >>>> On Mon, Oct 17, 2011 at 09:30:56PM +0200, Oliver Pinter wrote: >>>>>=20 >>>>> Hi all! >>>>>=20 >>>>> I think, it's the time to enable the nxstack feature. Any = comments, >>>>> pros, cons? >>>>=20 >>>> 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. >>>>=20 >>>> 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 =3D 0; >>>> SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump), CTLFLAG_RW, >>>> &elf_legacy_coredump, 0, ""); >>>>=20 >>>> -static int __elfN(nxstack) =3D 0; >>>> +int __elfN(nxstack) =3D >>>> +#if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 = bit >>>> */ >>>>=20 >>> Why leaving 32bits x86 CPU supporting the NX feature behind ? >>=20 >> Most likely because it was assumed that i386 doesn't fully support = it. >> According to ye great Wikipedia, NX support didn't roll into i386 = until >> Prescott, which was pretty late in the non-64-bit capable family of = CPUs, as >> its successor -- Conroe -- was 64-bit. Intel detuned some of the = early Dual >> Core Pentiums, e.g. the Yonahs to not talk 64-bit. Not sure about = AMD. >>=20 >> There are probably more details in binutils, gcc, etc, that I'm = missing and >> Kostik can expound on. >>=20 > NX support is advertised in the cpuid flags, just add the logic to > handle this interface. Kostik's patch is just incomplete, but he's got > a commit bit so he can commit it as-is, as he will. >=20 > If nonexec_stack becomes the default, it should be on every CPU > supporting the feature, not just the low-hanging one. It gets a bit trickier because now you're putting MD code into MI code, = but that should be easy enough to abstract out into amd64, i386, etc. Still wondering if the toolchain is lacking support though, because I = remember a few committers (dim?, kib?) making some modifications in = order to get NX working about a year ago. -Garrett=