GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — gh-128883: Store ELF perf trampoline templates in read-only data by zanieb · Pull Request #160366 · python/cpython Conversation
|
|
Frankly this is a little beyond my understanding and I'm going to try to gather some clearer evidence of how this manifests downstream. cc @pablogsal I assume you are the best reviewer for this though |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is the right fix. The byte gives the end marker a separate address from the next function, but it only addresses that specific layout. BOLT can still move the start marker independently or instrument the trampoline itself. In the latter case, it can introduce PC-relative references that become invalid when CPython copies the code to a different address.
CPython uses these bytes as a template for copies in executable memory. The ELF template therefore belongs in .rodata instead of .text. BOLT then treats it as data instead of a native function, which protects both the bytes and the range that CPython copies.
I suggest we change the template section and remove the BOLT-specific test skips as part of the fix. That avoids the extra byte and a trampoline-specific exclusion from BOLT.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Appreciate the feedback! Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
CPython copies the trampoline templates into executable memory. Keep the ELF source in .rodata so BOLT preserves its bytes and boundaries.
|
I pushed a fix :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Tested locally with: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @zanieb for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @zanieb and @pablogsal, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @zanieb and @pablogsal, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-160490 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-160492 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ta (GH-160366) (#160492) CPython copies the trampoline templates into executable memory. Keep the ELF source in .rodata so BOLT preserves its bytes and boundaries. (cherry picked from commit 1ff83ad) Co-authored-by: Zanie Blue <[email protected]>
…ta (GH-160366) (#160490) CPython copies the trampoline templates into executable memory. Keep the ELF source in .rodata so BOLT preserves its bytes and boundaries. (cherry picked from commit 1ff83ad) Co-authored-by: Zanie Blue <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
perf trampoline tests fail after BOLT optimizations
There was an error while loading. Please reload this page.