Raised This Month: $51 Target: $400
 12% 

[RESOLVED] dlsym problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Keeper
Senior Member
Join Date: Nov 2006
Old 04-29-2010 , 11:10   [RESOLVED] dlsym problem
Reply With Quote #1

After the update last night, dlsym is not returning any addresses from the binaries.

using the vtablecheck (rebuilt with new binary info) and tfscan.sh ( as well as Mani's vtable functions ) I can't get any addresses.

Here's the output
Code:
sdktools.games.ep2.txt
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
Invalid vtable symbol "_ZTV9CTFPlayer"
sm-tf2.games.txt
Invalid vtable symbol "_ZTV9CTFPlayer"
_ZTV9CTFPlayer is in binary, but for some reason dlsym isn't finding it.
Code:
nm server.so | grep _ZTV9CTFPlayer
00bdb380 d _ZTV9CTFPlayer
This is above my head, so I was hoping somebody here could give me a push in the right direction. That "d" in front of the symbol from the output of nm scares me.

EDIT: It seems that the new optimizations hid internal functions. So I guess it's time to do my own scanning

Last edited by Keeper; 04-29-2010 at 14:25. Reason: Figured it out...
Keeper is offline
BAILOPAN
Join Date: Jan 2004
Old 04-29-2010 , 18:45   Re: [RESOLVED] dlsym problem
Reply With Quote #2

core/MemoryUtils.cpp in the SM tree has a function for grabbing hidden symbols. props to DS.
__________________
egg
BAILOPAN is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 04-29-2010 , 20:15   Re: [RESOLVED] dlsym problem
Reply With Quote #3

Yeah, I saw that and adapted it for our use ( as a temporary try to fix our issues ). I removed the caching part ... but now that I realized that dladdr doesn't work either, I'm going to have to go back and cache so we can have the address to symbol lookup

Thanks for the info tho. Helps to know I definitely went in the right direction.

So does all this "optimization" really help? Will performance really be enhanced? I'm trying to figure out if all this really served a purpose.

Thanks again!
Keeper is offline
BAILOPAN
Join Date: Jan 2004
Old 04-30-2010 , 03:52   Re: [RESOLVED] dlsym problem
Reply With Quote #4

Quote:
all this "optimization" ... I'm trying to figure out if all this really served a purpose.
If you meant Valve's GCC optimizations, not sure. Someone who's looked at them should comment.

If you meant our caching optimizations, which you mentioned removing and then adding back in -

It's a trivial 200-line hash table implementation, 30% of which is a copy-pasted hash function.

My benchmarks showed that a single string comparison cost about 40 nanoseconds, so a worst case hit would cost 2ms. That's pretty bad. Hash table would essentially be free. Adding an entry into the hash table costs 1,100 nanoseconds, so up-front conversion of the whole thing costs about 60ms. That's really cheap, but just to be safe we incrementally fill the table as we search.

You can do even better by getting rid of the malloc() call - easily doable by pre-allocating the hash table memory parallel to the ELF section size. I tried this just now and it's about a 5X win, bringing the cost for a complete table fill down to 14ms.

I don't know what your workloads are like, but the cache is not necessary for the dlhsym() kernel to work. SM always assumes worst-case since it's extensible. My guess is all of this happens on server startup so as long as it says under half a second or so, it won't matter (but it's not the last cookie that makes you fat).
__________________
egg

Last edited by BAILOPAN; 04-30-2010 at 04:03.
BAILOPAN is offline
BAILOPAN
Join Date: Jan 2004
Old 04-30-2010 , 03:59   Re: [RESOLVED] dlsym problem
Reply With Quote #5

On the Valve end, the only thing I heard is that they re-added fPIC or something which is a perf loss. Hiding the symbols is about lowering the binary size.
__________________
egg
BAILOPAN is offline
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 04-30-2010 , 05:33   Re: [RESOLVED] dlsym problem
Reply With Quote #6

I think we only really used the dladdr() function for working out vfunc offsets and that is really only a tool for displaying them in the console rather than dynamically working them out on the fly.

It was a reasonable way for a user to be able to set the offsets up without needing access to the shell.

It would be quite nice to just have a database somewhere that holds all the symbols/addresses which is updated per Valve release.

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 04-30-2010 , 08:55   Re: [RESOLVED] dlsym problem
Reply With Quote #7

Ya, I should have been more specific. I was talking about VALVe's optimizations. Seems like a silly thing to do to remove 4 megs from the binary. There is so much code that could be cleaned up that would probably do the same thing. But I guess a switch on gcc is much easier
Keeper 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 06:16.


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