--- zzzz-none-000/linux-2.6.19.2/include/linux/mm.h 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/include/linux/mm.h 2007-01-19 14:42:56.000000000 +0000 @@ -39,6 +39,7 @@ #include #include #include +#include #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) @@ -112,8 +113,43 @@ #ifdef CONFIG_NUMA struct mempolicy *vm_policy; /* NUMA policy for the VMA */ #endif + + unsigned long vm_mirror; /* PaX: mirror distance */ }; +#ifdef CONFIG_PAX_SOFTMODE +extern unsigned int pax_softmode; +#endif + +extern int pax_check_flags(unsigned long *); + +/* if tsk != current then task_lock must be held on it */ +#if defined(CONFIG_PAX_NOEXEC) || defined(CONFIG_PAX_ASLR) +static inline unsigned long pax_get_flags(struct task_struct *tsk) +{ + if (likely(tsk->mm)) + return tsk->mm->pax_flags; + else + return 0UL; +} + +/* if tsk != current then task_lock must be held on it */ +static inline long pax_set_flags(struct task_struct *tsk, unsigned long flags) +{ + if (likely(tsk->mm)) { + tsk->mm->pax_flags = flags; + return 0; + } + return -EINVAL; +} +#endif + +#ifdef CONFIG_PAX_HAVE_ACL_FLAGS +extern void pax_set_initial_flags(struct linux_binprm * bprm); +#elif defined(CONFIG_PAX_HOOK_ACL_FLAGS) +extern void (*pax_set_initial_flags_func)(struct linux_binprm * bprm); +#endif + /* * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is * disabled, then there's a single shared list of VMAs maintained by the @@ -167,6 +203,18 @@ #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ +#ifdef CONFIG_PAX_SEGMEXEC +#define VM_MIRROR 0x04000000 /* vma is mirroring another */ +#endif + +#ifdef CONFIG_PAX_MPROTECT +#define VM_MAYNOTWRITE 0x08000000 /* vma cannot be granted VM_WRITE any more */ +#endif + +#ifdef __VM_STACK_FLAGS +#define VM_STACK_DEFAULT_FLAGS (0x00000033 | __VM_STACK_FLAGS) +#endif + #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS #endif @@ -1130,5 +1178,11 @@ __attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma); +#ifdef CONFIG_ARCH_TRACK_EXEC_LIMIT +extern void track_exec_limit(struct mm_struct *mm, unsigned long start, unsigned long end, unsigned long prot); +#else +static inline void track_exec_limit(struct mm_struct *mm, unsigned long start, unsigned long end, unsigned long prot) {} +#endif + #endif /* __KERNEL__ */ #endif /* _LINUX_MM_H */