RE: [PATCH v2] kasan: fix deadlock in start_report()

From: 袁帅(Shuai Yuan)
Date: Thu Feb 09 2023 - 21:35:46 EST


On Friday, February 10, 2023 at 6:54 AM Andrey Konovalov <andreyknvl@xxxxxxxxx>
wrote:
> 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/com
> > mit/?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?

Yes, I need some time to clarify this problem with a clear log by test.

> > 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.
ZEKU
信息安全声明:本邮件包含信息归发件人所在组织ZEKU所有。 禁止任何人在未经授权的情况下以任何形式(包括但不限于全部或部分披露、复制或传播)使用包含的信息。若您错收了本邮件,请立即电话或邮件通知发件人,并删除本邮件及附件。
Information Security Notice: The information contained in this mail is solely property of the sender's organization ZEKU. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.