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

FlsFree not called, leading to crash #321

Open
levinli303 opened this issue Dec 9, 2024 · 3 comments
Open

FlsFree not called, leading to crash #321

levinli303 opened this issue Dec 9, 2024 · 3 comments

Comments

@levinli303
Copy link

levinli303 commented Dec 9, 2024

FlsAlloc is called here, but we are not calling FlsFree when DLL is unloaded. This leads to crash that is mentioned here.

return FlsAlloc(cleanupFunction);

I'm seeing this crash when objc.dll is used in a shell extension.

Screenshot 2024-12-08 at 8 48 54 PM

Screenshot 2024-12-08 at 8 50 31 PM
@davidchisnall
Copy link
Member

Unloading dynamic libraries containing Objective-C is unsupported and will crash for a great many reasons, but this looks as if you're unloading objc.dll? That's definitely not supported and would require some significant changes to the library.

@levinli303
Copy link
Author

Unloading dynamic libraries containing Objective-C is unsupported and will crash for a great many reasons, but this looks as if you're unloading objc.dll? That's definitely not supported and would require some significant changes to the library.

I don't have code to unload objc.dll. This might have come from explorer unloading my dll (it is a shell extension), and thus unloading the dlls that is no longer used. If that is the case, I could probably uninitialize the objc runtime when my dll is unloaded, but there does not seem to be a way to do that.

@davidchisnall
Copy link
Member

No, because there is no good way of doing it. Pointers to internal library state flow everywhere and if we miss one then we introduce a security vulnerability. The risk in almost correctly supporting library unloading is far higher than the benefit from supporting it.

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

No branches or pull requests

2 participants