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

Fix segfaults inside g_free on windows #14

Merged
merged 2 commits into from
May 30, 2024
Merged

Conversation

tocklime
Copy link
Contributor

This should fix #13.

calling libc::free actually doesn't always work, because there are multiple heaps, and we're trying to free it from the wrong one.

Instead, we find the g_free export from libglib-2.0, and invoke that.

Added the libloading crate to help with this, and also rewrote the delaylink_hook to use the functions there, rather than directly calling the windows API.

calling `libc::free` actually doesn't always work, because there are
multiple heaps, and we're trying to free it from the wrong one.

Instead, we find the g_free export from libglib-2.0, and invoke that.

Added the `libloading` crate to help with this, and also rewrote the
`delaylink_hook` to use the functions there, rather than directly
calling the windows API.
@tocklime
Copy link
Contributor Author

I don't know how to fix the failing windows build.

@tocklime
Copy link
Contributor Author

Looks like windows is failing (it still is, just there's no asserts) because plugin api version has changed: qemu/qemu@926e146

@tocklime
Copy link
Contributor Author

Hmm. Hard to know how to fix - qemu now only supports plugin version 2 or higher. But if you wanted to compile a plugin for an older qemu, you'd want to specify version 1 in the plugin you're building. Feature gate it? or maybe keep multilple versions of the API around and let the user declare/use the correct one? maybe const generics?

@tocklime
Copy link
Contributor Author

tocklime commented May 28, 2024

It was qemu version 9.0.0 that first requires plugin api v2. prior to that (8.2.4) it is v1, and everything is fine. I'll open a separate issue (#15).

@novafacing
Copy link
Owner

If this is ready to go, let's merge this and then I'll worry about the 9.0.0/plugin v2 changes.

@novafacing novafacing merged commit 7b6088c into novafacing:main May 30, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

crashes during calls to g_free on windows.
2 participants