Re: [PATCH 4/4] mm/slub: free KFENCE objects in slab_free_hook()

Andrey Konovalov
2023-12-11T22:12:05Z

On Wed, Dec 6, 2023 at 3:45 PM Marco Elver <elver@google.com> wrote:
>
> The is_kfence_address() implementation tolerates tagged addresses,
> i.e. if it receives a tagged non-kfence address, it will never return
> true.
>
> The KASAN_HW_TAGS patches and KFENCE patches were in development
> concurrently, and at the time there was some conflict resolution that
> happened when both were merged. The
> is_kfence_address(kasan_reset_tag(..)) initially came from [1] but was
> squashed into 2b8305260fb.
>
> [1] https://lore.kernel.org/all/9dc196006921b191d25d10f6e611316db7da2efc.1611946152.git.andreyknvl@google.com/
>
> Andrey, do you recall what issue you encountered that needed kasan_reset_tag()?

I don't remember at this point, but this could have been just a safety measure.

If is_kfence_address tolerates tagged addresses, we should be able to
drop these kasan_reset_tag calls.