Re: Repeatable kernel crash [2.1.55, Wine, Control Panel]

Gabriel Paubert (paubert@iram.es)
Tue, 7 Oct 1997 08:15:08 +0100 (MET)


On Tue, 7 Oct 1997, Morten Welinder wrote:

>
> Thanks to Marcus Meissner for pointing out the culprit: modify_ldt
> (and not old_select as I suspected as it was the last thing I saw).
>
> The following program locks up Linux for me. Don't run this unless
> you have mounted your disks read-only. Note that without the final
> sleep(1), the crash doesn't seem to happen.
>

That's a simple problem, I found it a few weeks ago by inspection of the
source code just for curiosity, but did not have a time to make patch for
it. And I was not worried since I don't use DOSEMU or WINE (yet).

Modify_ldt should check that it does not try to invalidate one of the
selectors in CS, DS, ES, FS, GS and SS. You'll find CS, DS, ES and SS on
the stack, GS in its register. For FS it depends on kernel version:
on the stack for 2.0, in its register for 2.1.

The error to return in this case is probably EBUSY, otherwise you will run
into very nasty things during task switches. I first thought possible to
simply clear the corresponding registers, but it won't work for CS or SS,
and trigger segment related exceptions that Linux probably does not handle
very well, hence the lockup (the middle ground would be to return EBUSY
for CS and SS but silently clear DS, ES, FS and GS).

I can help in writing the patch (which kernel version), but I don't have much
time right now.

Gabriel