Skip to content

Commit

Permalink
ARM: KVM: Fix idmap stub entry when running Thumb-2 code
Browse files Browse the repository at this point in the history
When entering the hyp stub implemented in the idmap, we try to
be mindful of the fact that we could be running a Thumb-2 kernel
by adding 1 to the address we compute. Unfortunately, the assembler
also knows about this trick, and has already generated an address
that has bit 0 set in the litteral pool.

Our superfluous correction ends up confusing the CPU entierely,
as we now branch to the stub in ARM mode instead of Thumb, and on
a possibly unaligned address for good measure. From that point,
nothing really good happens.

The obvious fix in to remove this stupid target PC correction.

Fixes: 6bebcec ("ARM: KVM: Allow the main HYP code to use the init hyp stub implementation")
Reported-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
  • Loading branch information
Marc Zyngier authored and Christoffer Dall committed Apr 20, 2017
1 parent 5b56052 commit 1edb632
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion arch/arm/kvm/hyp/hyp-entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ hyp_hvc:
ldr r1, [r1]
ldr ip, =__kvm_handle_stub_hvc
sub ip, ip, r1
THUMB( add ip, ip, #1)
pop {r1}

bx ip
Expand Down

0 comments on commit 1edb632

Please sign in to comment.