--- zzzz-none-000/linux-2.6.19.2/include/linux/sched.h 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5504/linux-2.6.19.2/include/linux/sched.h 2007-01-19 14:42:56.000000000 +0000 @@ -87,6 +87,7 @@ struct exec_domain; struct futex_pi_state; +struct linux_binprm; /* * List of flags we want to share for kernel threads, @@ -355,8 +356,34 @@ /* aio bits */ rwlock_t ioctx_list_lock; struct kioctx *ioctx_list; + +#if defined(CONFIG_PAX_NOEXEC) || defined(CONFIG_PAX_ASLR) + unsigned long pax_flags; +#endif + +#ifdef CONFIG_PAX_DLRESOLVE + unsigned long call_dl_resolve; +#endif + +#if defined(CONFIG_PPC32) && defined(CONFIG_PAX_EMUSIGRT) + unsigned long call_syscall; +#endif + +#ifdef CONFIG_PAX_ASLR + unsigned long delta_mmap; /* randomized offset */ + unsigned long delta_exec; /* randomized offset */ + unsigned long delta_stack; /* randomized offset */ +#endif + }; +#define MF_PAX_PAGEEXEC 0x01000000 /* Paging based non-executable pages */ +#define MF_PAX_EMUTRAMP 0x02000000 /* Emulate trampolines */ +#define MF_PAX_MPROTECT 0x04000000 /* Restrict mprotect() */ +#define MF_PAX_RANDMMAP 0x08000000 /* Randomize mmap() base */ +/*#define MF_PAX_RANDEXEC 0x10000000*/ /* Randomize ET_EXEC base */ +#define MF_PAX_SEGMEXEC 0x20000000 /* Segmentation based non-executable pages */ + struct sighand_struct { atomic_t count; struct k_sigaction action[_NSIG]; @@ -466,8 +493,18 @@ struct pacct_struct pacct; /* per-process accounting information */ #endif #ifdef CONFIG_TASKSTATS + spinlock_t stats_lock; struct taskstats *stats; #endif + +#ifdef CONFIG_GRKERNSEC + u32 curr_ip; + u32 gr_saddr; + u32 gr_daddr; + u16 gr_sport; + u16 gr_dport; + u8 used_accept:1; +#endif }; /* Context switch must be unlocked if interrupts are to be enabled */ @@ -1013,6 +1050,17 @@ struct list_head pi_state_list; struct futex_pi_state *pi_state_cache; +#ifdef CONFIG_GRKERNSEC + /* grsecurity */ + struct acl_subject_label *acl; + struct acl_role_label *role; + struct file *exec_file; + u16 acl_role_id; + u8 acl_sp_role:1; + u8 is_writable:1; + u8 brute:1; +#endif + atomic_t fs_excl; /* holding fs exclusive resources */ struct rcu_head rcu; @@ -1595,6 +1643,12 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) { mm->mmap_base = TASK_UNMAPPED_BASE; + +#ifdef CONFIG_PAX_RANDMMAP + if (mm->pax_flags & MF_PAX_RANDMMAP) + mm->mmap_base += mm->delta_mmap; +#endif + mm->get_unmapped_area = arch_get_unmapped_area; mm->unmap_area = arch_unmap_area; }