forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4cbcb7e
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 parent80cd1a6 commit4cbcb7e
1 file changed
+14
-10
lines changedLines changed: 14 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1068 | 1068 |
| |
1069 | 1069 |
| |
1070 | 1070 |
| |
| 1071 | + | |
1071 | 1072 |
| |
1072 | 1073 |
| |
1073 | 1074 |
| |
1074 | 1075 |
| |
1075 |
| - | |
1076 | 1076 |
| |
1077 | 1077 |
| |
1078 | 1078 |
| |
| |||
1114 | 1114 |
| |
1115 | 1115 |
| |
1116 | 1116 |
| |
1117 |
| - | |
| 1117 | + | |
1118 | 1118 |
| |
1119 | 1119 |
| |
| 1120 | + | |
1120 | 1121 |
| |
1121 |
| - | |
| 1122 | + | |
1122 | 1123 |
| |
1123 | 1124 |
| |
| 1125 | + | |
| 1126 | + | |
1124 | 1127 |
| |
1125 | 1128 |
| |
1126 | 1129 |
| |
1127 | 1130 |
| |
1128 | 1131 |
| |
1129 | 1132 |
| |
1130 | 1133 |
| |
1131 |
| - | |
| 1134 | + | |
1132 | 1135 |
| |
1133 | 1136 |
| |
1134 | 1137 |
| |
| |||
1165 | 1168 |
| |
1166 | 1169 |
| |
1167 | 1170 |
| |
1168 |
| - | |
| 1171 | + | |
1169 | 1172 |
| |
1170 | 1173 |
| |
1171 | 1174 |
| |
1172 |
| - | |
1173 |
| - | |
| 1175 | + | |
| 1176 | + | |
1174 | 1177 |
| |
| 1178 | + | |
1175 | 1179 |
| |
1176 | 1180 |
| |
1177 | 1181 |
| |
1178 | 1182 |
| |
1179 |
| - | |
| 1183 | + | |
1180 | 1184 |
| |
1181 | 1185 |
| |
1182 | 1186 |
| |
1183 |
| - | |
| 1187 | + | |
1184 | 1188 |
| |
1185 |
| - | |
| 1189 | + | |
1186 | 1190 |
| |
1187 | 1191 |
| |
1188 | 1192 |
| |
|
0 commit comments
Comments
(0)