From 88d10f8179d33dae46cb696a8d4f5aa751f240d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Januszewski?= Date: Mon, 8 Sep 2008 01:35:30 +0200 Subject: [PATCH] Map the VRAM and Video ROM/System ROM seperately. lrmi maps both the Video RAM and ROM with PROT_EXEC. This can cause problems on systems with NX and PaX. In order to avoid these, map the RAM and ROM areas separately, with different PROT_* flags. --- libs/lrmi-0.10/lrmi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libs/lrmi-0.10/lrmi.c b/libs/lrmi-0.10/lrmi.c index c68d753..de75e75 100644 --- a/libs/lrmi-0.10/lrmi.c +++ b/libs/lrmi-0.10/lrmi.c @@ -347,14 +347,23 @@ LRMI_init(void) return 0; } - if (!map_file((void *)0xa0000, 0x100000 - 0xa0000, - PROT_READ | PROT_WRITE | PROT_EXEC, + if (!map_file((void *)0xa0000, 0x20000, + PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, "/dev/mem", 0xa0000)) { munmap((void *)0, 0x502); real_mem_deinit(); return 0; } + if (!map_file((void *)0xc0000, 0x30000, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_FIXED | MAP_SHARED, "/dev/mem", 0xc0000)) { + munmap((void *)0, 0x502); + munmap((void *)0xa0000, 0x20000); + real_mem_deinit(); + return 0; + } + /* Allocate a stack */ -- 2.11.4.GIT