equal
deleted
inserted
replaced
|
1 This patch was developed in house for Bug 21658934. Python PyObject_Free() |
|
2 implementation relies on being able to read memory that might not belong to |
|
3 the current buffer. When ADIHEAP is enabled, this is detected as a violation. |
|
4 Use an explicit nonfaulting load to ignore the ADI tag. |
|
5 |
|
6 This patch only works with Studio; one which supports gcc and |
|
7 Studio is being worked on with an intent to push it upstream. |
|
8 |
|
9 --- a/Objects/obmalloc.c Thu Apr 14 10:33:32 2016 -0700 |
|
10 +++ b/Objects/obmalloc.c Thu Apr 14 10:38:55 2016 -0700 |
|
11 @@ -428,6 +428,18 @@ |
|
12 static int running_on_valgrind = -1; |
|
13 #endif |
|
14 |
|
15 +#ifdef __sparcv9 |
|
16 +#include <vis.h> |
|
17 +/* |
|
18 + * Py_ADDRESS_IN_RANGE needs to access memory that might be arbitrarily |
|
19 + * tagged by an ADI aware allocator. The use of a nonfaulting load |
|
20 + * guarantees that the read will succeed. |
|
21 + */ |
|
22 +#define POOL_INDEX(x) __vis_ldswa_ASI_PNF(&(x)) |
|
23 +#else /* __sparcv9 */ |
|
24 +#define POOL_INDEX(x) (x) |
|
25 +#endif /* __sparcv9 */ |
|
26 + |
|
27 /* An object allocator for Python. |
|
28 |
|
29 Here is an introduction to the layers of the Python memory architecture, |
|
30 @@ -1115,7 +1127,7 @@ |
|
31 variable. |
|
32 */ |
|
33 #define Py_ADDRESS_IN_RANGE(P, POOL) \ |
|
34 - ((arenaindex_temp = (POOL)->arenaindex) < maxarenas && \ |
|
35 + ((arenaindex_temp = POOL_INDEX((POOL)->arenaindex)) < maxarenas && \ |
|
36 (uptr)(P) - arenas[arenaindex_temp].address < (uptr)ARENA_SIZE && \ |
|
37 arenas[arenaindex_temp].address != 0) |
|
38 |