forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfc41542
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 parentbb3f42a commitfc41542
1 file changed
+14
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1074 | 1074 | | |
1075 | 1075 | | |
1076 | 1076 | | |
| 1077 | + | |
1077 | 1078 | | |
1078 | 1079 | | |
1079 | 1080 | | |
1080 | 1081 | | |
1081 | 1082 | | |
1082 | 1083 | | |
1083 | | - | |
1084 | 1084 | | |
1085 | 1085 | | |
1086 | 1086 | | |
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
1131 | | - | |
| 1131 | + | |
1132 | 1132 | | |
1133 | 1133 | | |
| 1134 | + | |
1134 | 1135 | | |
1135 | | - | |
| 1136 | + | |
1136 | 1137 | | |
1137 | 1138 | | |
| 1139 | + | |
| 1140 | + | |
1138 | 1141 | | |
1139 | 1142 | | |
1140 | 1143 | | |
1141 | 1144 | | |
1142 | 1145 | | |
1143 | 1146 | | |
1144 | 1147 | | |
1145 | | - | |
| 1148 | + | |
1146 | 1149 | | |
1147 | 1150 | | |
1148 | 1151 | | |
| |||
1177 | 1180 | | |
1178 | 1181 | | |
1179 | 1182 | | |
1180 | | - | |
| 1183 | + | |
1181 | 1184 | | |
1182 | 1185 | | |
1183 | 1186 | | |
1184 | | - | |
1185 | | - | |
| 1187 | + | |
| 1188 | + | |
1186 | 1189 | | |
| 1190 | + | |
1187 | 1191 | | |
1188 | 1192 | | |
1189 | 1193 | | |
1190 | 1194 | | |
1191 | | - | |
| 1195 | + | |
1192 | 1196 | | |
1193 | 1197 | | |
1194 | 1198 | | |
1195 | | - | |
| 1199 | + | |
1196 | 1200 | | |
1197 | | - | |
| 1201 | + | |
1198 | 1202 | | |
1199 | 1203 | | |
1200 | 1204 | | |
| |||
0 commit comments
Comments
(0)