tsan: fix out-of-bounds access in Go runtime
FuncEntry can resize the shadow stack, while "thr->shadow_stack_pos[0] = pc" writes out-of-bounds. llvm-svn: 210349
This commit is contained in:
parent
32336152af
commit
75f5cf657e
|
@ -423,13 +423,11 @@ void ForkChildAfter(ThreadState *thr, uptr pc) {
|
|||
u32 CurrentStackId(ThreadState *thr, uptr pc) {
|
||||
if (thr->shadow_stack_pos == 0) // May happen during bootstrap.
|
||||
return 0;
|
||||
if (pc) {
|
||||
thr->shadow_stack_pos[0] = pc;
|
||||
thr->shadow_stack_pos++;
|
||||
}
|
||||
if (pc != 0)
|
||||
FuncEntry(thr, pc); // can resize the shadow stack
|
||||
u32 id = StackDepotPut(thr->shadow_stack,
|
||||
thr->shadow_stack_pos - thr->shadow_stack);
|
||||
if (pc)
|
||||
if (pc != 0)
|
||||
thr->shadow_stack_pos--;
|
||||
return id;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue