Hi Finn, makes sense, unless that else_if branch was meant to follow the if (do_page_fault (&fp->ptregs, addr, errorcode) < 0) (which it clearly doesn't, and this code hasn't changed since 2.4.30 at least. The net effect would be the same as after your patch.). Worth a try IMO. About evading a signal - as the code is now, any faults that are not write protect or invalid MMU descriptor faults would end up in that branch. In particular, for anything that should have been caught by the branch below, we'd expect to see kernel mode faults cause signals or unexpected bus errors that should really have caused a panic. I've never seen these unexpected bus errors in my logs. As for test case - we'd have to prepare a page that has a valid MMU descriptor, is not write protected and causes a fault. Some nonexisting address in the hardware register space on Falcon might work, or a mapped page marked supervisor only and read from user space. The former might be the easiest to try. Cheers, Michael Am 05.03.2018 um 17:00 schrieb Finn Thain:
The only sensible place for the !(mmusr & MMU_I) test is inside the (mmusr & (MMU_I | MMU_WP)) branch. It is redundant when used in the else branch. Moreover, when used in the else branch it defeats the remaining conditionals. Hence the (mmusr & (MMU_B|MMU_L|MMU_S)) branch is unreachable, along with the final else branch. Make the dead code live again. I mentioned this dead code some time ago. It's still only a theoretical bug, but maybe it's possible to evade a signal in the (ssw & RM) case? --- See also http://lkml.kernel.org/r/alpine.LNX.2.00.1402211323140.7194@nippy.intranet Does anyone have test cases for these exceptions? diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index c1cc4e99aa94..506e5500fa44 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c @@ -561,9 +561,9 @@ static inline void bus_error030 (struct frame *fp) handled. */ if (do_page_fault (&fp->ptregs, addr, errorcode) < 0) return; - } else if (!(mmusr & MMU_I)) { /* probably a 020 cas fault */ - if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0) + if (!(mmusr & MMU_I) && !(ssw & RM) && + send_fault_sig(&fp->ptregs) > 0) pr_err("unexpected bus error (%#x,%#x)\n", ssw, mmusr); } else if (mmusr & (MMU_B|MMU_L|MMU_S)) { -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
-- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html