forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc13667b
committed
Fix mislabeling of PROC_QUEUE->links as PGPROC, fixing UBSan on 32bit
ProcSleep() used a PGPROC* variable to point to PROC_QUEUE->links.next,because that does "the right thing" with SHMQueueInsertBefore(). While thatlargely works, it's certainly not correct and unnecessary - we can just useSHM_QUEUE* to point to the insertion point.Noticed when testing a 32bit of postgres with undefined behaviorsanitizer. UBSan noticed that sometimes the supposed PGPROC wasn'tsufficiently aligned (required since46d6e5f, ensured indirectly, viaShmemAllocRaw() guaranteeing cacheline alignment).For now fix this by using a SHM_QUEUE* for the insertion point. Subsequentlywe should replace all the use of PROC_QUEUE and SHM_QUEUE with ilist.h, butthat's a larger change that we don't want to backpatch.Backpatch to all supported versions - it's useful to be able to run postgresunder UBSan.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/20221117014230.op5kmgypdv2dtqsf@awork3.anarazel.deBackpatch: 11-1 parentd3d3888 commitc13667b
1 file changed
+14
-10
lines changedLines changed: 14 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1067 | 1067 |
| |
1068 | 1068 |
| |
1069 | 1069 |
| |
| 1070 | + | |
1070 | 1071 |
| |
1071 | 1072 |
| |
1072 | 1073 |
| |
1073 | 1074 |
| |
1074 |
| - | |
1075 | 1075 |
| |
1076 | 1076 |
| |
1077 | 1077 |
| |
| |||
1119 | 1119 |
| |
1120 | 1120 |
| |
1121 | 1121 |
| |
1122 |
| - | |
| 1122 | + | |
1123 | 1123 |
| |
1124 | 1124 |
| |
| 1125 | + | |
1125 | 1126 |
| |
1126 |
| - | |
| 1127 | + | |
1127 | 1128 |
| |
1128 | 1129 |
| |
| 1130 | + | |
| 1131 | + | |
1129 | 1132 |
| |
1130 | 1133 |
| |
1131 | 1134 |
| |
1132 | 1135 |
| |
1133 | 1136 |
| |
1134 | 1137 |
| |
1135 | 1138 |
| |
1136 |
| - | |
| 1139 | + | |
1137 | 1140 |
| |
1138 | 1141 |
| |
1139 | 1142 |
| |
| |||
1168 | 1171 |
| |
1169 | 1172 |
| |
1170 | 1173 |
| |
1171 |
| - | |
| 1174 | + | |
1172 | 1175 |
| |
1173 | 1176 |
| |
1174 | 1177 |
| |
1175 |
| - | |
1176 |
| - | |
| 1178 | + | |
| 1179 | + | |
1177 | 1180 |
| |
| 1181 | + | |
1178 | 1182 |
| |
1179 | 1183 |
| |
1180 | 1184 |
| |
1181 | 1185 |
| |
1182 |
| - | |
| 1186 | + | |
1183 | 1187 |
| |
1184 | 1188 |
| |
1185 | 1189 |
| |
1186 |
| - | |
| 1190 | + | |
1187 | 1191 |
| |
1188 |
| - | |
| 1192 | + | |
1189 | 1193 |
| |
1190 | 1194 |
| |
1191 | 1195 |
| |
|
0 commit comments
Comments
(0)