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

Refactor C/Fortran interfaces and enforce non-executable stack #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

williamjameshandley
Copy link
Member

• Added the linker flag "-Wl,-z,noexecstack" in Makefile_gnu to disable executable stacks for improved security.
• In src/polychord/interfaces.F90:
move all functions defined internally in contains functions to module-level definitions with module-level variables.

This fixes the bug found in #124 which has arisen for glibc 2.41 which does not allow executable stack calls

• Added the linker flag "-Wl,-z,noexecstack" in Makefile_gnu to disable executable stacks for improved security.
• In src/polychord/interfaces.F90:
move all functions defined internally in contains functions to
module-level definitions with module-level variables.

This fixes the bug found in #124 which has arisen for glibc 2.41 which
does not allow executable stack calls
Copy link

@lukashergt lukashergt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, an hours marathon vibing with o3-mini high eventually revealed the problem to be a combination of needing to add some linker flags, and a re-write of the interfaces so that it does not define functions within a function's contains section.

Cool, nice to see that I wasn't too far off with my link from #124, which addresses the issue with nested functions.

This PR indeed fixes my install issue, and python run_pypolychord.py now runs without issue.

However, since this so far only modifies interfaces.F90, but I stumbled upon that little X in both interfaces.o and maximiser.o (see the last paragraph in my first post in #124), I dug a bit further. There are indeed nested functions in maximiser.F90 as well, and when adding settings.maximise = True to run_pypolychord.py, then it will segfault the moment it starts trying to maximise the likelihood. So I guess the same needs to be done for maximiser.F90.

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