Skip to content

Commit 1f4c007

Browse files
author
Joffrey Guilbon
committed
Fixing an off by 4 in qasan_shadow_stack_pop when comparing current ptr and cur_bk stored address. This was leading to cur_bk shadow stack exhaution, which itself led to useless QASAN reporting.
1 parent d40bcd8 commit 1f4c007

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

target/arm/translate-a64.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ static void disas_uncond_b_imm(DisasContext *s, uint32_t insn)
13441344
if (insn & (1U << 31)) {
13451345
/* BL Branch with link */
13461346
if (use_qasan && qasan_max_call_stack)
1347-
gen_helper_qasan_shadow_stack_push(tcg_const_tl(s->pc_curr));
1347+
gen_helper_qasan_shadow_stack_push(tcg_const_tl(s->pc_curr + 4));
13481348
tcg_gen_movi_i64(cpu_reg(s, 30), s->base.pc_next);
13491349
}
13501350

@@ -2253,7 +2253,7 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
22532253
if (opc == 2 && rn == 30)
22542254
gen_helper_qasan_shadow_stack_pop(cpu_reg(s, 30));
22552255
else if (opc == 1)
2256-
gen_helper_qasan_shadow_stack_push(tcg_const_tl(s->pc_curr));
2256+
gen_helper_qasan_shadow_stack_push(tcg_const_tl(s->pc_curr + 4));
22572257
}
22582258
gen_a64_set_pc(s, dst);
22592259
/* BLR also needs to load return address */

0 commit comments

Comments
 (0)