logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
NWNX2 2.7b3 free(): invalid pointer
Goto page Previous  1, 2
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Mon Mar 10, 2008 19:11    Post subject: Reply with quote

Regarding the 'leave' instruction:
http://en.wikipedia.org/wiki/Function_prologue#Epilogue
leave is equal to
Code:
mov  %ebp, %esp
pop  %ebp
It's a standard function epilogue.
Regardless of what you do with esp in the function, the stack won't break as long as function prologue & epilogue are in the right places.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
zzqzzq_zzq



Joined: 23 Feb 2008
Posts: 11

PostPosted: Wed Mar 12, 2008 2:28    Post subject: Reply with quote

Yeah, I finally figured that out, after a little googling..

I've a pretty similar compiler version on my Ubuntu box, which is running into the same flakey SEGV's, so I'm not certain exactly what's going on..

g++ (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)

FWIW,

pusha/popa does not work at _all_. (Well, it will work so long I do them in sequence, but in any of the NWNX code, they SEGV pretty reliably, since there's various calls in between them.) <shrug> I've a few suspicions, but they're too lengthy to put here..

But anyways, I've been so far commenting out the pusha's, and the popa's.

I couldn't quickly find a copy of the i386 register ABI, but since I only see $eax being used directly, I think its safe on which registers are required to be saved across functions..

But so far it seems to be working...

I went through events 1.1.7, and made a few changes.. (commented out the pusha/popa's everywhere, and did some stack corrections in:

void ConversationNodeSelectHookProc():

// asm ("add $0x20, %esp");
asm ("add $0x18, %esp");

void ConditionalScriptHookProc()

// asm ("add $0x10, %esp");
asm ("add $0x0c, %esp");

Since too it appears too much was being cleaned off the stack by my math...

RunScript() also need the same sort of changes RunScript, in nwnx_chat did, as I mentioned earlier...

So far it seems relatively stable on the server I'm running this on... (albeit this is w/ pretty light testing...)

Need to chase a problem with the MySQL database "going away", and I don't think NWNX_LETO is working yet either....

HTH,

David
Back to top
View user's profile Send private message
SpiderX



Joined: 14 Aug 2007
Posts: 12

PostPosted: Wed May 07, 2008 11:11    Post subject: Reply with quote

Quote:
Yes, Hashset is one of the plugins that return static memory pointers, so it may cause crashes with 2.7-b3.

No, Hashset is one of the plugins that return static memory pointers, so it will cause crashes with 2.7-b3. Tested.
Code:
NWNX2lib: Init
NWNX2lib: org SetString() at 0x81f1660, new SetString() at 0xb7f3ae4c
NWNX2lib: org GetObj() at 0x81f1568, new GetObj() at 0xb7f3ae74
* Parsing configuration...
NWN Extender v2.7-beta2
(c) 2004 by the APS/NWNX Linux Conversion Group
(c) 2007 by virusman
Based on the Win32 version (c) 2003 by Ingmar Stieger (Papillon)
and Jeroen Broekhuizen
visit us at http://www.avlis.org

* Loading modules...
HASHSET plugin Registerred.
FUNCTIONS plugin Registerred.
LETO plugin Registerred.
EVENTS plugin Registerred.
ODBC plugin Registerred.
CONFIG: [VAULTSTER] plugin disabled.
RESETPLUGIN plugin Registerred.
TMI plugin Registerred.
STRUCTS plugin Registerred.
FIXES plugin Registerred.
* NWNX2 activated.
Neverwinter Nights Server
Build:8099
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

Server: Loading module "Arena"...
Server: Module loaded
NWNX!INIT enforcement disabled, using 0x0820149c
*** glibc detected *** ./nwserver: free(): invalid pointer: 0x0e1a36fc ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e02a85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7e064f0]
...............................................................................
b7eff000-b7f22000 r-xp 00000000 08:01 393026     /lib/tls/i686/cmov/libm-2.7.so
b7f22000-b7f24000 rwxp 00023000 08:01 393026     /lib/tls/i686/cmov/libm-2.7.so
b7f24000-b7f26./nwnstartup.sh: line 20: 31008 Aborted


And that`s a problem.
Any chance that hashset will work with 2.7-b3?
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed May 07, 2008 15:00    Post subject: Reply with quote

Sure Smile
http://www.nwnx.org/phpBB2/viewtopic.php?p=8278#8278
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
SpiderX



Joined: 14 Aug 2007
Posts: 12

PostPosted: Wed May 07, 2008 19:25    Post subject: Reply with quote

Great!
Thank`s! Smile
Back to top
View user's profile Send private message
SpiderX



Joined: 14 Aug 2007
Posts: 12

PostPosted: Thu May 15, 2008 6:50    Post subject: Reply with quote

Not everything seems to be working fine Sad

Quote:
spiderx@spiderx:~/Games/NWN$ ./nwnstartup.sh

NWNX2lib: Init
NWNX2lib: org SetString() at 0x81f1660, new SetString() at 0xb7f80f00
NWNX2lib: org GetObj() at 0x81f1568, new GetObj() at 0xb7f80f28
* Parsing configuration...
NWN Extender v2.7-beta4
(c) 2004 by the APS/NWNX Linux Conversion Group
(c) 2007-2008 by virusman
Based on the Win32 version (c) 2003 by Ingmar Stieger (Papillon)
and Jeroen Broekhuizen
visit us at http://www.avlis.org

* Loading modules...
HASHSET plugin Registerred.
FUNCTIONS plugin Registerred.
LETO plugin Registerred.
MNX plugin Registerred.
EVENTS plugin Registerred.
ODBC plugin Registerred.
CONFIG: [VAULTSTER] plugin disabled.
RESETPLUGIN plugin Registerred.
TMI plugin Registerred.
STRUCTS plugin Registerred.
FIXES plugin Registerred.
* NWNX2 activated.
Neverwinter Nights Server
Build:8099
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

Server: Loading module "Arena"...
Server: Module loaded
NWNX!INIT enforcement disabled, using 0x0820149c
NWNX!INIT enforcement disabled, using 0x08201129
*** glibc detected *** ./nwserver: malloc(): memory corruption (fast): 0x0e22f838 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e48962]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x8d)[0xb7e49cad]
./nwserver[0x8307b1d]
./nwserver[0x8307c60]
./nwserver[0x825b3c0]
./nwserver[0x825d9f3]
./nwserver[0x825d46c]
./nwserver[0x81fb283]
./nwserver[0x822d5de]
./nwserver[0x825b826]
./nwserver[0x825d9f3]
./nwserver[0x825d46c]
./nwserver[0x8238608]
./nwnx_events.so(_Z25ConditionalScriptHookProcv+0x295)[0xb7a4ead3]
./nwserver[0x8239f00]
./nwnx_events.so(_Z30ConversationNodeSelectHookProcv+0x10e)[0xb7a4e832]
./nwserver[0x81d2950]
./nwserver[0x81862a9]
./nwserver[0x81947ce]
./nwserver[0x809d99e]
./nwserver[0x829b830]
./nwserver[0x829a27d]
./nwserver[0x829b76b]
./nwserver[0x809fe78]
./nwserver(strftime+0x1063)[0x804bbe7]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7df2450]
./nwserver(read+0x4d)[0x804b191]
======= Memory map: ========
08048000-0805d000 r-xp 00000000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
0805d000-0805e000 rwxp 00015000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
0805e000-08068000 r-xp 00016000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08068000-08069000 rwxp 00020000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08069000-08073000 r-xp 00021000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08073000-08075000 rwxp 0002b000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08075000-08084000 r-xp 0002d000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08084000-08085000 rwxp 0003c000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08085000-08108000 r-xp 0003d000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08108000-08109000 rwxp 000c0000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08109000-08113000 r-xp 000c1000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08113000-08114000 rwxp 000cb000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08114000-08116000 r-xp 000cc000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08116000-08117000 rwxp 000ce000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08117000-08128000 r-xp 000cf000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08128000-0812b000 rwxp 000e0000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
0812b000-08190000 r-xp 000e3000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08190000-08191000 rwxp 00148000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08191000-081a0000 r-xp 00149000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
081a0000-081a1000 rwxp 00158000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
081a1000-081f1000 r-xp 00159000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
081f1000-081f2000 rwxp 001a9000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
081f2000-08238000 r-xp 001aa000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08238000-0823a000 rwxp 001f0000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
0823a000-0825a000 r-xp 001f2000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
0825a000-0825c000 rwxp 00212000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
0825c000-082d4000 r-xp 00214000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
082d4000-082d5000 rwxp 0028c000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
082d5000-08329000 r-xp 0028d000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
08329000-083c9000 rwxp 002e0000 08:05 3702805 /home/spiderx/Games/NWN/nwserver
083c9000-0e268000 rwxp 083c9000 00:00 0 [heap]
b5900000-b5921000 rwxp b5900000 00:00 0
b5921000-b5a00000 ---p b5921000 00:00 0
b5ae6000-b5ae7000 rwxp b5ae6000 00:00 0
b5ae7000-b5ae8000 ---p b5ae7000 00:00 0
b5ae8000-b644d000 rwxp b5ae8000 00:00 0
b644d000-b645c000 r-xp 00000000 08:01 393046 /lib/tls/i686/cmov/libresolv-2.7.so
b645c000-b645e000 rwxp 0000f000 08:01 393046 /lib/tls/i686/cmov/libresolv-2.7.so
b645e000-b6460000 rwxp b645e000 00:00 0
b6460000-b6464000 r-xp 00000000 08:01 393033 /lib/tls/i686/cmov/libnss_dns-2.7.so
b6464000-b6466000 rwxp 00003000 08:01 393033 /lib/tls/i686/cmov/libnss_dns-2.7.so
b6473000-b6474000 ---p b6473000 00:00 0
b6474000-b6ca0000 rwxp b6474000 00:00 0
b6ca1000-b6f6a000 rwxp b6ca1000 00:00 0
b6f6a000-b6f6c000 r-xp 00000000 08:01 375455 /lib/libnss_mdns4_minimal.so.2
b6f6c000-b6f6d000 rwxp 00001000 08:01 375455 /lib/libnss_mdns4_minimal.so.2
b6f6d000-b6fe9000 rwxp b6f6d000 00:00 0
b6fe9000-b6fea000 ---p b6fe9000 00:00 0
b6fea000-b77eb000 rwxp b6fea000 00:00 0
b77eb000-b77ef000 r-xp 00000000 08:05 3702790 /home/spiderx/Games/NWN/nwnx_fixes.so
b77ef000-b77f0000 rwxp 00003000 08:05 3702790 /home/spiderx/Games/NWN/nwnx_fixes.so
b77f0000-b77f1000 rwxp b77f0000 00:00 0
b77f1000-b77fe000 r-xp 00000000 08:05 3702797 /home/spiderx/Games/NWN/nwnx_structs.so
b77fe000-b77ff000 rwxp 0000c000 08:05 3702797 /home/spiderx/Games/NWN/nwnx_structs.so
b77ff000-b7800000 rwxp b77ff000 00:00 0
b7800000-b7809000 r-xp 00000000 08:01 393035 /lib/tls/i686/cmov/libnss_files-2.7.so
b7809000-b780b000 rwxp 00008000 08:01 393035 /lib/tls/i686/cmov/libnss_files-2.7.so
b780b000-b7817000 r-xp 00000000 08:05 3702798 /home/spiderx/Games/NWN/nwnx_tmi.so
b7817000-b7818000 rwxp 0000b000 08:05 3702798 /home/spiderx/Games/NWN/nwnx_tmi.so
b7818000-b7919000 rwxp b7818000 00:00 0
b7919000-b7964000 r-xp 00000000 08:05 950284 /home/spiderx/Games/NWN/nwnx_odbc.so
b7964000-b7a46000 rwxp 0004a000 08:05 950284 /home/spiderx/Games/NWN/nwnx_odbc.so
b7a46000-b7a56000 r-xp 00000000 08:05 3702789 /home/spiderx/Games/NWN/nwnx_events.so
b7a56000-b7a57000 rwxp 00010000 08:05 3702789 /home/spiderx/Games/NWN/nwnx_events.so
b7a57000-b7a61000 r-xp 00000000 08:05 3702794 /home/spiderx/Games/NWN/nwnx_mnx.so
b7a61000-b7a62000 rwxp 00009000 08:05 3702794 /home/spiderx/Games/NWN/nwnx_mnx.so
b7a62000-b7aa1000 r-xp 00000000 08:01 157069 /usr/lib/locale/en_US.utf8/LC_CTYPE
b7aa1000-b7aa2000 r-xp 00000000 08:01 157074 /usr/lib/locale/en_US.utf8/LC_NUMERIC
b7aa2000-b7aa3000 r-xp 00000000 08:01 157077 /usr/lib/locale/en_US.utf8/LC_TIME
b7aa3000-b7b84000 r-xp 00000000 08:01 157068 /usr/lib/locale/en_US.utf8/LC_COLLATE
b7b84000-b7b85000 r-xp 00000000 08:01 157072 /usr/lib/locale/en_US.utf8/LC_MONETARY
b7b85000-b7b86000 r-xp 00000000 08:01 157078 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
b7b86000-b7b87000 r-xp 00000000 08:01 157075 /usr/lib/locale/en_US.utf8/LC_PAPER
b7b87000-b7b88000 r-xp 00000000 08:01 157073 /usr/lib/locale/en_US.utf8/LC_NAME
b7b88000-b7b89000 r-xp 00000000 08:01 157067 /usr/lib/locale/en_US.utf8/LC_ADDRESS
b7b89000-b7b8a000 r-xp 00000000 08:01 157076 /usr/lib/locale/en_US.utf8/LC_TELEPHONE
b7b8a000-b7b8b000 r-xp 00000000 08:01 157071 /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
b7b8b000-b7b92000 r-xs 00000000 08:01 133678 /usr/lib/gconv/gconv-modules.cache
b7b92000-b7bf2000 r-xp 00000000 08:05 3702786 /home/spiderx/Games/NWN/LetoScript.so
b7bf2000-b7bf3000 r-xp 00060000 08:05 3702786 /home/spiderx/Games/NWN/LetoScript.so
b7bf3000-b7bf7000 r-xp b7bf3000 00:00 0
b7bf7000-b7c00000 rwxp 00060000 08:05 3702786 /home/spiderx/Games/NWN/LetoScript.so
b7c00000-b7c01000 rwxp b7c00000 00:00 0
b7c01000-b7ce9000 r-xp 00000000 08:01 132947 /usr/lib/libstdc++.so.6.0.9
b7ce9000-b7cec000 r-xp 000e8000 08:01 132947 /usr/lib/libstdc++.so.6.0.9
b7cec000-b7cee000 rwxp 000eb000 08:01 132947 /usr/lib/libstdc++.so.6.0.9
b7cee000-b7cf5000 rwxp b7cee000 00:00 0
b7cf5000-b7cf7000 r-xp 00000000 08:05 3702796 /home/spiderx/Games/NWN/nwnx_resetplugin.so
b7cf7000-b7cf8000 rwxp 00001000 08:05 3702796 /home/spiderx/Games/NWN/nwnx_resetplugin.so
b7cf8000-b7cfa000 rwxp b7cf8000 00:00 0
b7cfa000-b7cfb000 r-xp 00000000 08:01 157070 /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
b7cfb000-b7cfd000 rwxp b7cfb000 00:00 0
b7cfd000-b7cff000 r-xp 00000000 08:05 3702793 /home/spiderx/Games/NWN/nwnx_leto.so
b7cff000-b7d00000 rwxp 00001000 08:05 3702793 /home/spiderx/Games/NWN/nwnx_leto.so
b7d00000-b7d01000 rwxp b7d00000 00:00 0
b7d01000-b7d10000 ./nwnstartup.sh: line 20: 16564 Aborted ./nwserver -publicserver 1 -servername NWNX -dmpassword gosu -oneparty 0 -pvp 2 -difficulty 2 -elc 1 -reloadwhenempty 0 -module "Arena" -maxclients 32 -servervault 1 -maxlevel 40 -gametype 9 -autosaveinterval 0 "$@"
spiderx@spiderx:~/Games/NWN$


virusman
Can you take a look on this problem?
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Thu May 15, 2008 7:11    Post subject: Reply with quote

It appears to be not related to NWNX.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
SpiderX



Joined: 14 Aug 2007
Posts: 12

PostPosted: Thu May 15, 2008 7:25    Post subject: Reply with quote

virusman
Ok. Thank`s.

You`re right.
It was a local problem.
I should check it first before posting.
Problem was in my nwnx_hashset.so I compiled myself.
Taking nwnx_hashset.so from a SimTool package makes problem disappear.
Thank`s again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group