lkml.org 
[lkml]   [2015]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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).


\
 
 \ /
  Last update: 2015-03-08 21:41    [W:0.107 / U:1.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site