Hi. Petr Vandrovec wrote: > CPL0 solution is certainly more localized, but I have hard problems > to convice myself that it is actually safe. I spent 2 days convincing myself the same way:) The most problematic part was to make sure that the stack is properly unwinded even if NMI comes before the exception handler managed to switch out of 16bit. But I think this is now handled. > I would appreciate if you could add comments what values are set OK, I did. But in fact that makes the patch only even more obfuscated:( It doesn't look possible to explain all the magic pattern and its constraints in a comments. But I tried:) The patch is attached. > by ESPFIX_SWITCH_16 + 8 + 4 and simillar moves, and what they actually > do. Fortunately there are no such moves. In an attempt to make the patch a little self-explanatory, I #define'd all the meaningfull values. So if there is a move to ESPFIX_SWITCH16_OFFS+some_value, it is safe to assume that the move is intended to load the ESPFIX_SWITCH16, and "some_value" is just the correction constant. So besides the 2 magic pointers, there are really no moves above the iret frame. > And convicing myself that ESPFIX_SWITCH_32 has just right value so > pushl %eax > pushl %es > lss ESPFIX_SWITCH_32,%esp > popl %es > popl %eax > actually works took almost an hour... I realize that and thats really the big problem of that patch. It is very obfuscated and difficult to understand. I guess if you see the first version of that patch, which was before I found the way to use the fixed offsets for locating the switches, you might just get sick:)