Re: [PATCH] arm: drop arch implementation for find_bit() functions
From: Guenter Roeck
Date: Tue Jul 26 2022 - 14:35:26 EST
On Tue, Jul 26, 2022 at 08:44:07AM -0700, Yury Norov wrote:
> find_next_bit(bitmap, nbits, off) shouldn't touch memory if
> nbits == 0 or off >= nbits to avoid out-of-boundary access.
>
> Generic implementation has explicit check for this, but arm doesn't,
> which is spotted by KFENCE when running test_bitmap.
>
...
> CC: Guenter Roeck <linux@xxxxxxxxxxxx>
> CC: Dennis Zhou <dennis@xxxxxxxxxx>
> CC: Russell King <linux@xxxxxxxxxxxxxxx>
> CC: Catalin Marinas <catalin.marinas@xxxxxxx>
> CC: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
bitmap unit tests succeed, and the KFENCE report is no longer seen
even after 65 retries (previously it reproduced easily with 5-15
retries).
Tested-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Guenter