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

Mark Brown broonie at kernel.org
Wed Jan 17 10:25:06 PST 2024


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240117/87d86285/attachment.sig>


More information about the linux-arm-kernel mailing list