Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdl-gnash built on Arch Linux fails to hook #369

Closed
qixils opened this issue Aug 27, 2020 · 2 comments
Closed

sdl-gnash built on Arch Linux fails to hook #369

qixils opened this issue Aug 27, 2020 · 2 comments

Comments

@qixils
Copy link
Contributor

qixils commented Aug 27, 2020

Using a build of sdl-gnash from this custom PKGBUILD for gnash-git (fixes annoying/long dependencies + errors in the actual package)

libTAS attempts and fails to connect to socket. libTAS output/gdb backtrace -- warning: it's.. long

I noticed various clock_gettime calls and thought it might be a timing issue, but tweaking with timing settings along with all other (debug) options hasn't provided any different results

@qixils qixils changed the title sdl-gnash built on Arch Linux (AUR) fails to hook sdl-gnash built on Arch Linux fails to hook Aug 27, 2020
@clementgallet
Copy link
Owner

There's a recursive call here caused by jemalloc:
je_malloc()
-> libtas::clock_gettime() (for some arena profiling)
-> dlsym() (to fetch the real clock_gettime() function pointer)
-> calloc() (dlsym() allocates the dlerror() string buffer on first call)
-> je_malloc().

@clementgallet
Copy link
Owner

It took me some time to figure out where to break the recursive call. Working on calloc() was a deadend, so worked on dlsym(). When a recursive dlsym() call is detected, we don't call the original function, but the internal implementation-dependant _dl_sym(), which bypasses all side effects of the API function, avoiding further recursive calls. It's far from perfect, but it works. Also, if _dl_sym() trick breaks, we have bigger problems than this :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants