Skip to content
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

[3.9] gh-87759 bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474) #113737

Closed
wants to merge 2 commits into from

Conversation

diegorusso
Copy link
Contributor

@diegorusso diegorusso commented Jan 5, 2024

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)

…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
@bedevere-app bedevere-app bot added the type-feature A feature request or enhancement label Jan 5, 2024
@diegorusso diegorusso changed the title [3.9] gh-87759 bpo-37448: Use radix tree for pymalloc address_in_rane(). (GH-14474) [3.9] gh-87759 bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474) Jan 5, 2024
@pablogsal
Copy link
Member

3.9 is only accepting security fixes, so this is up to @ambv to decide

@diegorusso
Copy link
Contributor Author

diegorusso commented Jan 5, 2024

3.9 is only accepting security fixes, so this is up to @ambv to decide

@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 :) 🤞🏽

@pablogsal
Copy link
Member

it enables the use of a security feature of aarch64

That's technically still considered a new feature as this is fundamentally changing how the allocator code operates.

@nascheme
Copy link
Member

nascheme commented Jan 8, 2024

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?

@diegorusso
Copy link
Contributor Author

@pablogsal and @nascheme thanks for your feedback and I agree with both of you. I've just added a comment in the main issue (#87759) saying that the best thing is to do nothing :)

@pablogsal pablogsal closed this Jan 9, 2024
@diegorusso diegorusso deleted the 3.9 branch January 9, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants