forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita0d35eb
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 parentad08673 commita0d35eb
1 file changed
+14
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1050 | 1050 | | |
1051 | 1051 | | |
1052 | 1052 | | |
| 1053 | + | |
1053 | 1054 | | |
1054 | 1055 | | |
1055 | 1056 | | |
1056 | 1057 | | |
1057 | 1058 | | |
1058 | 1059 | | |
1059 | | - | |
1060 | 1060 | | |
1061 | 1061 | | |
1062 | 1062 | | |
| |||
1104 | 1104 | | |
1105 | 1105 | | |
1106 | 1106 | | |
1107 | | - | |
| 1107 | + | |
1108 | 1108 | | |
1109 | 1109 | | |
| 1110 | + | |
1110 | 1111 | | |
1111 | | - | |
| 1112 | + | |
1112 | 1113 | | |
1113 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
1114 | 1117 | | |
1115 | 1118 | | |
1116 | 1119 | | |
1117 | 1120 | | |
1118 | 1121 | | |
1119 | 1122 | | |
1120 | 1123 | | |
1121 | | - | |
| 1124 | + | |
1122 | 1125 | | |
1123 | 1126 | | |
1124 | 1127 | | |
| |||
1153 | 1156 | | |
1154 | 1157 | | |
1155 | 1158 | | |
1156 | | - | |
| 1159 | + | |
1157 | 1160 | | |
1158 | 1161 | | |
1159 | 1162 | | |
1160 | | - | |
1161 | | - | |
| 1163 | + | |
| 1164 | + | |
1162 | 1165 | | |
| 1166 | + | |
1163 | 1167 | | |
1164 | 1168 | | |
1165 | 1169 | | |
1166 | 1170 | | |
1167 | | - | |
| 1171 | + | |
1168 | 1172 | | |
1169 | 1173 | | |
1170 | 1174 | | |
1171 | | - | |
| 1175 | + | |
1172 | 1176 | | |
1173 | | - | |
| 1177 | + | |
1174 | 1178 | | |
1175 | 1179 | | |
1176 | 1180 | | |
| |||
0 commit comments
Comments
(0)