gh-103295: fix stack overwrite on 32-bit in perf map test harness - #104811
Conversation
commented
May 23, 2023
|
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. |
commented
May 23, 2023
|
Looks like the builds all succeeded 🎉 |
commented
May 23, 2023
All architectures built, tests have passed. |
commented
May 23, 2023
|
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. |
commented
May 23, 2023
|
Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
commented
May 23, 2023
|
GH-104823 is a backport of this pull request to the 3.12 branch. |
We can't use
Kformat specifier inPyArg_ParseTupleto write to avoid *; it always writes 64 bits, so writes too much on 32-bit systems. UseOinstead and an explicit call toPyLong_AsVoidPtrto get the pointer value.Also fix the error check so it detects either error code (
-1or-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 raisedFileNotFoundErroras expected.Also simplify the return value to just use
PyLong_FromLong; we don't need to go throughPy_BuildValuefor such a simple case.