Commit 6a85559
windows: fix dangling pointers in (*SECURITY_DESCRIPTOR).ToAbsolute
Prior to this CL, a byte slice was allocated via make to use as the
absoluteSD argument passed to the Windows API MakeAbsoluteSD.
MakeAbsoluteSD then sets pointers outside the view of the GC, including
pointers within absoluteSD that point to other chunks of memory
we pass into MakeAbsoluteSD.
CL 653856 recently allowed more make results to be stack allocated,
which worsened the problems here and made it easier for those
pointers in absoluteSD to become dangling pointers, though the
core problems here existed before.
This CL instead allocates absoluteSD as a proper SECURITY_DESCRIPTOR
struct so that the GC can be aware of its pointers. We also verify the
pointers are as we expect, and then set them explicitly
in view of the GC.
Updates golang/go#73199
Change-Id: Id8038d38a887bb8ff3ffc6eae603589b97e92cdc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/663355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>1 parent 01aaa83 commit 6a85559
1 file changed
+44
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1303 | 1303 | | |
1304 | 1304 | | |
1305 | 1305 | | |
1306 | | - | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
1307 | 1310 | | |
1308 | 1311 | | |
1309 | 1312 | | |
| |||
1312 | 1315 | | |
1313 | 1316 | | |
1314 | 1317 | | |
1315 | | - | |
| 1318 | + | |
1316 | 1319 | | |
1317 | 1320 | | |
1318 | | - | |
| 1321 | + | |
1319 | 1322 | | |
1320 | 1323 | | |
1321 | | - | |
| 1324 | + | |
1322 | 1325 | | |
1323 | 1326 | | |
1324 | | - | |
| 1327 | + | |
1325 | 1328 | | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
1326 | 1335 | | |
1327 | 1336 | | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
1328 | 1367 | | |
1329 | 1368 | | |
1330 | 1369 | | |
| |||
0 commit comments