Raised This Month: $32 Target: $400
 8% 

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
bottiger
AlliedModders Donor
Join Date: Dec 2010
Old 05-10-2021 , 22:23   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #831

Possible memory corruption caused by this extension.

Quote:
File: dhooks.ext.so
Loaded: Yes (version 2.2.0-detours16)
Name: DHooks (Dynamic Hooks)
Author: Dr!fter and Peace-Maker (http://www.sourcemod.net/)
Binary info: API version 8 (compiled Jan 28 2021)


==284257== Thread 1:
==284257== Mismatched free() / delete / delete []
==284257== at 0x403B104: operator delete(void*) (vg_replace_malloc.c:802)
==284257== by 0x282A6C5F: operator() (unique_ptr.h:85)
==284257== by 0x282A6C5F: ~unique_ptr (unique_ptr.h61)
==284257== by 0x282A6C5F: HandleDetour(HookType_t, CHook*) (dynhooks_sourcepawn.cpp:440)
==284257== by 0x282A9890: CHook::HookHandler(HookType_t) (DynamicHooks/hook.cpp:184)
==284257== by 0x2074FEB4: ???
==284257== by 0xC326A1B: SpawnAllEntities(int, HierarchicalSpawn_t*, bool) (in /tf/bin/server_srv.so)
==284257== by 0xC327B16: MapEntity_ParseAllEntities(char const*, IMapEntityFilter*, bool) (in /tf/bin/server_srv.so)
==284257== by 0xC303092: CServerGameDLL::LevelInit(char const*, char const*, char const*, char const*, bool, bool) (in /tf/bin/server_srv.so)
==284257== by 0x13BD6F8A: __SourceHook_MFHCls_SGD_LevelInit::Func(char const*, char const*, char const*, char const*, bool, bool) (in /tf/addons/metamod/bin/metamod.2.tf2.so)
==284257== by 0x797A6171: ???
__________________

Last edited by bottiger; 05-15-2021 at 15:48.
bottiger is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-12-2021 , 04:52   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #832

After updating to the latest version of dhooks I have regular random crashes. According to accelerator stacks the crashes are related to dhooks:

PHP Code:
Thread 0 (crashed)
 
0  dhooks.ext.so 0x70e9
    eip 
0xeaec80e9   esp 0xffd091c0   ebp 0xffd09238   ebx 0x0c12adf0
    esi 
0x0c0d3aa0   edi 0x0000000e   eax 0x00000021   ecx 0xef889b94
    edx 
0xec357550   efl 0x00010206
    Found by
given as instruction pointer in context

    Stack contents
:
     
ffd091c0 00 f4 15 0c c0 f2 ed ea a0 3a 0d 0c 6b 8e 31 ec  .........:..k.1.
     
ffd091d0 b0 c0 f3 0b e0 8b ff 0b 50 75 35 ec a7 7a ec ea  ........Pu5..z..
     
ffd091e0 e0 8b ff 0b a0 3a 0d 0c f8 91 d0 ff 77 82 69 ea  .....:......w.i.
     
ffd091f0 20 85 ff 0b b0 c0 f3 0b 3c 75 35 ec 1e b8 31 ec   .......<u5...1.
     ffd09200 18 f2 ed ea b0 c0 f3 0b 00 00 00 00 64 75 35 ec  
............du5.
     
ffd09210 60 75 35 ec 54 75 35 ec 50 75 35 ec 00 00 00 00  `u5.Tu5.Pu5.....
     ffd09220 40 a1 f5 0b 00 c0 f3 0b 1f 00 00 00 b0 c0 f3 0b  @...............
     ffd09230 3c 75 35 ec 88 75 35 ec 78 92 d0 ff 8b c6 31 ec  <u5..u5.x.....1.
    Possible instruction pointers: 
Also it happens if I manually unload some plugins.

Last edited by kadet.89; 05-12-2021 at 05:39.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 06-24-2021 , 11:26   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #833

I’ve had this issue for awhile now across different versions, but I wasn’t sure how to report it or if it was just bad on my part. Anyway here goes:

When 2 plugins detour the same function and they are each retrieving the detour setup from gamedata files, both files must share the same section names for the function’s params. If they differ, then the server crashes upon the function being executed. I’m not sure why DHooks cares about the param names considering they aren’t being used anyway. I’ve only ever encountered this twice and had to resort to just making sure both files had the same param names.
File 1:
PHP Code:
"CTerrorPlayer::StartReviving"
{
    
"signature"    "CTerrorPlayer::StartReviving"
    "callconv"    "thiscall"
    "return"    "void"
    "this"        "entity"
    "arguments"
    
{
        
"revivee"
        
{
            
"type"    "cbaseentity"
        
}
    }

File 2:
PHP Code:
"CTerrorPlayer::StartReviving"
{
    
"signature"    "CTerrorPlayer::StartReviving"
    "callconv"    "thiscall"
    "return"    "void"
    "this"        "entity"
    "arguments"
    
{
        
"target"
        
{
            
"type"    "cbaseentity"
        
}
    }

I’ve only tested this on L4D1&2 Windows. This issue consistently crashes the server and once the param names are finally identical, the crashing stops.



Speaking of multiple plugins detouring the same function, would it be possible for DHooks to notify or warn users of the other plugins detouring the same function? It could potentially help in narrowing down culprits in scenarios where two or more plugins conflict with each other because of what each one does within their detour. At least then users can make an informed decision of which plugin to get rid of or figure out how to get both plugins to play nice with each other, etc. This isn’t crucial to the development of DHooks but it would be nice to have.
__________________
Psyk0tik is offline
unusual917
New Member
Join Date: Jun 2021
Old 06-24-2021 , 19:49   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #834

Is anyone having issues loading this extension after the recent TF2 update?
unusual917 is offline
DeathMaster
AlliedModders Donor
Join Date: Mar 2009
Old 06-24-2021 , 22:16   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #835

Quote:
Originally Posted by unusual917 View Post
Is anyone having issues loading this extension after the recent TF2 update?
No issues loading it, but it is causing my server to crash right after a player joins a team.
DeathMaster is offline
unusual917
New Member
Join Date: Jun 2021
Old 06-25-2021 , 23:37   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #836

Quote:
Originally Posted by DeathMaster View Post
No issues loading it, but it is causing my server to crash right after a player joins a team.
Are you running a linux server? I've updated sourcemod and metamod and can't seem to get this loading with slender fortress.
unusual917 is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 06-26-2021 , 02:39   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #837

Quote:
Originally Posted by DeathMaster View Post
No issues loading it, but it is causing my server to crash right after a player joins a team.
Something like that?
After last tf2 update my server keeps crashing when player gets a weapon after spawn.
__________________
MAGNAT2645 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-26-2021 , 04:51   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #838

Dhooks itself doesn't do anything game specific that could break after an update. The plugins probably need updated gamedata.
__________________
Peace-Maker is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 06-26-2021 , 09:11   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #839

Quote:
Originally Posted by Peace-Maker View Post
Dhooks itself doesn't do anything game specific that could break after an update. The plugins probably need updated gamedata.
Yeah, i didn't say that DHooks caused these crashes. Tried to update gamedata manually but idk which is outdated (used VTable Dumper to check but it seems that every gamedata config has up to date offsets, not sure about signatures though. Do Linux signatures change often like Windows' do?).

EDIT: VTable prints 264 and 265 offsets
Code:
L	W	Function
265	264	CBasePlayer::Weapon_Equip(CBaseCombatWeapon*)
but SM gamedata has this
Code:
			"WeaponEquip"
			{
				"windows"	"265"
				"linux"		"266"
				"mac"		"266"
			}
EDIT 2: OK, it seems that Hit Registration Fix Plugin had outdated offsets. Increased them by 1.
__________________

Last edited by MAGNAT2645; 06-26-2021 at 12:27.
MAGNAT2645 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-28-2021 , 11:28   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #840

Quote:
Originally Posted by Crasher_3637 View Post
When 2 plugins detour the same function and they are each retrieving the detour setup from gamedata files, both files must share the same section names for the function’s params. If they differ, then the server crashes upon the function being executed.
The probem here is that both Functions sections are named the same, the arguments aren't important. All "Functions" sections in all loaded gamedata files are cached together due to a limitation in SourceMod's gamedata parser extension api. So the first plugin creates an entry in that cache with the name "CTerrorPlayer::StartReviving" and the given argument setup. When the second plugin loads its gamedata file, the "CTerrorPlayer::StartReviving" function is already present in the cache, so dhooks thinks you want to update the entry. It adds the "new" argument to the setup, since it's named differently, making the function look like it takes two arguments.

This behavior is described in the release post in the "Game specific settings" section. It allows you to change details of a hook per game, if the rest is mostly the same. The idea was to avoid duplicate function hook info in the gamedata file, which appears to have been a stupid one. Sorry, but I think it's too late now to change the behavior - I'm not even sure what the right thing would be

Quote:
Originally Posted by Crasher_3637 View Post
Speaking of multiple plugins detouring the same function, would it be possible for DHooks to notify or warn users of the other plugins detouring the same function? It could potentially help in narrowing down culprits in scenarios where two or more plugins conflict with each other because of what each one does within their detour. At least then users can make an informed decision of which plugin to get rid of or figure out how to get both plugins to play nice with each other, etc. This isn’t crucial to the development of DHooks but it would be nice to have.
I could add a server command which dumps all active detours and the plugins which are listening for them. It might be useless for detours and hooks created using the API instead of the "Functions" section though, since there is no name associated with the hook. But maybe we could print other relevant info which helps to identify which function is being hooked.
__________________
Peace-Maker is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode