[3.9] gh-87759 bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474) - #113737
[3.9] gh-87759 bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474)#113737diegorusso wants to merge 2 commits into
Conversation
…n_range(). (pythonGH-14474) This is a backport of the radix tree implementation for pymalloc. It is not platform specific but it solves a segmentation fault on aarch64 platforms when MTE (Memory Tag Extension) is enabled. The github issue is pythongh-87759. Original commit message: The radix tree approach is a relatively simple and memory sanitary alternative to the old (slightly) unsanitary address_in_range(). To disable the radix tree map, set a preprocessor flag as follows: -DWITH_PYMALLOC_RADIX_TREE=0. (cherry picked from commit 85b6b70) Co-authored-by: Tim Peters <tim.peters@gmail.com> Change-Id: I0a3c2979c207f997c707c5f798941426c8d50004
@pablogsal agreed, I've already pinged Łukasz. Although this is a generic implementation it enables the use of a security feature of aarch64. Let's see what he thinks :) 🤞🏽 |
That's technically still considered a new feature as this is fundamentally changing how the allocator code operates. |
|
This is a pretty significant change to make, IMHO. Calling it a bugfix would be a stretch. If we are going to backport, we need to backport the bug fixes to the radix tree logic as well. I can make a PR if we decide we want to do it. For people on aarch64 platforms with MTE on, could they not just use a newer version of Python? |

This is a backport of the radix tree implementation for pymalloc. It is not platform specific but it solves a segmentation fault on aarch64 platforms when MTE (Memory Tag Extension) is enabled. The github issue is gh-87759.
Original commit message:
The radix tree approach is a relatively simple and memory sanitary alternative to the old (slightly) unsanitary address_in_range(). To disable the radix tree map, set a preprocessor flag as follows: -DWITH_PYMALLOC_RADIX_TREE=0.
(cherry picked from commit 85b6b70)