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

Avoid patching symbols in the extension module #685

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Sep 18, 2024

The fact that patching ourselves had not raised problems so far its
really an outstanding fact in this universe. Unfortunately seems that
with the latest toolchain + GCC there is something that causes memray to
point the d_original entry of the hooks pointing to itself, which should
never happen.

To fix this resiliently, avoid patching ourselves by getting our own
name in the extension module and then avoiding that shared object.

Closes: #662

Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

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

LGTM

@pablogsal pablogsal force-pushed the no-patch branch 2 times, most recently from 1e2532d to 8be48a3 Compare September 19, 2024 00:50
@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.79%. Comparing base (8635569) to head (ab83fcb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/memray/_memray/linker_shenanigans.h 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #685      +/-   ##
==========================================
+ Coverage   92.75%   92.79%   +0.03%     
==========================================
  Files          94       95       +1     
  Lines       11470    11475       +5     
  Branches     2114     2114              
==========================================
+ Hits        10639    10648       +9     
+ Misses        831      827       -4     
Flag Coverage Δ
cpp 92.79% <87.50%> (+0.03%) ⬆️
python_and_cython 92.79% <87.50%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pablogsal pablogsal force-pushed the no-patch branch 5 times, most recently from 26da4ed to bd08eba Compare September 19, 2024 13:44
The fact that patching ourselves had not raised problems so far its
really an outstanding fact in this universe. Unfortunately seems that
with the latest toolchain + GCC there is something that causes memray to
point the d_original entry of the hooks pointing to itself, which should
never happen.

To fix this resiliently, avoid patching ourselves by getting our own
name in the extension module and then avoiding that shared object.

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@pablogsal pablogsal merged commit 1983853 into bloomberg:main Sep 19, 2024
18 checks passed
@sethtroisi
Copy link

Thanks!

Out of curiosity did you also encounter this issue? if so do you have a guess which gcc versioned caused it?

@pablogsal
Copy link
Member Author

Thanks!

Out of curiosity did you also encounter this issue? if so do you have a guess which gcc versioned caused it?

I encountered this only when compiling memray with gcc 14 and python compiled with -no-pie. It may be a linker bug because that fields should never end in the PLT with a relocation.

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.

Potential deadlock when interposing symbols
4 participants