lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20120227010245.GB4019@udknight>
Date:	Mon, 27 Feb 2012 09:02:45 +0800
From:	Wang YanQing <udknight@...il.com>
To:	spock@...too.org
Cc:	linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
	x86@...nel.org, hpa@...ux.intel.com
Subject: [PATCH 1/2] x86:add function to check BIOS whether NX


Although we don't want any RWX memory in system,
but there are still some may need it, for example
uvesafb, so we give them this function to check
and ajust themself.

Signed-off-by: Wang YanQing <udknight@...il.com>
---
 arch/x86/include/asm/pci.h |    1 +
 arch/x86/mm/pageattr.c     |    2 +-
 arch/x86/pci/pcbios.c      |   11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index df75d07..31d657b 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -66,6 +66,7 @@ extern unsigned long pci_mem_start;
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 
 extern int pcibios_enabled;
+extern int check_pcibios_enabled(void);
 void pcibios_config_init(void);
 struct pci_bus *pcibios_scan_root(int bus);
 
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index e1ebde3..b1fb064 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -260,7 +260,7 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
 	 * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support.
 	 */
 #ifdef CONFIG_PCI_BIOS
-	if (pcibios_enabled && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
+	if (check_pcibios_enabled() && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
 		pgprot_val(forbidden) |= _PAGE_NX;
 #endif
 
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index da8fe05..86e0674 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -28,6 +28,17 @@
 
 int pcibios_enabled;
 
+/*
+  Although we don't want any RWX memory in system,
+  but there are still some may need it, so we give
+  them this function to check and ajust themself.
+*/
+int check_pcibios_enabled()
+{
+	return pcibios_enabled;
+}
+EXPORT_SYMBOL(check_pcibios_enabled);
+
 /* According to the BIOS specification at:
  * http://members.datafast.net.au/dft0802/specs/bios21.pdf, we could
  * restrict the x zone to some pages and make it ro. But this may be
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ