Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508602 - app-emulation/dosemu - system seems to hang after exiting dosemu (-c -k -V mode)
Summary: app-emulation/dosemu - system seems to hang after exiting dosemu (-c -k -V mode)
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Sergei Trofimovich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-24 13:14 UTC by Tom
Modified: 2019-06-15 07:21 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom 2014-04-24 13:14:39 UTC
Hello,

since the compilation problems have been fixed by you (dosemu using flex)
I'm able to play my old M$dog games again, but there is a problem after
exiting dosemu, which is reproducible every time:
after typing exitemu (within dosemu) or exiting the game played, which is
called as follows:
	dosemu -c -k -V -s <path-to-game.exe>
I can't get my shell prompt back - instead the system looks like hanging.
Switching to another VT doesn't work too.
Even typing the SIGINT or SIGKILL characters leads to no shell prompt.
The only thing, which can be done, is pressing the power button of my
laptop some seconds, in order to shut down the system.

The games are started from within the console without X running.

Below I've attached the following information:

- /^###1:/
  output of emerge --info dosemu

- /^###2:/
  extract of /var/log/message showing the kernel's backtrace for dosemu

- /^###3:/
  the full (short) contents of dosemu's boot.log

The games in question are running as expected with full sound support,
mouse and german keyboard layout, only the need for a reboot, after playing
them, is the problem...
Please don't tell me, it's actually a perfect emulation. ;)


Greetings Tom

---

###1: start of: emerge --info dosemu

Portage 2.2.8-r1 (default/linux/x86/13.0, gcc-4.7.3, glibc-2.17, 3.12.13-gentoo i686)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.12.13-gentoo-i686-Pentium-R-_Dual-Core_CPU_T4500_@_2.30GHz-with-gentoo-2.2
KiB Mem:     2038048 total,    146200 free
KiB Swap:    2160736 total,   2158148 free
Timestamp of tree: Thu, 24 Apr 2014 11:00:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.5-r3, 3.3.3
dev-util/cmake:           2.8.12.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
USE="X Xaw3d a52 aac accessibility acl acpi alsa amr apache2 berkdb bzip2 cairo cdda cddb cdr cli cracklib crypt css cups curl cxx dbus device-mapper dri dts dv dvd dvdr encode espeak exif extensions extras fam festival ffmpeg fftw firefox flac flatfile fontconfig fortran ftp gdbm gif gmp gphoto2 gstreamer iconv id3tag imagemagick inotify ipc ipv6 javascript jbig jit jpeg jpeg2k kde kpathsea ladspa lame latex libnotify libsamplerate lm_sensors lzma mad mbox mikmod mime mmap mms mmx modules mp3 mp4 mpeg ncurses nls nntp nptl nsplugin nss ogg opengl openmp pam pcmcia pcre pdf plasma plotutils png qt3support qt4 raw readline session snmp sockets speex spell sqlite sse sse2 sse3 ssl ssse3 startup-notification svg syslog system-sqlite sysvipc taglib tcpd theora tiff truetype twolame udev unicode usb v4l v4l2 vcd vhosts vim-syntax vorbis vpx wavpack wifi x264 x86 xft xine xinetd xml xpm xv xvid zlib" ABI_X86="32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en en_US en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="vesa vmware intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

app-emulation/dosemu-1.4.1_pre20130107-r3 was built with the following:
USE="X alsa -debug -fluidsynth -gpm -sndfile -svga"

###1: end of: emerge --info dosemu

---

###2: start of: extract of logs in file messages

Apr 22 12:26:57 laptop kernel: [  816.292228] ------------[ cut here ]------------
Apr 22 12:26:57 laptop kernel: [  816.292243] WARNING: CPU: 0 PID: 2936 at arch/x86/mm/pat.c:781 untrack_pfn+0x59/0xa2()
Apr 22 12:26:57 laptop kernel: [  816.292247] Modules linked in: pcspkr lpc_ich asus_laptop mfd_core input_polldev rfkill
Apr 22 12:26:57 laptop kernel: [  816.292263] CPU: 0 PID: 2936 Comm: dosemu.bin Not tainted 3.12.13-gentoo #1
Apr 22 12:26:57 laptop kernel: [  816.292267] Hardware name: ASUSTeK Computer Inc.         P50IJ               /P50IJ     , BIOS 203     12/04/2009
Apr 22 12:26:57 laptop kernel: [  816.292271]  00000000 00000000 f4cf3dc0 c13ead71 00000000 f4cf3df0 c102e116 c14c2db4
Apr 22 12:26:57 laptop kernel: [  816.292280]  00000000 00000b78 c14c2683 0000030d c10293c7 c10293c7 b778a000 f597eaa8
Apr 22 12:26:57 laptop kernel: [  816.292289]  00000000 f4cf3e00 c102e14a 00000009 00000000 f4cf3e24 c10293c7 f4cf3e14
Apr 22 12:26:57 laptop kernel: [  816.292298] Call Trace:
Apr 22 12:26:57 laptop kernel: [  816.292308]  [<c13ead71>] dump_stack+0x41/0x52
Apr 22 12:26:57 laptop kernel: [  816.292315]  [<c102e116>] warn_slowpath_common+0x74/0x8b
Apr 22 12:26:57 laptop kernel: [  816.292321]  [<c10293c7>] ? untrack_pfn+0x59/0xa2
Apr 22 12:26:57 laptop kernel: [  816.292327]  [<c10293c7>] ? untrack_pfn+0x59/0xa2
Apr 22 12:26:57 laptop kernel: [  816.292333]  [<c102e14a>] warn_slowpath_null+0x1d/0x1f
Apr 22 12:26:57 laptop kernel: [  816.292338]  [<c10293c7>] untrack_pfn+0x59/0xa2
Apr 22 12:26:57 laptop kernel: [  816.292346]  [<c10918e1>] unmap_single_vma+0x4a/0x332
Apr 22 12:26:57 laptop kernel: [  816.292353]  [<c109215b>] unmap_vmas+0x3b/0x5a
Apr 22 12:26:57 laptop kernel: [  816.292358]  [<c1094608>] unmap_region+0x69/0xa2
Apr 22 12:26:57 laptop kernel: [  816.292365]  [<c10943d8>] ? vma_gap_callbacks_propagate+0x13/0x28
Apr 22 12:26:57 laptop kernel: [  816.292370]  [<c10949ed>] ? vma_rb_erase+0x129/0x144
Apr 22 12:26:57 laptop kernel: [  816.292376]  [<c1097517>] ? move_page_tables+0x25b/0x280
Apr 22 12:26:57 laptop kernel: [  816.292381]  [<c10943d8>] ? vma_gap_callbacks_propagate+0x13/0x28
Apr 22 12:26:57 laptop kernel: [  816.292387]  [<c1095a59>] do_munmap+0x1a3/0x206
Apr 22 12:26:57 laptop kernel: [  816.292392]  [<c1097664>] move_vma+0x128/0x17c
Apr 22 12:26:57 laptop kernel: [  816.292398]  [<c1097874>] SyS_mremap+0x1bc/0x384
Apr 22 12:26:57 laptop kernel: [  816.292406]  [<c13ef23e>] sysenter_do_call+0x12/0x26
Apr 22 12:26:57 laptop kernel: [  816.292410] ---[ end trace 34c6223bb6b93b2c ]---
Apr 22 12:26:57 laptop kernel: [  816.317097] dosemu.bin:2936 conflicting memory types fe400000-fe800000 uncached-minus<->write-combining
Apr 22 12:26:57 laptop kernel: [  816.317104] reserve_memtype failed [mem 0xfe400000-0xfe7fffff], track uncached-minus, req write-back

###2: end of: extract of logs in file messages

---

###3: start of: dosemu's boot.log

major = 4 minor = 1
CONF: config variable parser_version_3 set
CONF: config variable c_system set
CONF: Parsing built-in dosemu.conf file.
CONF: config variable version_3_style_used set
CONF: Parsing built-in global.conf file.
CONF: config variable version_3_style_used unset
CONF: config variable version_3_style_used set
CONF: opened include file /etc/dosemu/dosemu.conf
CONF: closed include file /etc/dosemu/dosemu.conf
CONF: opened include file /root/.dosemurc
CONF: closed include file /root/.dosemurc
CONF: config variable skip_dosrc set
CONF: mapping driver = 'auto'
debug flags: -a+cw
CONF: Disabling use of pentium timer
CONF: dosbanner on
CONF: timer freq=18, update=54925
CONF: CPU set to 486
CONF: JIT CPUEMU set to 0 for 486
CONF: 8192k bytes EMS memory
CONF: EMS-frame = 0xe400
CONF: DPMI-Server on (0x5000)
CONF: DPMI base addr = 0xffffffff
CONF: PM DOS API Translator on
CONF: No DJGPP NULL deref checks: off
CONF: 32768k bytes XMS memory
CONF: dosemu running on console
CONF: VGA-BIOS-Segment 0
CONF: VGA-BIOS-Segment set to 0xc000
CONF: VGA-BIOS-Size 0
CONF: VGA-BIOS-Size set to 0xfe00
CHIPSET: 12
CONF: time mode = 'bios'
SER: directory /var/lock namestub LCK.. binary No
MOUSE: /dev/input/mice, type 7 using internaldriver: yes, emulate3buttons: no baudrate: 0
CONF: Keyboard-layout keyb-user
CONF: Keyboard-layout de-latin1
CONF: **** Warning: floppy /dev/fd0 not accessible, disabled
CONF: fastfloppy = 1
CONF: IPX support off
CONF(LPT0) f: (null)   c: lpr -l  t: 20  port: 0
CONF(LPT1) f: (null)   c: lpr -l -P lpt2  t: 20  port: 0
CONF: not allowing speaker port access
CONF: Packet Driver enabled.
device: /root/.dosemu/drives/c type 4 h: -1  s: -1   t: -1 drive C:
device: /root/.dosemu/drives/d type 4 h: -1  s: -1   t: -1 drive D:
CONF: config variable c_system unset
Linux kernel 3.12.13; CPU speed is 1200000000 Hz
CPU-EMU speed is 1200 MHz
major = 4 minor = 1
CONF: running exclusively as ROOT: uid=0 (cached 0) gid=0 (cached 0)
DBG_FD already set
DOSEMU-1.4.0.8 is coming up on Linux version 3.12.13-gentoo #1 SMP Sun Mar 30 14:49:49 CEST 2014 i686
Compiled with GCC version 4.7.3 -m32
CONF: reserving 640Kb at 0x00000 for 'd' (Base DOS memory (first 640K))
CONF: reserving 48Kb at 0xF4000 for 'r' (Dosemu reserved area)
Registering HWRAM, type=v base=0xfe400000 size=0x3fffff
CONF: reserving 4095Kb at 0xFE400000 for 'v' (Video memory)
Registering HWRAM, type=v base=0xd0000000 size=0xfffffff
CONF: reserving 262143Kb at 0xD0000000 for 'v' (Video memory)
Registering HWRAM, type=v base=0xa0000 size=0x20000
CONF: reserving 128Kb at 0xA0000 for 'v' (Video memory)
PKT: Cannot open raw sockets: No such file or directory
ERROR: KMEM mapping for 0xfe400000 was not allocated!
ERROR: mmap error in map_hardware_ram Resource temporarily unavailable
WARN: copying VBIOS file from /dev/mem
CONF: reserving 63Kb at 0xC0000 for 'V' (Video BIOS)
CONF: reserving 32832Kb at 0x100000 for 'x' (Extended memory (HMA+XMS))
registering /dev/input/mice for internal_mouse
SERIAL $Id$
CONF: reserving 16Kb at 0xE4000 for 'E' (EMS page frame)
CONF: reserving 16Kb at 0xE8000 for 'E' (EMS page frame)
CONF: reserving 16Kb at 0xEC000 for 'E' (EMS page frame)
CONF: reserving 16Kb at 0xF0000 for 'E' (EMS page frame)
CONF: reserving 80Kb at 0xD0000 for 'U' (Upper Memory Block (UMB, XMS 3.0))
TIME: using 9154 usec for updating ALRM timer
ERROR: MFS: couldn't find root path /MEDIA/CDROM
DOS termination requested
leavedos(dos_helper|534) called - shutting down

###3: end of: dosemu's boot.log

---
===

Reproducible: Always
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2016-10-29 12:16:14 UTC
This looks like a kernel bug. Userspace app should not be able to corrupt kernel. I've found a few similar kernel traces in internetz:

http://www.gossamer-threads.com/lists/linux/kernel/1941575

Hugh (one of kernel memory management wizards) says the following about
traces in mm:

"""
I could easily be wrong, but I think of this one as another manifestation
of the filemap.c:202 BUG_ON(page_mapped(page)) bug, whatever that is.

In each case, we have a BUG or WARNING at the point where we detect that
there should have been a pte in a page table, but it somehow disappeared.

VM_PFNMAP in this case, an ordinary file mapping in the other case; and
nothing to show in the anonymous case, there the page would just leak.
"""

Given that dosemu is a very specific workload for the kernel
it could easily trigger a rare bug in file system or memory
management subsystem.

Can you reproduce the failure on more recent kernel?
Comment 2 Tom 2016-10-29 13:28:54 UTC
> Can you reproduce the failure on more recent kernel?

Yes, this failure is reproducible with the following kernel versions too:
- 4.1.15-r1
- 4.4.6

Cheers Tom
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2017-01-22 16:41:14 UTC
Only now I've realized you are using -c -k -V
which steal console, keyboard and video handling off of kernel.

It kills my machine as well. Not sure it could be easily fixed.
Comment 4 Tom 2017-01-22 17:14:29 UTC
Those options worked well for many years (I'm using gentoo since February 2011) playing my old games, so older kernel versions handled them correctly.
But maybe things have changed in newer kernel versions in a way, those options don't work as expected...?

CU Tom
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2019-06-15 07:21:26 UTC
I would guess yes. With newer mitigations enabled by default it becomes harder and harder get physical memory mapped one-to-one (might break VGA or interrupt handlers?).

I suggest asking upstream mailing list at linux-msdos@vger.kernel.org if anything could be done about it.