Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Fix interrupt range check on debug exception

We do not want to take single step and branch-taken debug exception
in kernel exception code. But the address range check was not covering
all kernel exception handlers address range.

With this patch we defined the interrupt_end label which defines the
end on kernel exception code. So now we check interrupt_base to
interrupt_end range for not handling debug exception in kernel
exception entry.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Bharat Bhushan and committed by
Benjamin Herrenschmidt
fc2a6cfe 1f6aaacc

+12 -8
+2
arch/powerpc/kernel/head_44x.S
··· 769 769 */ 770 770 DEBUG_CRIT_EXCEPTION 771 771 772 + interrupt_end: 773 + 772 774 /* 773 775 * Global functions 774 776 */
+8 -8
arch/powerpc/kernel/head_booke.h
··· 281 281 andis. r10,r10,(DBSR_IC|DBSR_BT)@h; \ 282 282 beq+ 2f; \ 283 283 \ 284 - lis r10,KERNELBASE@h; /* check if exception in vectors */ \ 285 - ori r10,r10,KERNELBASE@l; \ 284 + lis r10,interrupt_base@h; /* check if exception in vectors */ \ 285 + ori r10,r10,interrupt_base@l; \ 286 286 cmplw r12,r10; \ 287 287 blt+ 2f; /* addr below exception vectors */ \ 288 288 \ 289 - lis r10,DebugDebug@h; \ 290 - ori r10,r10,DebugDebug@l; \ 289 + lis r10,interrupt_end@h; \ 290 + ori r10,r10,interrupt_end@l; \ 291 291 cmplw r12,r10; \ 292 292 bgt+ 2f; /* addr above exception vectors */ \ 293 293 \ ··· 334 334 andis. r10,r10,(DBSR_IC|DBSR_BT)@h; \ 335 335 beq+ 2f; \ 336 336 \ 337 - lis r10,KERNELBASE@h; /* check if exception in vectors */ \ 338 - ori r10,r10,KERNELBASE@l; \ 337 + lis r10,interrupt_base@h; /* check if exception in vectors */ \ 338 + ori r10,r10,interrupt_base@l; \ 339 339 cmplw r12,r10; \ 340 340 blt+ 2f; /* addr below exception vectors */ \ 341 341 \ 342 - lis r10,DebugCrit@h; \ 343 - ori r10,r10,DebugCrit@l; \ 342 + lis r10,interrupt_end@h; \ 343 + ori r10,r10,interrupt_end@l; \ 344 344 cmplw r12,r10; \ 345 345 bgt+ 2f; /* addr above exception vectors */ \ 346 346 \
+2
arch/powerpc/kernel/head_fsl_booke.S
··· 605 605 /* Embedded Hypervisor Privilege */ 606 606 EXCEPTION(0, HV_PRIV, Ehvpriv, unknown_exception, EXC_XFER_EE) 607 607 608 + interrupt_end: 609 + 608 610 /* 609 611 * Local functions 610 612 */