aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/util.c')
-rw-r--r--arch/um/os-Linux/util.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 0e771bb04dd2..48bc4927b996 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -29,28 +29,29 @@
29#include "uml-config.h" 29#include "uml-config.h"
30#include "os.h" 30#include "os.h"
31#include "longjmp.h" 31#include "longjmp.h"
32#include "kern_constants.h"
32 33
33void stack_protections(unsigned long address) 34void stack_protections(unsigned long address)
34{ 35{
35 int prot = PROT_READ | PROT_WRITE | PROT_EXEC; 36 int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
36 37
37 if(mprotect((void *) address, page_size(), prot) < 0) 38 if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot) < 0)
38 panic("protecting stack failed, errno = %d", errno); 39 panic("protecting stack failed, errno = %d", errno);
39} 40}
40 41
41void task_protections(unsigned long address) 42void task_protections(unsigned long address)
42{ 43{
43 unsigned long guard = address + page_size(); 44 unsigned long guard = address + UM_KERN_PAGE_SIZE;
44 unsigned long stack = guard + page_size(); 45 unsigned long stack = guard + UM_KERN_PAGE_SIZE;
45 int prot = 0, pages; 46 int prot = 0, pages;
46 47
47#ifdef notdef 48#ifdef notdef
48 if(mprotect((void *) stack, page_size(), prot) < 0) 49 if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot) < 0)
49 panic("protecting guard page failed, errno = %d", errno); 50 panic("protecting guard page failed, errno = %d", errno);
50#endif 51#endif
51 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2; 52 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2;
52 prot = PROT_READ | PROT_WRITE | PROT_EXEC; 53 prot = PROT_READ | PROT_WRITE | PROT_EXEC;
53 if(mprotect((void *) stack, pages * page_size(), prot) < 0) 54 if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot) < 0)
54 panic("protecting stack failed, errno = %d", errno); 55 panic("protecting stack failed, errno = %d", errno);
55} 56}
56 57