diff --git a/src/runtime/mprof.go b/src/runtime/mprof.go index 45f107722a..937194a238 100644 --- a/src/runtime/mprof.go +++ b/src/runtime/mprof.go @@ -39,7 +39,10 @@ const ( // size of bucket hash table buckHashSize = 179999 - // max depth of stack to record in bucket + // maxStack is the max depth of stack to record in bucket. + // Note that it's only used internally as a guard against + // wildly out-of-bounds slicing of the PCs that come after + // a bucket struct, and it could increase in the future. maxStack = 32 ) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 2a02e1fb3b..885b493bad 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -583,7 +583,7 @@ type m struct { alllink *m // on allm schedlink muintptr lockedg guintptr - createstack [32]uintptr // stack that created this thread. + createstack [32]uintptr // stack that created this thread, it's used for StackRecord.Stack0, so it must align with it. lockedExt uint32 // tracking for external LockOSThread lockedInt uint32 // tracking for internal lockOSThread nextwaitm muintptr // next m waiting for lock