Xor 임의의 카나리아를 구현하고자하므로 함수의 프롤로그 및 에필로그에서 반환 주소를 얻어야합니다. 내가 스택에 카나리아에 삽입하기 전에 함수의 프롤로그에서 LLVM에서 스택에 반환 주소를 얻는 방법
는 내가 의해 반환 주소를 얻을 수 있습니다 :ConstantInt* ci = llvm::ConstantInt::get(Type::getInt32Ty(RI->getContext()), 0);
Value* Args1[] = {ci};
CallInst* callInst = CallInst::Create(Intrinsic::getDeclaration(M, Intrinsic::returnaddress),
&Args1[0], array_endof(Args1), "Call Return Address", InsPt);
callInst은 반환 주소를 얻을 것이다 그것을 작동합니다.
기능의 끝 부분에는 카나리아가 삽입되어 있기 때문에. 나는 유사한 코드 쓰기 :
ConstantInt* ci2 = llvm::ConstantInt::get(Type::getInt32Ty(RI->getContext()), 1);
Value* Args3[] = {ci2};
CallInst* callInst1 = CallInst::Create(Intrinsic::getDeclaration(M, Intrinsic::returnaddress),
&Args3[0], array_endof(Args3), "Caaall Return Address", BB);
을하지만이 시간이 작동하지 않습니다. 나는 반송 주소를 얻을 수 없다.
무엇이 문제인가? 반송 주소는 어떻게받을 수 있습니까? 이렇게하는 이유