]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/i386/kernel/process.c
[PATCH] i386/x86-64: Don't randomize stack top when no randomization personality...
[net-next-2.6.git] / arch / i386 / kernel / process.c
index 923bb292f47fbc91ac978777ab69eafc28a2535c..b741c3e1a5ebd49501dc2e3a100dd68549863b52 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/kallsyms.h>
 #include <linux/ptrace.h>
 #include <linux/random.h>
+#include <linux/personality.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -690,8 +691,8 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
        /*
         * Now maybe handle debug registers and/or IO bitmaps
         */
-       if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW))
-           || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP))
+       if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW)
+           || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP)))
                __switch_to_xtra(next_p, tss);
 
        disable_tsc(prev_p, next_p);
@@ -905,7 +906,7 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
 
 unsigned long arch_align_stack(unsigned long sp)
 {
-       if (randomize_va_space)
+       if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
                sp -= get_random_int() % 8192;
        return sp & ~0xf;
 }