Skip to content

Commit

Permalink
Make GEP when loading the PTLS an inbounds one. (#55682)
Browse files Browse the repository at this point in the history
Non inbounds GEPs should only be used when doing pointer arithmethic i.e
Ptr or MemoryRef boundscheck.
Found when auditing non inbounds GEPs for
#55681
  • Loading branch information
gbaraldi authored and KristofferC committed Sep 12, 2024
1 parent d377fde commit c4da0de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/llvm-ptls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Instruction *LowerPTLS::emit_pgcstack_tp(Value *offset, Instruction *insertBefor
offset = ConstantInt::getSigned(T_size, jl_tls_offset);
auto tp = InlineAsm::get(FunctionType::get(PointerType::get(builder.getContext(), 0), false), asm_str, "=r", false);
tls = builder.CreateCall(tp, {}, "thread_ptr");
tls = builder.CreateGEP(Type::getInt8Ty(builder.getContext()), tls, {offset}, "tls_ppgcstack");
tls = builder.CreateInBoundsGEP(Type::getInt8Ty(builder.getContext()), tls, {offset}, "tls_ppgcstack");
}
return builder.CreateLoad(T_pppjlvalue, tls, "tls_pgcstack");
}
Expand Down

0 comments on commit c4da0de

Please sign in to comment.