-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
gh-103295: fix stack overwrite on 32-bit in perf map test harness #104811
Conversation
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. |
Looks like the builds all succeeded 🎉 |
All architectures built, tests have passed. |
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. |
Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
GH-104823 is a backport of this pull request to the 3.12 branch. |
…ss (pythonGH-104811) (cherry picked from commit e0b3078) Co-authored-by: Carl Meyer <carl@oddbird.net>
…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 <carl@oddbird.net>
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
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
We can't use
K
format specifier inPyArg_ParseTuple
to write to avoid *
; it always writes 64 bits, so writes too much on 32-bit systems. UseO
instead and an explicit call toPyLong_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 usingerrno
. I verified this error handling by temporarily changing the perf map file path to a nonexistent directory, and the test raisedFileNotFoundError
as expected.Also simplify the return value to just use
PyLong_FromLong
; we don't need to go throughPy_BuildValue
for such a simple case.