Commit 331b4b8
gh-140815: Fix faulthandler for invalid/freed frame (GH-140921)
faulthandler now detects if a frame or a code object is invalid or
freed.
Add helper functions:
* _PyCode_SafeAddr2Line()
* _PyFrame_SafeGetCode()
* _PyFrame_SafeGetLasti()
_PyMem_IsPtrFreed() now detects pointers in [-0xff, 0xff] range
as freed.
(cherry picked from commit a84181c)
Co-authored-by: Victor Stinner <[email protected]>
1 parent a9c964f commit 331b4b8
File tree
6 files changed
+127
-32
lines changed- Include/internal
- Misc/NEWS.d/next/Library
- Objects
- Python
6 files changed
+127
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
279 | 284 | | |
280 | 285 | | |
281 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
27 | 57 | | |
28 | 58 | | |
29 | 59 | | |
| |||
37 | 67 | | |
38 | 68 | | |
39 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
40 | 95 | | |
41 | 96 | | |
42 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
1016 | | - | |
1017 | | - | |
| 1016 | + | |
| 1017 | + | |
1018 | 1018 | | |
1019 | 1019 | | |
1020 | 1020 | | |
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1031 | 1048 | | |
1032 | 1049 | | |
1033 | 1050 | | |
1034 | 1051 | | |
1035 | 1052 | | |
1036 | | - | |
| 1053 | + | |
1037 | 1054 | | |
1038 | 1055 | | |
1039 | 1056 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
979 | | - | |
| 979 | + | |
980 | 980 | | |
981 | | - | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
982 | 984 | | |
983 | 985 | | |
984 | | - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
985 | 990 | | |
986 | | - | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
987 | 997 | | |
988 | 998 | | |
989 | 999 | | |
990 | 1000 | | |
991 | 1001 | | |
992 | 1002 | | |
993 | 1003 | | |
994 | | - | |
| 1004 | + | |
| 1005 | + | |
995 | 1006 | | |
| 1007 | + | |
996 | 1008 | | |
997 | | - | |
998 | | - | |
| 1009 | + | |
999 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
1000 | 1016 | | |
1001 | 1017 | | |
1002 | 1018 | | |
1003 | 1019 | | |
1004 | 1020 | | |
| 1021 | + | |
1005 | 1022 | | |
1006 | | - | |
1007 | 1023 | | |
1008 | | - | |
1009 | | - | |
| 1024 | + | |
| 1025 | + | |
1010 | 1026 | | |
1011 | 1027 | | |
1012 | 1028 | | |
1013 | 1029 | | |
| 1030 | + | |
1014 | 1031 | | |
1015 | | - | |
1016 | 1032 | | |
| 1033 | + | |
1017 | 1034 | | |
1018 | 1035 | | |
1019 | 1036 | | |
| |||
1056 | 1073 | | |
1057 | 1074 | | |
1058 | 1075 | | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | 1076 | | |
1071 | 1077 | | |
1072 | 1078 | | |
| |||
1076 | 1082 | | |
1077 | 1083 | | |
1078 | 1084 | | |
1079 | | - | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1080 | 1094 | | |
1081 | 1095 | | |
1082 | 1096 | | |
| |||
0 commit comments