GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-103295: fix stack overwrite on 32-bit in perf map test harness by carljm · Pull Request #104811 · python/cpython

Conversation

@carljm

@carljm carljm commented May 23, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

We can't use K format specifier in PyArg_ParseTuple to write to a void *; it always writes 64 bits, so writes too much on 32-bit systems. Use O instead and an explicit call to PyLong_AsVoidPtr to get the pointer value.

Also fix the error check so it detects either error code (-1 or -2) and raises a more informative error using errno. I verified this error handling by temporarily changing the perf map file path to a nonexistent directory, and the test raised FileNotFoundError as expected.

Also simplify the return value to just use PyLong_FromLong; we don't need to go through Py_BuildValue for such a simple case.

  • Issue: expose API for writing perf map files #103295

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@carljm
pythongh-103295: fix stack overwrite on 32-bit in perf map test harness
19e31e2
@bedevere-bot bedevere-bot mentioned this pull request May 23, 2023
expose API for writing perf map files #103295
Closed
@carljm carljm added the skip news label May 23, 2023
@carljm
carljm marked this pull request as ready for review May 23, 2023 19:40
@bedevere-bot bedevere-bot added the awaiting core review label May 23, 2023
@carljm
carljm requested a review from pablogsal May 23, 2023 19:41
@hroncok

hroncok commented May 23, 2023

Copy link
Copy Markdown
Contributor

A Fedora build with this patch applied on top of 3.12.0b1 tarball.

https://koji.fedoraproject.org/koji/taskinfo?taskID=101500963

It is hopefully set up not to terminate the build immediately when one architecture fails. Let's see.

carljm reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@carljm carljm added the needs backport to 3.12 only security fixes label May 23, 2023
@carljm

carljm commented May 23, 2023

Copy link
Copy Markdown
Member Author

Looks like the builds all succeeded 🎉

gsallam reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hroncok

hroncok commented May 23, 2023

Copy link
Copy Markdown
Contributor

A Fedora build with this patch applied on top of 3.12.0b1 tarball.

https://koji.fedoraproject.org/koji/taskinfo?taskID=101500963

All architectures built, tests have passed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@carljm

carljm commented May 23, 2023

Copy link
Copy Markdown
Member Author

I'm going to go ahead and merge this to help unblock the Fedora builds, since this PR only touches test harness and the test signal is all good (including the Fedora build signal on multiple platforms, including 32-bit.)

If there are any concerns with anything here, I'll be happy to do a follow-up PR to address comments.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@carljm
carljm merged commit e0b3078 into python:main May 23, 2023
@miss-islington

miss-islington commented May 23, 2023

Copy link
Copy Markdown
Contributor

Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting core review label May 23, 2023
@carljm
carljm deleted the fixperfmaptest branch May 23, 2023 22:04
@bedevere-bot

bedevere-bot commented May 23, 2023

Copy link
Copy Markdown

GH-104823 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label May 23, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 23, 2023
@carljm @miss-islington
pythongh-103295: fix stack overwrite on 32-bit in perf map test harne…
309d497
…ss (pythonGH-104811)

(cherry picked from commit e0b3078)

Co-authored-by: Carl Meyer <[email protected]>
carljm added a commit that referenced this pull request May 23, 2023
@miss-islington @carljm
[3.12] gh-103295: fix stack overwrite on 32-bit in perf map test harn…
22c45c4
…ess (GH-104811) (#104823)

gh-103295: fix stack overwrite on 32-bit in perf map test harness (GH-104811)
(cherry picked from commit e0b3078)

Co-authored-by: Carl Meyer <[email protected]>
hrnciar added a commit to fedora-python/cpython that referenced this pull request May 24, 2023
@hrnciar @carljm
00398: fix stack overwrite on 32-bit in perf map test harness (python…
7353ed8
…GH-104811) (python#104823)

pythongh-103295: fix stack overwrite on 32-bit in perf map test harness (pythonGH-104811)
(cherry picked from commit e0b3078)

Co-authored-by: Carl Meyer <[email protected]>
hrnciar pushed a commit to fedora-python/cpython that referenced this pull request May 24, 2023
@carljm @hrnciar
00398: fix stack overwrite on 32-bit in perf map test harness (python…
45c1382
…#104811)
facebook-github-bot pushed a commit to facebookincubator/MetaPython that referenced this pull request May 24, 2023
Gamal Sallam @facebook-github-bot
User error codes and fix 32-bit system issues
0a7cc0b
Summary:
Port the latest changes from the [perf-map C-API PR](python/cpython#103546). This includes using error codes instead of exceptions to avoid the need to hold the GIL.

Additionally, there was an issue with Fedora on a 32-bit system that was fixed in this [PR](python/cpython#104811), so I also ported the fix.

Reviewed By: carljm

Differential Revision: D46041553

fbshipit-source-id: 6502189f489ca6cf11949ecd93c044e5ebe4fd2c
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Jun 3, 2023
mcepl @bmwiedemann
Update python312 to version 3.12.0b1 / rev 2 via SR 1090558
25573f1
https://build.opensuse.org/request/show/1090558
by user mcepl + dimstar_suse
- Add 00398-fix-stack-overwrite-on-32-bit-in-perf-map-test-harness-gh-104811-104823.patch
  gh#python/cpython#104811
- Refresh all patches
- Update to 3.12.0b1:
  Full changelog can be found here
  https://docs.python.org/dev/whatsnew/changelog.html#python-3-12-0-beta-1
@erlend-aasland erlend-aasland mentioned this pull request Jun 6, 2023
3.12 backport gh 105236 #105358
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal Awaiting requested review from pablogsal

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@carljm @hroncok @miss-islington @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.