Message ID | 20220712161452.4142444-4-mark.rutland@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: report EL1 exceptions better | expand |
On Tue, Jul 12, 2022 at 05:14:50PM +0100, Mark Rutland wrote: > Currently, but_handler() and kasan_handler() call die() with '0' as the bug_handler(). Otherwise Reviewed-by: Mark Brown <broonie@kernel.org>
On Tue, Jul 12, 2022 at 05:22:54PM +0100, Mark Brown wrote: > On Tue, Jul 12, 2022 at 05:14:50PM +0100, Mark Rutland wrote: > > Currently, but_handler() and kasan_handler() call die() with '0' as the > > bug_handler(). > > Otherwise > > Reviewed-by: Mark Brown <broonie@kernel.org> Cheers; I've fixed that up locally. Mark.
On 7/12/22 21:44, Mark Rutland wrote: > Currently, but_handler() and kasan_handler() call die() with '0' as the s/but_handler/bug_handler > 'err' value, whereas die_kernel_fault() passes the ESR_ELx value. > > For consistencty, this patch ensures we always pass the ESR_ELx value to s/consistencty/consistency > die(). As this is only called for exceptions taken from kernel mode, > there should be no user-visible change as a result of this patch. Why should not change do_undefinstr() to pass 'esr' into die() as well. > > Signed-off-by: Mark Rutland <mark.rutland@arm.com> > Cc: Alexandru Elisei <alexandru.elisei@arm.com> > Cc: Amit Daniel Kachhap <amit.kachhap@arm.com> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: James Morse <james.morse@arm.com> > Cc: Mark Brown <broonie@kernel.org> > Cc: Will Deacon <will@kernel.org> > --- > arch/arm64/kernel/traps.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > index da8ffef6f7c5..6739ce64caf8 100644 > --- a/arch/arm64/kernel/traps.c > +++ b/arch/arm64/kernel/traps.c > @@ -972,7 +972,7 @@ static int bug_handler(struct pt_regs *regs, unsigned long esr) > { > switch (report_bug(regs->pc, regs)) { > case BUG_TRAP_TYPE_BUG: > - die("Oops - BUG", regs, 0); > + die("Oops - BUG", regs, esr); > break; > > case BUG_TRAP_TYPE_WARN: > @@ -1040,7 +1040,7 @@ static int kasan_handler(struct pt_regs *regs, unsigned long esr) > * This is something that might be fixed at some point in the future. > */ > if (!recover) > - die("Oops - KASAN", regs, 0); > + die("Oops - KASAN", regs, esr); > > /* If thread survives, skip over the brk instruction and continue: */ > arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
On Wed, Jul 13, 2022 at 09:57:30AM +0530, Anshuman Khandual wrote: > > On 7/12/22 21:44, Mark Rutland wrote: > > Currently, but_handler() and kasan_handler() call die() with '0' as the > > s/but_handler/bug_handler > > > 'err' value, whereas die_kernel_fault() passes the ESR_ELx value. > > > > For consistencty, this patch ensures we always pass the ESR_ELx value to > > s/consistencty/consistency Thanks for hte pointers; these are fixed now. > > die(). As this is only called for exceptions taken from kernel mode, > > there should be no user-visible change as a result of this patch. > > Why should not change do_undefinstr() to pass 'esr' into die() as well. Sure; I've made that change locally. Thanks, Mark. > > > > > Signed-off-by: Mark Rutland <mark.rutland@arm.com> > > Cc: Alexandru Elisei <alexandru.elisei@arm.com> > > Cc: Amit Daniel Kachhap <amit.kachhap@arm.com> > > Cc: Catalin Marinas <catalin.marinas@arm.com> > > Cc: James Morse <james.morse@arm.com> > > Cc: Mark Brown <broonie@kernel.org> > > Cc: Will Deacon <will@kernel.org> > > --- > > arch/arm64/kernel/traps.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > > index da8ffef6f7c5..6739ce64caf8 100644 > > --- a/arch/arm64/kernel/traps.c > > +++ b/arch/arm64/kernel/traps.c > > @@ -972,7 +972,7 @@ static int bug_handler(struct pt_regs *regs, unsigned long esr) > > { > > switch (report_bug(regs->pc, regs)) { > > case BUG_TRAP_TYPE_BUG: > > - die("Oops - BUG", regs, 0); > > + die("Oops - BUG", regs, esr); > > break; > > > > case BUG_TRAP_TYPE_WARN: > > @@ -1040,7 +1040,7 @@ static int kasan_handler(struct pt_regs *regs, unsigned long esr) > > * This is something that might be fixed at some point in the future. > > */ > > if (!recover) > > - die("Oops - KASAN", regs, 0); > > + die("Oops - KASAN", regs, esr); > > > > /* If thread survives, skip over the brk instruction and continue: */ > > arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index da8ffef6f7c5..6739ce64caf8 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -972,7 +972,7 @@ static int bug_handler(struct pt_regs *regs, unsigned long esr) { switch (report_bug(regs->pc, regs)) { case BUG_TRAP_TYPE_BUG: - die("Oops - BUG", regs, 0); + die("Oops - BUG", regs, esr); break; case BUG_TRAP_TYPE_WARN: @@ -1040,7 +1040,7 @@ static int kasan_handler(struct pt_regs *regs, unsigned long esr) * This is something that might be fixed at some point in the future. */ if (!recover) - die("Oops - KASAN", regs, 0); + die("Oops - KASAN", regs, esr); /* If thread survives, skip over the brk instruction and continue: */ arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE);
Currently, but_handler() and kasan_handler() call die() with '0' as the 'err' value, whereas die_kernel_fault() passes the ESR_ELx value. For consistencty, this patch ensures we always pass the ESR_ELx value to die(). As this is only called for exceptions taken from kernel mode, there should be no user-visible change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Alexandru Elisei <alexandru.elisei@arm.com> Cc: Amit Daniel Kachhap <amit.kachhap@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Mark Brown <broonie@kernel.org> Cc: Will Deacon <will@kernel.org> --- arch/arm64/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)