On Thu, Feb 9, 2023 at 11:44 AM Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote: > > On Thu, 9 Feb 2023 at 10:19, 袁帅(Shuai Yuan) <yuanshuai@xxxxxxxx> wrote: > > > > Hi Dmitry Vyukov > > > > Thanks, I see that your means. > > > > Currently, report_suppressed() seem not work in Kasan-HW mode, it always return false. > > Do you think should change the report_suppressed function? > > I don't know why CONFIG_KASAN_HW_TAGS was blocked separately before. > > That logic was added by Andrey in: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c068664c97c7cf > > Andrey, can we make report_enabled() check current->kasan_depth and > remove report_suppressed()? I decided to not use kasan_depth for HW_TAGS, as we can always use a match-all tag to make "invalid" memory accesses. I think we can fix the reporting code to do exactly that so that it doesn't cause MTE faults. Shuai, could you clarify, at which point due kasan_report_invalid_free an MTE exception is raised in your tests? > Then we can also remove the comment in kasan_report_invalid_free(). > > It looks like kasan_disable_current() in kmemleak needs to affect > HW_TAGS mode as well: > https://elixir.bootlin.com/linux/v6.2-rc7/source/mm/kmemleak.c#L301 It uses kasan_reset_tag, so it should work properly with HW_TAGS.