From patchwork Sun Oct 18 00:08:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 36320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id AD7D9B7B78 for ; Sun, 18 Oct 2009 11:08:53 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1MzJKG-0002UO-7n; Sun, 18 Oct 2009 01:08:44 +0100 Received: from smtp.outflux.net ([198.145.64.163]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1MzJKA-0002TF-1T for kernel-team@lists.ubuntu.com; Sun, 18 Oct 2009 01:08:38 +0100 Received: from www.outflux.net (serenity-end.outflux.net [10.2.0.2]) by vinyl.outflux.net (8.14.3/8.14.3/Debian-9ubuntu1) with ESMTP id n9I08aIw016551 for ; Sat, 17 Oct 2009 17:08:36 -0700 Date: Sat, 17 Oct 2009 17:08:35 -0700 From: Kees Cook To: kernel-team@lists.ubuntu.com Subject: [PATCH] UBUNTU: SAUCE: [x86] fix report of cs-limit nx-emulation Message-ID: <20091018000835.GF5394@outflux.net> MIME-Version: 1.0 Content-Disposition: inline Organization: Ubuntu X-MIMEDefang-Filter: outflux$Revision: 1.316 $ X-HELO: www.outflux.net X-Scanned-By: MIMEDefang 2.67 on 10.2.0.1 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.8 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This is an addition to the patch titled "UBUNTU: SAUCE: [x86] implement cs-limit nx-emulation for ia32" which correctly limits the report about NX capabilities to actual hardware and arch details. BugLink: http://bugs.launchpad.net/bugs/454285 Signed-off-by: Kees Cook --- arch/x86/mm/init.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 10de7ed..2044967 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -77,6 +77,7 @@ static void __init set_nx(void) #else static inline void set_nx(void) { + nx_enabled = ( (__supported_pte_mask & _PAGE_NX) == _PAGE_NX ); } #endif @@ -213,8 +214,13 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, if (nx_enabled) printk(KERN_INFO "NX (Execute Disable) protection: active\n"); else +#ifdef CONFIG_X86_32 printk(KERN_INFO "Using x86 segment limits to approximate " "NX protection\n"); +#else + printk(KERN_WARNING "Yikes! NX (Execute Disable) protection " + "is missing/disabled in CPU or BIOS!\n"); +#endif /* Enable PSE if available */ if (cpu_has_pse)