Skip to content

runtime: memlock not unlocked in all control flow paths in sysReserveAlignedSbrk #74339

Closed
@tschneidereit

Description

@tschneidereit

Go version

go version go1.24.4 darwin/arm64

Output of go env in your module/workspace:

N/A

What did you do?

While I ran into the issue in real code, it's somewhat obscure and impossible to reproduce using https://go.dev/play, since it requires passing -ldflags=-checklinkname=0 to go build.

In short, I called sysReserveAlignedSbrk(65536, 0) twice.

What did you see happen?

The lock taken here wasn't released during the first call, because this return is hit, leading to a panic in the second call.

What did you expect to see?

The lock to always be released, presumably by adding unlock(&memlock) before each return.

It's not clear to me whether this is reachable without pull-mode linking of sysReserveAlignedSbrk or sysReserveAligned, since the former is only called by the latter, and the latter seems unused—but I might certainly be missing usages of either or both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions