0
1
mirror of https://github.com/golang/go synced 2025-06-30 19:47:31 +00:00
Files
go/test/fixedbugs
Keith Randall 5f2cbe1f64 [release-branch.go1.24] cmd/compile: do nil check before calling duff functions, on arm64 and amd64
On these platforms, we set up a frame pointer record below
the current stack pointer, so when we're in duffcopy or duffzero,
we get a reasonable traceback. See #73753.

But because this frame pointer record is below SP, it is vulnerable.
Anything that adds a new stack frame to the stack might clobber it.
Which actually happens in #73748 on amd64. I have not yet come across
a repro on arm64, but might as well be safe here.

The only real situation this could happen is when duffzero or duffcopy
is passed a nil pointer. So we can just avoid the problem by doing the
nil check outside duffzero/duffcopy. That way we never add a frame
below duffzero/duffcopy. (Most other ways to get a new frame below the
current one, like async preempt or debugger-generated calls, don't
apply to duffzero/duffcopy because they are runtime functions; we're
not allowed to preempt there.)

Longer term, we should stop putting stuff below SP. #73753 will
include that as part of its remit. But that's not for 1.25, so we'll
do the simple thing for 1.25 for this issue.

Fixes #73908

Change-Id: I913c49ee46dcaee8fb439415a4531f7b59d0f612
Reviewed-on: https://go-review.googlesource.com/c/go/+/676916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit dbaa2d3e65)
Reviewed-on: https://go-review.googlesource.com/c/go/+/677095
2025-06-11 20:48:50 -07:00
..
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2022-05-18 00:47:29 +00:00
2023-03-28 18:13:13 +00:00
2018-10-18 04:57:41 +00:00
2017-09-19 18:08:50 +00:00
2016-05-08 22:59:43 +00:00
2017-09-15 02:39:16 +00:00
2016-09-04 00:15:41 +00:00
2016-12-08 23:22:37 +00:00
2021-02-22 22:53:51 +00:00
2016-10-12 14:57:26 +00:00
2017-05-18 21:33:05 +00:00
2023-04-11 20:56:32 +00:00
2021-04-21 20:24:34 +00:00
2024-09-13 21:21:33 +00:00
2017-09-08 20:10:48 +00:00
2017-09-08 20:10:48 +00:00
2024-09-13 21:24:10 +00:00
2019-04-24 19:55:13 +00:00
2019-07-18 11:34:23 +00:00
2019-07-18 17:24:59 +00:00
2021-02-22 20:00:00 +00:00
2020-11-21 16:46:05 +00:00
2021-05-22 00:51:17 +00:00
2023-02-07 20:59:40 +00:00
2024-10-14 19:58:47 +00:00