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

From: Mark Rutland
Date: Thu Jun 22 2023 - 05:52:03 EST


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,
Mark.