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-148178: Validate remote debug offset tables on load by pablogsal · Pull Request #148187 · python/cpython Conversation
|
I decided to remove the tests because there were stupidly long, verbose (as I am basically parsing elf by hand in Python), only worked on Linux and has reduced value (just one way to trigger it not all of them) and the Pr is already quite big but I didn't update the commit message You can see them in the diff here https://github.com/python/cpython/compare/f12f6c4f0467837e25a445339f2e5a24388a317d..b8dcd8fa2b3be846b1dad6d2afb1dccd968789b3 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I don't think so. But if you have a specific suggestion code suggestion happy to consider it ;) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Treat the debug offset tables read from a target process as untrusted input and validate them before the unwinder uses any reported sizes or offsets. Add a shared validator in debug_offsets_validation.h and run it once when _Py_DebugOffsets is loaded and once when AsyncioDebug is loaded. The checks cover section sizes used for fixed local buffers and every offset that is later dereferenced against a local buffer or local object view. This keeps the bounds checks out of the sampling hot path while rejecting malformed tables up front.
e5e1f21 to
f6f2faf
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I think the easiest would be: -#define GET_MEMBER(type, obj, offset) (*(type*)((char*)(obj) + (offset))) +#define GET_MEMBER(type, obj, offset) (*(const type *)memcpy(&(type){0}, (const char *)(obj) + (offset), sizeof(type))) I did not test it, but looks the least disruptive. I was only able to confirm the issue w/ UBSan You already do use I'd love to submit a PR but I think it should be based on yours, not the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Gregory P. Smith <[email protected]>
|
@maurycy you can create a pr targetting this branch in my fork if you want |
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 @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @pablogsal, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-148577 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.
…148187) Treat the debug offset tables read from a target process as untrusted input and validate them before the unwinder uses any reported sizes or offsets. Add a shared validator in debug_offsets_validation.h and run it once when _Py_DebugOffsets is loaded and once when AsyncioDebug is loaded. The checks cover section sizes used for fixed local buffers and every offset that is later dereferenced against a local buffer or local object view. This keeps the bounds checks out of the sampling hot path while rejecting malformed tables up front.
) (#148577) Treat the debug offset tables read from a target process as untrusted input and validate them before the unwinder uses any reported sizes or offsets. Add a shared validator in debug_offsets_validation.h and run it once when _Py_DebugOffsets is loaded and once when AsyncioDebug is loaded. The checks cover section sizes used for fixed local buffers and every offset that is later dereferenced against a local buffer or local object view. This keeps the bounds checks out of the sampling hot path while rejecting malformed tables up front. (cherry picked from commit 289fd2c)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.