Re: next: Rpi4: Unexpected kernel BRK exception at EL1

From: Puranjay Mohan
Date: Mon Jun 26 2023 - 05:08:20 EST


Hi Naresh,

On Thu, Jun 22, 2023 at 2:35 PM Naresh Kamboju
<naresh.kamboju@xxxxxxxxxx> wrote:
>
> Hi Mark,
>
> On Thu, 22 Jun 2023 at 15:12, Mark Rutland <mark.rutland@xxxxxxx> wrote:
> >
> > On Wed, Jun 21, 2023 at 01:57:21PM +0100, Mark Rutland wrote:
> > > On Wed, Jun 21, 2023 at 06:06:51PM +0530, Naresh Kamboju wrote:
> > > > Following boot warnings and crashes noticed on arm64 Rpi4 device running
> > > > Linux next-20230621 kernel.
> > > >
> > > > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
> > > >
> > > > boot log:
> > > >
> > > > [ 22.331748] Kernel text patching generated an invalid instruction
> > > > at 0xffff8000835d6580!
> > > > [ 22.340579] Unexpected kernel BRK exception at EL1
> > > > [ 22.346141] Internal error: BRK handler: 00000000f2000100 [#1] PREEMPT SMP
> > >
> > > This indicates execution of AARCH64_BREAK_FAULT.
> > >
> > > That could be from dodgy arguments to aarch64_insn_gen_*(), or elsewhere, and
> > > given this is in the networking code I suspect this'll be related to BPF.
> > >
> > > Looking at next-20230621 I see commit:
> > >
> > > 49703aa2adfaff28 ("bpf, arm64: use bpf_jit_binary_pack_alloc")
> > >
> > > ... which changed the way BPF allocates memory, and has code that pads memory
> > > with a bunch of AARCH64_BREAK_FAULT, so it looks like that *might* be related.
> >
> > For the benefit of those just looknig at this thread, there has been some
> > discussion in the original thread for this commit. Summary and links below.
> >
> > We identified a potential issue with missing cache maintenance:
> >
> > https://lore.kernel.org/linux-arm-kernel/ZJMXqTffB22LSOkd@FVFF77S0Q05N/
> >
> > Puranjay verified that was causing the problem seen here:
> >
> > https://lore.kernel.org/linux-arm-kernel/CANk7y0h5ucxmMz4K8sGx7qogFyx6PRxYxmFtwTRO7=0Y=B4ugw@xxxxxxxxxxxxxx/
> >
> > Alexei has dropped this commit for now:
> >
> > https://lore.kernel.org/linux-arm-kernel/CAADnVQJqDOMABEx8JuU6r_Dehyf=SkDfRNChx1oNfqPoo7pSrw@xxxxxxxxxxxxxx/
>
> Thanks for the detailed information.
> I am happy to test any proposed fix patches.

I have sent the v4 of the patch series:
https://lore.kernel.org/bpf/20230626085811.3192402-1-puranjay12@xxxxxxxxx/T/#t
This works on my raspberry pi 4 setup. If possible can you test this
on the similar setup where it was failing earlier?

>
>
> >
> > Thanks,
> > Mark.
>
> - Naresh


Thanks,
Puranjay