[PATCH] prevent unloading a running vm

Ludwig Nussel ludwig.nussel at suse.de
Sat Mar 22 13:46:24 EDT 2008


Some older version of World of Padman called
trap_Cmd_ExecuteText(EXEC_NOW, "snd_restart");
during UI_INIT. That in turn leads to vid_restart which unloads and
reloads the ui. That means the generated program code which is
being executed in that moment is rewritten. Turns out that this
works with vm_interpreted and vm_x86. I assume by accident as the
newly generated code is placed at the exact same address so a return
from a function actually jumps back at the correct code. Not so with
vm_x86_64. Code apparently gets mapped at a different place the
second time and the previous vm jumps into the void...
Anyways, that situation is not meant to happen and the mod headers
clearly state that EXEC_NOW should not be used.
So my fix would be to
1. translate EXEC_NOW into EXEC_INSERT if used together with snd_restart or
   vid_restart. That maintains backward compatability.
2. gracefully die if VM_Free is called on a running vm instead of waiting for
   segfault to happen.

Patches are attached. Ack/nack anyone?


 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-catch-Cbuf_ExecuteText-EXEC_NOW-.-from-the-ui-as.patch
Type: text/x-diff
Size: 891 bytes
Desc: not available
URL: <http://icculus.org/pipermail/quake3/attachments/20080322/60bd4d31/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-use-vm-callLevel-to-count-recursive-calls-to-VM_Cal.patch
Type: text/x-diff
Size: 4513 bytes
Desc: not available
URL: <http://icculus.org/pipermail/quake3/attachments/20080322/60bd4d31/attachment-0001.bin>

More information about the quake3 mailing list