From owner-freebsd-current@FreeBSD.ORG Mon Apr 25 14:02:52 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 3A3FF106566C; Mon, 25 Apr 2011 14:02:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A82238FC12; Mon, 25 Apr 2011 14:02:51 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p3PE2G0A039637 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 25 Apr 2011 17:02:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p3PE2GuR036744; Mon, 25 Apr 2011 17:02:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p3PE2Gk7036743; Mon, 25 Apr 2011 17:02:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 25 Apr 2011 17:02:16 +0300 From: Kostik Belousov To: current@freebsd.org Message-ID: <20110425140216.GI48734@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LFN/h9p3ZzIorjyq" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: ports@freebsd.org Subject: NX stacks on amd64 and powerpc 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: Mon, 25 Apr 2011 14:02:52 -0000 --LFN/h9p3ZzIorjyq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I added a support for non-executable stacks on amd64 and PowerPC architectures some time ago, but did not enabled it. Passed time allowed to fix some bugs in the implementation, and I consider it would be good to have NX stacks enabled for architectures that support it. I plan to commit the following knob twiddle in approximately a week. Some ports, if any, that erronously handle PT_GNU_STACK phdr may break. Anybody interested should and could test the change before the commit, by setting sysctl kern.elf64.nxstack and kern.elf32.nxstack to 1. diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index b41741a..7358e40 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -116,7 +115,12 @@ static int elf_legacy_coredump =3D 0; SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump), CTLFLAG_RW,=20 &elf_legacy_coredump, 0, ""); =20 -static int __elfN(nxstack) =3D 0; +static int __elfN(nxstack) =3D +#if defined(__amd64__) || defined(__powerpc__) /* 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 sta= ck"); --LFN/h9p3ZzIorjyq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk21fuUACgkQC3+MBN1Mb4jAfACfdORTV/jFy9b2ue6EugbyLRf1 zDMAniPXcyuURzmVw/5P/Yryq8BfotQc =kMuV -----END PGP SIGNATURE----- --LFN/h9p3ZzIorjyq--