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

TLS无法正确处理 #8

Open
pig4210 opened this issue Jun 22, 2021 · 2 comments
Open

TLS无法正确处理 #8

pig4210 opened this issue Jun 22, 2021 · 2 comments

Comments

@pig4210
Copy link

pig4210 commented Jun 22, 2021

VS2015 及以上版本编译的 DLL ,使用你的工具注入,可能会发生崩溃。
虽然你处理了 TLS ,但仍然是无用的。
经调试发现,正常 LoadLibrary 注入的 DLL ,TlsIndex 值不为 0 。 而工具注入的 TlsIndex 值为 0 ,这其实是错误的。这导致所有的 static 变量无法被初始化。
注意: TlsIndex 只有在主模块中才可以为 0 ,其他所有 DLL 有各自不同的,非零值的 TlsIndex 。
这个问题目前看来,只能在 DLL 编译时,加入 /Zc:threadSafeInit- 解决。但这样,static 变量将非线程安全。

@AlexanderQueen
Copy link

AlexanderQueen commented Jun 22, 2021

Maybe english? P.S Translated.

@mdilai "The DLL compiled by VS2015 and above may crash if injected with your tool.
Although you have dealt with TLS, it is still useless.
After debugging, it is found that the TlsIndex value of the DLL injected by the normal LoadLibrary is not 0. The TlsIndex value injected by the tool is 0, which is actually wrong. This causes all static variables to fail to be initialized.
Note: TlsIndex can be 0 only in the main module. All other DLLs have their own different, non-zero TlsIndex.
At present, this problem can only be solved by adding /Zc:threadSafeInit- when compiling the DLL. But in this way, static variables will not be thread-safe."

@mdilai
Copy link
Owner

mdilai commented Jul 7, 2021

@pig4210
Хаха ну ти і повеселив мене, братан. Готуєтесь що скоро весь світ буде балакати вашими закарлюками лол? 🤣

Okay, i heard a lot of complaining about TLS issues from some random people but never catch this by myself. Probably i did a bare minimum TLS handling to get my reference DLL to work but it not complete and insufficient for your one. To be able to try fix this, you need to provide me a some example DLL that crash using Shtreeba, so i can test it.

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

3 participants