[Python-checkins] bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051) (GH-29122)

nascheme webhook-mailer at python.org
Thu Oct 21 11:40:47 EDT 2021


https://github.com/python/cpython/commit/1cdac61065e72db60d26e03ef9286d2743d7000e
commit: 1cdac61065e72db60d26e03ef9286d2743d7000e
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: nascheme <nas-github at arctrix.com>
date: 2021-10-21T08:39:58-07:00
summary:

bpo-45521: Fix a bug in the obmalloc radix tree code. (GH-29051) (GH-29122)

MAP_BOT_LENGTH was incorrectly used to compute MAP_TOP_MASK instead of
MAP_TOP_LENGTH. On 64-bit machines, the error causes the tree to hold
46-bits of virtual addresses, rather than the intended 48-bits.
(cherry picked from commit 311910b31a4bd94dc79298388b7cb65ca5546438)

files:
A Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst
M Objects/obmalloc.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst b/Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst
new file mode 100644
index 0000000000000..3a082a4ffdbcb
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2021-10-18-22-40-33.bpo-45521.GdMiuW.rst	
@@ -0,0 +1,3 @@
+Fix a bug in the obmalloc radix tree code.  On 64-bit machines, the bug
+causes the tree to hold 46-bits of virtual addresses, rather than the
+intended 48-bits.
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 15c442b858d5f..615703a963ede 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -1328,7 +1328,7 @@ _Py_GetAllocatedBlocks(void)
 
 #define MAP_TOP_BITS INTERIOR_BITS
 #define MAP_TOP_LENGTH (1 << MAP_TOP_BITS)
-#define MAP_TOP_MASK (MAP_BOT_LENGTH - 1)
+#define MAP_TOP_MASK (MAP_TOP_LENGTH - 1)
 
 #define MAP_MID_BITS INTERIOR_BITS
 #define MAP_MID_LENGTH (1 << MAP_MID_BITS)



More information about the Python-checkins mailing list