Re: [PATCH 1/2] boot: ignore early NMIs

From: Eric W. Biederman
Date: Thu Mar 08 2012 - 11:31:59 EST


Fernando Luis VÃzquez Cao <fernando@xxxxxxxxxxxxx> writes:

>> Is just a jump and not a move followed by a jump still 10 bytes?
>> I hate to say it but I think this fails miserably for any exception
>> after a nmi.
>
> Thank you for the heads up! Actually, it was working for the
> exceptions after the nmi but with a corrupted esi (vector
> number). My original intention was to fill the empty space
> with nops but forgot to actually implement it... Sorry about
> that. Will fix for the next iteration.

Sound good, and thank you very much for tackling this.

>> I expect the simplest solution is to modify early_idt_handler to test
>> for vector == 2.
>
> That is precisely what I did on a previous version but that would
> involve using registers which need to be saved and restored and
> I wanted to avoid using the stack in the NMI path. We would also
> need to add a "pushq rsi " in early_idt_handlers which implies
> modifying "early_idt_handlers" definition in "segment.h".
>
> If you are OK with it I would like to go with the approach in
> the two patches I sent.

I am fine with your approach. I suggest a big fat comment mentioning
the 10 byte requirement and the register requirement.

Neither one is locally obvious which makes it easy to goof when
modifying the code.

>> Doing something less brittle than:
>>> extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][10];
>> in segment.h might be a good idea as well.
>
> Yes, I agree. I will give it some thought.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/