Re: 2.6.12-rc1 breaks dosemu

From: Bart Oldeman
Date: Sat Mar 26 2005 - 03:46:52 EST


On Sat, 26 Mar 2005, Arjan van de Ven wrote:

> looking at the dosemu code; the following bit looks a tad suspect:
>
> unsigned long int stk_ptr, stk_beg, stk_end;
> ...
> if ((fp = fopen("/proc/self/maps", "r"))) {
> while(fgets(line, 100, fp)) {
> sscanf(line, "%lx-%lx", &stk_beg, &stk_end);
> if (stk_ptr >= stk_beg && stk_ptr < stk_end) {
> stack_init_top = stk_end;
> stack_init_bot = stk_beg;
> c_printf("CPU: Stack bottom %#lx, top %#lx, esp=%#lx\n",
> stack_init_bot, stack_init_top, stk_ptr);
> break;
> }
> }
> fclose(fp);
> }
>
> do you see that printf somewhere in the logs?
> (afaics stk_ptr never gets initialized; what the code meant probably was
> if (&stk_ptr >= stk_beg && &stk_ptr < stk_end) {
> but the dosemu code is missing the two &'s )

I think stk_ptr is OK, and the log reports it correctly. Inline assembly
gives it the value of esp. Also, this code is meant for DPMI programs so
if it is the culprit it should not crash dosemu straight away, only if
you'd start DOOM or something like that.

The log prints:
CPU: Stack bottom 0xbfd61000, top 0xbfd76000, esp=0xbfd75480

To Arnd:
There is one more improbable thing I can think of: comcom. This is
dosemu's built-in command.com and uses some very tricky code
(coopthreads), which certainly does not work any more with address space
randomization. It's deprecated but was still present in 1.2.2, and Debian
packages still used it with dosemu 1.2.1. The fix for that one is easy:
replace your command.com with a real DOS command.com (e.g. FreeDOS
freecom).

Bart

-
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/