Messages in this thread | | | From | Denys Vlasenko <> | Date | Sun, 8 Mar 2015 20:59:21 +0100 | Subject | Re: [x86/asm/entry] BUG: unable to handle kernel paging request |
| |
On Sun, Mar 8, 2015 at 8:41 PM, Andy Lutomirski <luto@amacapital.net> wrote: >>> 4. Not directly related, but the 32-bit tss_struct contains this gem: >>> >>> /* >>> * .. and then another 0x100 bytes for the emergency kernel stack: >>> */ >>> unsigned long stack[64]; >>> >>> Last I checked, 0x100 != 64. Also, wow, this is kind of disgusting. :) >> >> >> Seems to be unused: I commented it out on "defconfig" build >> and got no build errors. > > It's used. On 32-bit, NMIs don't use task gates (I don't know why), > so sysenter is set up to set rsp to point to that "stack".
Where is it set up that way? Aha. Here?
void enable_sep_cpu(void) { int cpu = get_cpu(); struct tss_struct *tss = &per_cpu(cpu_tss, cpu); ... tss->x86_tss.ss1 = __KERNEL_CS; tss->x86_tss.sp1 = sizeof(struct tss_struct) + (unsigned long) tss; wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0);
Can this be written in a way so that the field we use here in fact gets referenced? I propose this:
tss->x86_tss.sp1 = (unsinged long) &tss->stack + sizeof(tss->stack);
(And I would rename it "emergency_stack" or something).
| |