Skip to content

Commit 351727f

Browse files
authored
Make GEP when loading the PTLS an inbounds one. (#55682)
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
1 parent e818863 commit 351727f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/llvm-ptls.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Instruction *LowerPTLS::emit_pgcstack_tp(Value *offset, Instruction *insertBefor
128128
offset = ConstantInt::getSigned(T_size, jl_tls_offset);
129129
auto tp = InlineAsm::get(FunctionType::get(PointerType::get(builder.getContext(), 0), false), asm_str, "=r", false);
130130
tls = builder.CreateCall(tp, {}, "thread_ptr");
131-
tls = builder.CreateGEP(Type::getInt8Ty(builder.getContext()), tls, {offset}, "tls_ppgcstack");
131+
tls = builder.CreateInBoundsGEP(Type::getInt8Ty(builder.getContext()), tls, {offset}, "tls_ppgcstack");
132132
}
133133
return builder.CreateLoad(T_pppjlvalue, tls, "tls_pgcstack");
134134
}

0 commit comments

Comments
 (0)