VOGONS


First post, by jal

User metadata
Rank Oldbie
Rank
Oldbie

I seem to attract crashes of home-build DOSBox versions. After having done almost nothing with DOSBox for a year, I decided to try to compile 0.74 with debuggin enabled, using my trusted Ubuntu (9.10). So I did a "./configure --enable-debug", a "make all", a "cd src" and a "./dosbox". Unfortunately, I got a crash. Repeating it with gdb (starting DOSBox, that is), I get this:

Starting program: /media/jekalah/gyowe/dosbox-0.74/src/dosbox 
[Thread debugging using libthread_db enabled]
DOSBox version 0.74
Copyright 2002-2010 DOSBox Team, published under GNU GPL.
---
[New Thread 0xb3dc8b70 (LWP 3326)]
[Thread 0xb3dc8b70 (LWP 3326) exited]
[New Thread 0xb3dc8b70 (LWP 3328)]
CONFIG:Loading primary settings from config file /home/kilian/.dosbox/dosbox-0.74.conf

Program received signal SIGSEGV, Segmentation fault.
PAGING (sec=0x9f2d970) at paging.cpp:878
878 PAGING_InitTLB();
(gdb) bt
#0 PAGING (sec=0x9f2d970) at paging.cpp:878
#1 PAGING_Init (sec=0x9f2d970) at paging.cpp:890
#2 0x081ded69 in Section::ExecuteInit (this=0x9f2d970, initall=true) at setup.cpp:728
#3 0x081dedbb in Config::Init (this=0xbffff3b0) at setup.cpp:712
#4 0x0812290e in main (argc=1, argv=0xbffff4e4) at sdlmain.cpp:1854

Since I'm on rediculous little time lately, I have can't investigate it too deeply, although I did notice that PAGING_InitTLB() is surrounded by some #ifdefs, so am I forgetting some parameters with the config or something?

JAL

Reply 1 of 12, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It seems there's some problem running debug enabled builds from MSys. See here. Maybe it doesn't apply to you, but thought of it because you're running DOSBox from inside the compile environment.

Reply 2 of 12, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

configure --enable-debug should work fine.

Which version of GCC and which architecture are you on ?

Water flows down the stream
How to ask questions the smart way!

Reply 3 of 12, by jal

User metadata
Rank Oldbie
Rank
Oldbie
Qbix wrote:

configure --enable-debug should work fine.

That's what I thought, as I used it in the (not so near) past.

Which version of GCC and which architecture are you on ?

Yeah, should've listed that as well. It's Ubuntu 9.10 running on x86-32, with the GCC that came with it (I'm not presently at my own PC, I'll check tonight for the exact version).

JAL

Reply 4 of 12, by jal

User metadata
Rank Oldbie
Rank
Oldbie

gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1

Reply 5 of 12, by jal

User metadata
Rank Oldbie
Rank
Oldbie

Ok, I'm baffled. I put some LOG_MSG inside the initialization loop in PAGING_InitTlb(), and the first assignment crashes for index 272252, at address 0x836a000. Directly assigning a value to that address also crashes DOSBox. A variable declared after the global variable paging can be assigned without a problem, and objdump shows that paging starts at 0x8260200 for 1420458 bytes (and indeed the newly declared variable starts at 0x9680658 as one would expect). Schiet mij maar lek.

JAL

Reply 6 of 12, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Memtest? 😁

1+1=10

Reply 7 of 12, by jal

User metadata
Rank Oldbie
Rank
Oldbie
h-a-l-9000 wrote:

Memtest?

Yeah, came to mind. However, I'd expect everything else to be unstable as well, which it isn't. No mysterious crashes (of other applciations) yet.

JAL

Reply 8 of 12, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

tried valgrind ?
although it doesn't seem to be out of bounds.

Water flows down the stream
How to ask questions the smart way!

Reply 9 of 12, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Is there any (configurable?) hardening enabled for that linux version? Like some software DEP?
Not that the crash would make sense then.

Is USE_FULL_TLB defined? (should be, paging.h, and check which of the PAGING_InitTLB
functions is really called, like where you put the logging).

Does excessively increasing TLB_SIZE help?

Reply 10 of 12, by jal

User metadata
Rank Oldbie
Rank
Oldbie
wd wrote:

Is there any (configurable?) hardening enabled for that linux version? Like some software DEP? Not that the crash would make sense then.

Don't think my Celeron supports DEP. And indeed, it wouldn't make much sense.

Is USE_FULL_TLB defined? (should be, paging.h, and check which of the PAGING_InitTLB functions is really called, like where you put the logging).

Yes, it is defined. I tried compiling without it defined, but then it crashed on initializing the alternative paging structures that are used in that case.

Does excessively increasing TLB_SIZE help?

Haven't tried it yet. The weird thing is that, as Qbix already noted, it is not out of bounds: it crashes on an address that is comfortably within the area reserved for the paging structure. The only thing that I can think of is that somehow .bss does not get initialized properly (I tried a memset of the entire paging structure, but that also segfaults), as the crashes occur on page boundaries (after rebooting, it now crashes at index 271780, address 0x8370000).

JAL

Reply 11 of 12, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The weird thing is that, as Qbix already noted, it is not out of bounds:

Yes but it's at a page boundary so software DEP or any page protection may
trigger for whatever reason.

Reply 12 of 12, by jal

User metadata
Rank Oldbie
Rank
Oldbie
Qbix wrote:

tried valgrind ?
although it doesn't seem to be out of bounds.

I tried valgrind, but unfortunately it doesn't crash at the same point, but somewhat later. Sigh...

JAL