]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.24] runtime: add missing unlock in sysReserveAlignedSbrk
authorCherry Mui <cherryyz@google.com>
Sun, 22 Jun 2025 19:01:27 +0000 (15:01 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 25 Jun 2025 19:28:15 +0000 (12:28 -0700)
sysReserveAlignedSbrk locks memlock at entry, but it is not
unlocked at one of the return path. Add the missing unlock.

Updates #74339.
Fixes #74346.

Change-Id: Ib641bc348aca41494ec410e2c4eb9857f3362484
Reviewed-on: https://go-review.googlesource.com/c/go/+/683295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit 456a90aa1618a6c3aa49ecba46969128e2bfa26f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/684016
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

src/runtime/mem_sbrk.go

index cfca8910860e9c778d16ab111a4edc86d91f5722..270255a19a5f3c3fd20fdfa26d07a58883f1282e 100644 (file)
@@ -231,6 +231,7 @@ func sysReserveAlignedSbrk(size, align uintptr) (unsafe.Pointer, uintptr) {
                        memFree(unsafe.Pointer(end), endLen)
                }
                memCheck()
+               unlock(&memlock)
                return unsafe.Pointer(pAligned), size
        }