[PATCH] ARM: mm: Disregard user space addresses in BUG() address check

Ard Biesheuvel ardb at kernel.org
Thu Jan 18 05:16:57 PST 2024


On Wed, 17 Jan 2024 at 19:25, Mark Brown <broonie at kernel.org> wrote:
>
> On Wed, Jan 17, 2024 at 04:07:34PM +0100, Ard Biesheuvel wrote:
> > From: Ard Biesheuvel <ardb at kernel.org>
> >
> > is_valid_bugaddr() dereferences the faulting PC to fetch the instruction
> > that triggered the fault, to decide whether it is a BRK instruction used
> > to force an exception. This is used by the BUG() infrastructure to keep
> > the handling logic (which should never execute) separate from the code
> > that normally runs.
>
> ...
>
> > Given that BRK instructions tied to BUG() handling can only appear in
> > kernel code, let's check first that the PC actually points into kernel
> > memory.
>
> This makes sense to me and resolves the LKDTM issues I originally
> reported to Kees, the LKDTM selftests now finish rather than causing the
> board to reset mid test.
>
> Reviewed-by: Mark Brown <broonie at kernel.org>
> Tested-by: Mark Brown <broonie at kernel.org>
>
> Kees, you can see a test run at:
>
>   https://lava.sirena.org.uk/scheduler/job/466606

Thanks

I've dropped this into the patch tracker as #9348



More information about the linux-arm-kernel mailing list