Skip to content

Commit f8b435b

Browse files
vitkyrkaRussell King
authored andcommitted
ARM: 7440/1: kprobes: only test 'sub pc, pc, #1b-2b+8-2' on ARMv6
'sub pc, pc, #1b-2b+8-2' results in address<1:0> == '10'. sub pc, pc, #const (== ADR pc, #const) performs an interworking branch (BXWritePC()) on ARMv7+ and a simple branch (BranchWritePC()) on earlier versions. In ARM state, BXWritePC() is UNPREDICTABLE when address<1:0> == '10'. In ARM state on ARMv6+, BranchWritePC() ignores address<1:0>. Before ARMv6, BranchWritePC() is UNPREDICTABLE if address<1:0> != '00' So the instruction is UNPREDICTABLE both before and after v6. Acked-by: Jon Medhurst <[email protected]> Signed-off-by: Rabin Vincent <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent fdeb8e3 commit f8b435b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm/kernel/kprobes-test-arm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ void kprobe_arm_test_cases(void)
187187
TEST_BF_R ("mov pc, r",0,2f,"")
188188
TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"")
189189
TEST_BB( "sub pc, pc, #1b-2b+8")
190-
#if __LINUX_ARM_ARCH__ >= 6
191-
TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before ARMv6 */
190+
#if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7)
191+
TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */
192192
#endif
193193
TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"")
194194
TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")

0 commit comments

Comments
 (0)