• Cherry Zhang's avatar
    cmd/compile: fix possible spill of invalid pointer with DUFFZERO on AMD64 · 111d590f
    Cherry Zhang authored
    SSA compiler on AMD64 may spill Duff-adjusted address as scalar. If
    the object is on stack and the stack moves, the spilled address become
    invalid.
    
    Making the spill pointer-typed does not work. The Duff-adjusted address
    points to the memory before the area to be zeroed and may be invalid.
    This may cause stack scanning code panic.
    
    Fix it by doing Duff-adjustment in genValue, so the intermediate value
    is not seen by the reg allocator, and will not be spilled.
    
    Add a test to cover both cases. As it depends on allocation, it may
    be not always triggered.
    
    Fixes #16515.
    
    Change-Id: Ia81d60204782de7405b7046165ad063384ede0db
    Reviewed-on: https://go-review.googlesource.com/25309
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    111d590f
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...