Message ID | 201502191920.41284@pali (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 18 February 2015 at 22:14, Pali Rohár <pali.rohar@gmail.com> wrote: > Can you help us with above problem? How to catch external abort > on non-linefetch in kernel driver and prevent kernel panic? Actually it's a synchronous bus error that you want to catch, which however is misreported by linux as "external abort on non-linefetch" (... but a bus error on a linefetch would produce exactly the same error). Also, ARM apparently uses the term "external abort" as umbrella term for aborts triggered outside the MMU, which includes not just bus errors but also (uncorrectable) parity/ECC errors. Anyhow, the core question you mean to ask is: can the "exception" mechanism current already in place to trap MMU faults in e.g. put_user() easily be extended to allow drivers to trap synchronous bus errors? My impression is that this would in fact be quite easy and I even outlined a suggested patch, but I'm still a kernel newbie so I may be way off course. Although its main use would be for auto-probing, it's maybe worth mentioning I've met at least one peripheral which also reports bus errors when writing inappropriate/unsupported *values* to a register. (Of course when using posted writes you won't get an abort anyhow in that case, it's only reported via interconnect error logs.) On 19 February 2015 at 19:20, Pali Rohár <pali.rohar@gmail.com> wrote: > Anyway, in Nokia Harmattan N9/N950 2.6.32 kernel is this patch In mainline linux the same fix-up is done at runtime rather than compile time (in exceptions_init() at the bottom of fault.c). Either way, in my post of the 11th I also mentioned that it looks wrong to me. I-cache maintenance fault is really a special case in the fault decoding logic since it means "although you got here via DAbort and the relevant address is in DFAR, the exception happened on the instruction side so you need to fetch the fault status from IFSR instead."
Hi, On Thu, Feb 19, 2015 at 07:20:41PM +0100, Pali Rohár wrote: > Anyway, in Nokia Harmattan N9/N950 2.6.32 kernel is this patch: > +/* Do we need runtime check ? */ > +#if __LINUX_ARM_ARCH__ < 6 > { do_bad, SIGBUS, 0, "external abort on linefetch" }, > +#else > + { do_translation_fault, SIGSEGV, SEGV_MAPERR, "I-cache maintenance fault" }, > +#endif > Maybe it is related? That was unrelated. Also, the patch is also in mainline, see 8c0b742ca7a7d21de0ddc87eda6ef0b282e4de18 (ARM: 6134/1: Handle instruction cache maintenance fault properly). A.
diff --git a/arch/arm/mm/fsr-2level.c b/arch/arm/mm/fsr-2level.c index 18ca74c..d530d55 100644 --- a/arch/arm/mm/fsr-2level.c +++ b/arch/arm/mm/fsr-2level.c @@ -7,7 +7,12 @@ static struct fsr_info fsr_info[] = { { do_bad, SIGBUS, BUS_ADRALN, "alignment exception" }, { do_bad, SIGKILL, 0, "terminal exception" }, { do_bad, SIGBUS, BUS_ADRALN, "alignment exception" }, +/* Do we need runtime check ? */ +#if __LINUX_ARM_ARCH__ < 6 { do_bad, SIGBUS, 0, "external abort on linefetch" }, +#else + { do_translation_fault, SIGSEGV, SEGV_MAPERR, "I-cache maintenance fault" }, +#endif { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" }, { do_bad, SIGBUS, 0, "external abort on linefetch" }, { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },