Skip to content

Commit ccaf7ca

Browse files
paulburtonralfbaechle
authored andcommitted
MIPS: Clear ISA bit correctly in get_frame_info()
get_frame_info() can be called in microMIPS kernels with the ISA bit already clear. For example this happens when unwind_stack_by_address() is called because we begin with a PC that has the ISA bit set & subtract the (odd) offset from the preceding symbol (which does not have the ISA bit set). Since get_frame_info() unconditionally subtracts 1 from the PC in microMIPS kernels it incorrectly misaligns the address it then attempts to access code at, leading to an address error exception. Fix this by using msk_isa16_mode() to clear the ISA bit, which allows get_frame_info() to function regardless of whether it is provided with a PC that has the ISA bit set or not. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Fixes: 34c2f66 ("MIPS: microMIPS: Add unaligned access support.") Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com> Cc: linux-mips@linux-mips.org Cc: <stable@vger.kernel.org> # v3.10+ Patchwork: https://patchwork.linux-mips.org/patch/14528/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent ca0c40c commit ccaf7ca

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎arch/mips/kernel/process.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,14 @@ static inline int is_sp_move_ins(union mips_instruction *ip)
304304

305305
static int get_frame_info(struct mips_frame_info *info)
306306
{
307-
#ifdef CONFIG_CPU_MICROMIPS
308-
union mips_instruction *ip = (void *) (((char *) info->func) - 1);
309-
#else
310-
union mips_instruction *ip = info->func;
311-
#endif
307+
union mips_instruction *ip;
312308
unsigned max_insns = info->func_size / sizeof(union mips_instruction);
313309
unsigned i;
314310

315311
info->pc_offset = -1;
316312
info->frame_size = 0;
317313

314+
ip = (void *)msk_isa16_mode((ulong)info->func);
318315
if (!ip)
319316
goto err;
320317

0 commit comments

Comments
 (0)