Greetings, I''ve undertaken a small task of porting grsecurity-2.1.9 to xen-3.0-testing. I''ve never done any sort of OS or kernel development before, so it''s pretty daunting. So far I''ve been able to compile an i386 kernel and compile and boot an x86_64 kernel with some of the grsec/PAX features working. I''m pretty sure that PAX_RANDSTACK is not working though because of CONFIG_X86_NO_TSS. The function the grsecurity patch adds to arch/i386/kernel/process.c is: #ifdef CONFIG_PAX_RANDKSTACK asmlinkage void pax_randomize_kstack(void) { struct tss_struct *tss = init_tss + smp_processor_id(); unsigned long time; if (!randomize_va_space) return; rdtscl(time); /* P4 seems to return a 0 LSB, ignore it */ #ifdef CONFIG_MPENTIUM4 time &= 0x1EUL; time <<= 2; else time &= 0xFUL; time <<= 3; #endif tss->esp0 ^= time; current->thread.esp0 = tss->esp0; } #endif I surrounded the tss_struct declaration and the tss->esp0/current->thread.esp0 assignments with #ifdef CONFIG_X86_NO_TSS lines to get the kernel to compile. That completely defeats the purpose of this function which is to randomize the kernel stack. What is available in Xen that is comparable to the capacity that struct tss_struct is used in if CONFIG_X86_NO_TSS is defined? Any ideas would be greatly appreciated. For reference GRSecurity is available at www.grsecurity.net <http://www.grsecurity.net/> . Thanks, John A. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> I surrounded the tss_struct declaration and the > tss->esp0/current->thread.esp0 assignments with #ifdef > CONFIG_X86_NO_TSS lines to get the kernel to compile. That completely > defeats the purpose of this function which is to randomize the kernel > stack. What is available in Xen that is comparable to the capacity > that struct tss_struct is used in if CONFIG_X86_NO_TSS is defined? > > Any ideas would be greatly appreciated. >Only the declaration and uses of the ''tss'' local variable should be CONFIG_X86_NO_TSS. You''ll still need to modify current->thread.esp0, and then execute HYPERVISOR_stack_switch(KERNEL_DS, current->thread.esp0). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Thanks very much, It appears to have done the trick, at least on x86_64. I wish I could get the i386 grsec kernel too boot so I could test it there too! :-). John A. -----Original Message----- From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] Sent: Tuesday, June 27, 2006 2:02 AM To: John Anderson Cc: xen-devel@lists.xensource.com Subject: Re: [Xen-devel] grsecurity +XEN w/o HVM> I surrounded the tss_struct declaration and the > tss->esp0/current->thread.esp0 assignments with #ifdef > CONFIG_X86_NO_TSS lines to get the kernel to compile. That completely > defeats the purpose of this function which is to randomize the kernel > stack. What is available in Xen that is comparable to the capacity > that struct tss_struct is used in if CONFIG_X86_NO_TSS is defined? > > Any ideas would be greatly appreciated. >Only the declaration and uses of the ''tss'' local variable should be CONFIG_X86_NO_TSS. You''ll still need to modify current->thread.esp0, and then execute HYPERVISOR_stack_switch(KERNEL_DS, current->thread.esp0). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel