PDA

View Full Version : Cod2 server crashing



v1rto
18th August 2020, 15:07
Hello everyone, I have a problem with my server its randomly crashing how do I find out what is the cause?
Its version 1.3 without libcod.

This is from syslog:
ubuntu kernel: [587574.708776] cod2_lnxded[6798]: segfault at 84 ip 00000000080ebf71 sp 00000000ffc72160 error 4 in cod2_lnxded[8048000+135000]
ubuntu kernel: [588315.019652] cod2_lnxded[6876]: segfault at 84 ip 00000000080ebf71 sp 00000000ffea0ee0 error 4 in cod2_lnxded[8048000+135000]

Also something off-topic, is it possible to disable masterserver listing? Hexing the cod2_lnxded or something?
The spamming heatbeat thing
Sending heartbeat to cod2master.activision.com

Mitch
18th August 2020, 18:46
The segfault message points to this function:


BOOL __cdecl BG_IsWeaponValid(int a1, int a2)
{
bool v2; // bl
bool v3; // cl
int v4; // eax
BOOL result; // eax

v2 = a2 >= 0 && a2 <= bg_iNumWeapons;
v3 = 0;
if ( (*(_DWORD *)(a1 + 4 * (a2 >> 5) + 1348) >> (a2 & 0x1F)) & 1 )
v3 = v2;
v4 = bg_weaponDefs[a2];
if ( *(_DWORD *)(v4 + 132) || a2 == *(char *)(a1 + 1365) || a2 == *(char *)(a1 + 1366) || a2 == *(_DWORD *)(v4 + 876) )
result = v3;
else
result = 0;
return result;
}


The address 80ebf71 points to:

if ( *(_DWORD *)(v4 + 132) || a2 == *(char *)(a1 + 1365) || a2 == *(char *)(a1 + 1366) || a2 == *(_DWORD *)(v4 + 876) )

Are you running any mods? On what kind of specifications does your server run?

v1rto
18th August 2020, 19:06
Its running only zPAM 3.0 the successor of zPAM 2.07
1638

Its a Xeon E3 vps with 2gb ram running ubuntu 12.04 x64

kung foo man
19th August 2020, 09:38
Fixed in:

Voron's libcod: https://github.com/voron00/libcod/commit/88ee15a056b71540387e3a0b7c0a0ec3a4958125
Mitch's libcod: https://github.com/M-itch/libcod/blob/master/libcod.cpp#L570

Original thread which discusses this segfault: https://killtube.org/showthread.php?2619-Pro-tips-for-hooking-up-the-function/page3

v1rto
19th August 2020, 12:48
So libcod is the only solution? I wonder why is this happening just now, Ive been running the same binary for years without any problem, is the pam mode causing it?

Also is there a libcod build with just patches/fixes, no new features as I dont need any?

kung foo man
19th August 2020, 13:20
If you don't use any new methods/functions/callbacks provided by libcod, it is basically just patches/fixes/protections

About pam mode, maybe some random users force the server/mod using non-available weapons, like the openScriptMenu hack to pick weapons from the enemy side? That could explain the randomness in crashing

v1rto
19th August 2020, 19:55
I made a stripped down version of libcod only for CoD2 1.3 with only patches/fixes/protections/removed server listing on master
Seems to work okay, not sure if I can remove more unused functions/declarations to have less size be more compact..

https://github.com/hoesman/libcod2_1.3

somewhat windy
20th August 2020, 17:52
Its a Xeon E3 vps with 2gb ram running ubuntu 12.04 x64

"Ubuntu 12.04 LTS reached its regular End of Life on April 28, 2017. No more package updates, including security updates, will be accepted to the 12.04 primary archive."

v1rto
20th August 2020, 19:58
"Ubuntu 12.04 LTS reached its regular End of Life on April 28, 2017. No more package updates, including security updates, will be accepted to the 12.04 primary archive."

It doesnt imply its less secure than newer versions, and that doesnt cause the cod2 segfault