Commit b3330e95 authored by Georgia Kouveli's avatar Georgia Kouveli Committed by Commit Bot

[arm64] Use static_cast instead of reinterpret_cast in CFI code

In a couple of places we cast between uintptr_t and uint64_t with a
reinterpret_cast. While this is correct when these types are aliased
to the same type, if they are defined to be different integral types
(while still of the same size), reinterpet_cast won't work.

Change-Id: I6e935c6c263d8df16f88659ac285faeb5e073add
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2614678Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Georgia Kouveli <georgia.kouveli@arm.com>
Cr-Commit-Position: refs/heads/master@{#71988}
parent 0d30fac2
......@@ -24,7 +24,7 @@ namespace internal {
V8_INLINE Address PointerAuthentication::AuthenticatePC(
Address* pc_address, unsigned offset_from_sp) {
uint64_t sp = reinterpret_cast<uint64_t>(pc_address) + offset_from_sp;
uint64_t pc = reinterpret_cast<uint64_t>(*pc_address);
uint64_t pc = static_cast<uint64_t>(*pc_address);
#ifdef USE_SIMULATOR
pc = Simulator::AuthPAC(pc, sp, Simulator::kPACKeyIB,
Simulator::kInstructionPointer);
......@@ -67,7 +67,7 @@ V8_INLINE void PointerAuthentication::ReplacePC(Address* pc_address,
Address new_pc,
int offset_from_sp) {
uint64_t sp = reinterpret_cast<uint64_t>(pc_address) + offset_from_sp;
uint64_t old_pc = reinterpret_cast<uint64_t>(*pc_address);
uint64_t old_pc = static_cast<uint64_t>(*pc_address);
#ifdef USE_SIMULATOR
uint64_t auth_old_pc = Simulator::AuthPAC(old_pc, sp, Simulator::kPACKeyIB,
Simulator::kInstructionPointer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment