-
- Downloads
[release-branch.go1.24] os: hide SetFinalizer from users of Root
Currently Root embeds a root and calls SetFinalizer on &r.root. This sets the finalizer on the outer root, which is visible to users of os.Root, and thus they can mutate the finalizer attached to it. This change modifies Root to not embed its inner root, but rather to refer to it by pointer. This allows us to set the finalizer on this independent inner object, preventing users of os.Root from changing the finalizer. This follows the same pattern as os.File's finalizer. Fixes #71617. Change-Id: Ibd199bab1b3c877d5e12ef380fd4647b4e10221f Reviewed-on: https://go-review.googlesource.com/c/go/+/647876 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by:Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> (cherry picked from commit a704d39b) Reviewed-on: https://go-review.googlesource.com/c/go/+/648135 TryBot-Bypass: Michael Knyszek <mknyszek@google.com> Reviewed-by:
Dmitri Shuralyov <dmitshur@google.com> Reviewed-by:
Dmitri Shuralyov <dmitshur@golang.org>
Please register or sign in to comment