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 segfault when using funpointer #511

Merged
merged 1 commit into from
May 4, 2017
Merged

Fix segfault when using funpointer #511

merged 1 commit into from
May 4, 2017

Conversation

tiash
Copy link
Contributor

@tiash tiash commented May 4, 2017

This fixes the support for passing function pointers on platforms that use the no-exec bit in memory.

I believe this may be the underlying cause of issue ctypes #500, as we experienced the same issue when working on improvements for async_ssl.

The code was previously ignoring the function pointer provided by libffi and trying to executing the closure object directly (correct behavior for non no-exec platforms).

Modern CPUs restrict executing modifiable memory. Lib_ffi deals with this by mapping to copies of the closure object into memory. This change ensures that we use the executable copy for the function pointer.
@yallop
Copy link
Owner

yallop commented May 4, 2017

Many thanks for tracking down and fixing this problem, @tiash.

The fix looks right to me, and I've confirmed that it addresses the issue on an SELinux system.

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.

2 participants