aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/_mkmalloc
diff options
context:
space:
mode:
authorDaniel Morsing <daniel.morsing@gmail.com>2025-09-25 17:26:03 +0100
committerGopher Robot <gobot@golang.org>2025-11-26 15:42:52 -0800
commita3fb92a7100f3f2824d483ee0cbcf1264584b3e4 (patch)
tree9c01886504bdfa077c25b6bef804e95b86d1e474 /src/runtime/_mkmalloc
parent0c747b7aa757da0a0a0ac7b2b5834dca84c7c019 (diff)
downloadgo-a3fb92a7100f3f2824d483ee0cbcf1264584b3e4.tar.xz
runtime/secret: implement new secret package
Implement secret.Do. - When secret.Do returns: - Clear stack that is used by the argument function. - Clear all the registers that might contain secrets. - On stack growth in secret mode, clear the old stack. - When objects are allocated in secret mode, mark them and then zero the marked objects immediately when they are freed. - If the argument function panics, raise that panic as if it originated from secret.Do. This removes anything about the secret function from tracebacks. For now, this is only implemented on linux for arm64 and amd64. This is a rebased version of Keith Randalls initial implementation at CL 600635. I have added arm64 support, signal handling, preemption handling and dealt with vDSOs spilling into system stacks. Fixes #21865 Change-Id: I6fbd5a233beeaceb160785e0c0199a5c94d8e520 Co-authored-by: Keith Randall <khr@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/704615 Reviewed-by: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/_mkmalloc')
-rw-r--r--src/runtime/_mkmalloc/mkmalloc.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtime/_mkmalloc/mkmalloc.go b/src/runtime/_mkmalloc/mkmalloc.go
index 1f040c8861..46c50d6661 100644
--- a/src/runtime/_mkmalloc/mkmalloc.go
+++ b/src/runtime/_mkmalloc/mkmalloc.go
@@ -171,6 +171,7 @@ func specializedMallocConfig(classes []class, sizeToSizeClass []uint8) generator
{subBasicLit, "elemsize_", str(elemsize)},
{subBasicLit, "sizeclass_", str(sc)},
{subBasicLit, "noscanint_", str(noscan)},
+ {subBasicLit, "isTiny_", str(0)},
},
})
}
@@ -198,6 +199,7 @@ func specializedMallocConfig(classes []class, sizeToSizeClass []uint8) generator
{subBasicLit, "sizeclass_", str(tinySizeClass)},
{subBasicLit, "size_", str(s)},
{subBasicLit, "noscanint_", str(noscan)},
+ {subBasicLit, "isTiny_", str(1)},
},
})
}
@@ -215,6 +217,7 @@ func specializedMallocConfig(classes []class, sizeToSizeClass []uint8) generator
{subBasicLit, "elemsize_", str(elemsize)},
{subBasicLit, "sizeclass_", str(sc)},
{subBasicLit, "noscanint_", str(noscan)},
+ {subBasicLit, "isTiny_", str(0)},
},
})
}